Skip to content

Commit 293d984

Browse files
Peter TiedemannJeff Garzik
authored andcommitted
ctcm: infrastructure for replaced ctc driver
ctcm driver supports the channel-to-channel connections of the old ctc driver plus an additional MPC protocol to provide SNA connectivity. This new ctcm driver replaces the existing ctc driver. Signed-off-by: Peter Tiedemann <[email protected]> Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
1 parent f423f73 commit 293d984

File tree

11 files changed

+7920
-8
lines changed

11 files changed

+7920
-8
lines changed

drivers/s390/net/Kconfig

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ config LCS
1111
To compile as a module, choose M. The module name is lcs.ko.
1212
If you do not know what it is, it's safe to choose Y.
1313

14-
config CTC
15-
tristate "CTC device support"
14+
config CTCM
15+
tristate "CTC and MPC SNA device support"
1616
depends on CCW && NETDEVICES
1717
help
1818
Select this option if you want to use channel-to-channel
1919
point-to-point networking on IBM System z.
2020
This device driver supports real CTC coupling using ESCON.
2121
It also supports virtual CTCs when running under VM.
22-
To compile as a module, choose M. The module name is ctc.ko.
22+
This driver also supports channel-to-channel MPC SNA devices.
23+
MPC is an SNA protocol device used by Communication Server for Linux.
24+
To compile as a module, choose M. The module name is ctcm.ko.
2325
To compile into the kernel, choose Y.
2426
If you do not need any channel-to-channel connection, choose N.
2527

@@ -84,7 +86,7 @@ config QETH_VLAN
8486
802.1q VLAN support in the qeth device driver.
8587

8688
config CCWGROUP
87-
tristate
88-
default (LCS || CTC || QETH)
89+
tristate
90+
default (LCS || CTCM || QETH)
8991

9092
endmenu

drivers/s390/net/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
# S/390 network devices
33
#
44

5-
ctc-objs := ctcmain.o ctcdbug.o
6-
5+
ctcm-y += ctcm_main.o ctcm_fsms.o ctcm_mpc.o ctcm_sysfs.o ctcm_dbug.o
6+
obj-$(CONFIG_CTCM) += ctcm.o fsm.o cu3088.o
77
obj-$(CONFIG_NETIUCV) += netiucv.o fsm.o
88
obj-$(CONFIG_SMSGIUCV) += smsgiucv.o
9-
obj-$(CONFIG_CTC) += ctc.o fsm.o cu3088.o
109
obj-$(CONFIG_LCS) += lcs.o cu3088.o
1110
obj-$(CONFIG_CLAW) += claw.o cu3088.o
1211
qeth-y := qeth_main.o qeth_mpc.o qeth_sys.o qeth_eddp.o

drivers/s390/net/ctcm_dbug.c

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* drivers/s390/net/ctcm_dbug.c
3+
*
4+
* Copyright IBM Corp. 2001, 2007
5+
* Authors: Peter Tiedemann ([email protected])
6+
*
7+
*/
8+
9+
#include <linux/stddef.h>
10+
#include <linux/kernel.h>
11+
#include <linux/errno.h>
12+
#include <linux/slab.h>
13+
#include <linux/ctype.h>
14+
#include <linux/sysctl.h>
15+
#include <linux/module.h>
16+
#include <linux/init.h>
17+
#include <linux/fs.h>
18+
#include <linux/debugfs.h>
19+
#include "ctcm_dbug.h"
20+
21+
/*
22+
* Debug Facility Stuff
23+
*/
24+
25+
DEFINE_PER_CPU(char[256], ctcm_dbf_txt_buf);
26+
27+
struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS] = {
28+
[CTCM_DBF_SETUP] = {"ctc_setup", 8, 1, 64, 5, NULL},
29+
[CTCM_DBF_ERROR] = {"ctc_error", 8, 1, 64, 3, NULL},
30+
[CTCM_DBF_TRACE] = {"ctc_trace", 8, 1, 64, 3, NULL},
31+
[CTCM_DBF_MPC_SETUP] = {"mpc_setup", 8, 1, 64, 5, NULL},
32+
[CTCM_DBF_MPC_ERROR] = {"mpc_error", 8, 1, 64, 3, NULL},
33+
[CTCM_DBF_MPC_TRACE] = {"mpc_trace", 8, 1, 64, 3, NULL},
34+
};
35+
36+
void ctcm_unregister_dbf_views(void)
37+
{
38+
int x;
39+
for (x = 0; x < CTCM_DBF_INFOS; x++) {
40+
debug_unregister(ctcm_dbf[x].id);
41+
ctcm_dbf[x].id = NULL;
42+
}
43+
}
44+
45+
int ctcm_register_dbf_views(void)
46+
{
47+
int x;
48+
for (x = 0; x < CTCM_DBF_INFOS; x++) {
49+
/* register the areas */
50+
ctcm_dbf[x].id = debug_register(ctcm_dbf[x].name,
51+
ctcm_dbf[x].pages,
52+
ctcm_dbf[x].areas,
53+
ctcm_dbf[x].len);
54+
if (ctcm_dbf[x].id == NULL) {
55+
ctcm_unregister_dbf_views();
56+
return -ENOMEM;
57+
}
58+
59+
/* register a view */
60+
debug_register_view(ctcm_dbf[x].id, &debug_hex_ascii_view);
61+
/* set a passing level */
62+
debug_set_level(ctcm_dbf[x].id, ctcm_dbf[x].level);
63+
}
64+
65+
return 0;
66+
}
67+

drivers/s390/net/ctcm_dbug.h

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/*
2+
* drivers/s390/net/ctcm_dbug.h
3+
*
4+
* Copyright IBM Corp. 2001, 2007
5+
* Authors: Peter Tiedemann ([email protected])
6+
*
7+
*/
8+
9+
#ifndef _CTCM_DBUG_H_
10+
#define _CTCM_DBUG_H_
11+
12+
/*
13+
* Debug Facility stuff
14+
*/
15+
16+
#include <asm/debug.h>
17+
18+
#ifdef DEBUG
19+
#define do_debug 1
20+
#else
21+
#define do_debug 0
22+
#endif
23+
#ifdef DEBUGDATA
24+
#define do_debug_data 1
25+
#else
26+
#define do_debug_data 0
27+
#endif
28+
#ifdef DEBUGCCW
29+
#define do_debug_ccw 1
30+
#else
31+
#define do_debug_ccw 0
32+
#endif
33+
34+
/* define dbf debug levels similar to kernel msg levels */
35+
#define CTC_DBF_ALWAYS 0 /* always print this */
36+
#define CTC_DBF_EMERG 0 /* system is unusable */
37+
#define CTC_DBF_ALERT 1 /* action must be taken immediately */
38+
#define CTC_DBF_CRIT 2 /* critical conditions */
39+
#define CTC_DBF_ERROR 3 /* error conditions */
40+
#define CTC_DBF_WARN 4 /* warning conditions */
41+
#define CTC_DBF_NOTICE 5 /* normal but significant condition */
42+
#define CTC_DBF_INFO 5 /* informational */
43+
#define CTC_DBF_DEBUG 6 /* debug-level messages */
44+
45+
DECLARE_PER_CPU(char[256], ctcm_dbf_txt_buf);
46+
47+
enum ctcm_dbf_names {
48+
CTCM_DBF_SETUP,
49+
CTCM_DBF_ERROR,
50+
CTCM_DBF_TRACE,
51+
CTCM_DBF_MPC_SETUP,
52+
CTCM_DBF_MPC_ERROR,
53+
CTCM_DBF_MPC_TRACE,
54+
CTCM_DBF_INFOS /* must be last element */
55+
};
56+
57+
struct ctcm_dbf_info {
58+
char name[DEBUG_MAX_NAME_LEN];
59+
int pages;
60+
int areas;
61+
int len;
62+
int level;
63+
debug_info_t *id;
64+
};
65+
66+
extern struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS];
67+
68+
int ctcm_register_dbf_views(void);
69+
void ctcm_unregister_dbf_views(void);
70+
71+
static inline const char *strtail(const char *s, int n)
72+
{
73+
int l = strlen(s);
74+
return (l > n) ? s + (l - n) : s;
75+
}
76+
77+
/* sort out levels early to avoid unnecessary sprintfs */
78+
static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level)
79+
{
80+
return (dbf_grp->level >= level);
81+
}
82+
83+
#define CTCM_FUNTAIL strtail((char *)__func__, 16)
84+
85+
#define CTCM_DBF_TEXT(name, level, text) \
86+
do { \
87+
debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, level, text); \
88+
} while (0)
89+
90+
#define CTCM_DBF_HEX(name, level, addr, len) \
91+
do { \
92+
debug_event(ctcm_dbf[CTCM_DBF_##name].id, \
93+
level, (void *)(addr), len); \
94+
} while (0)
95+
96+
#define CTCM_DBF_TEXT_(name, level, text...) \
97+
do { \
98+
if (ctcm_dbf_passes(ctcm_dbf[CTCM_DBF_##name].id, level)) { \
99+
char *ctcm_dbf_txt_buf = \
100+
get_cpu_var(ctcm_dbf_txt_buf); \
101+
sprintf(ctcm_dbf_txt_buf, text); \
102+
debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, \
103+
level, ctcm_dbf_txt_buf); \
104+
put_cpu_var(ctcm_dbf_txt_buf); \
105+
} \
106+
} while (0)
107+
108+
/*
109+
* cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
110+
* dev : netdevice with valid name field.
111+
* text: any text string.
112+
*/
113+
#define CTCM_DBF_DEV_NAME(cat, dev, text) \
114+
do { \
115+
CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) : %s", \
116+
CTCM_FUNTAIL, dev->name, text); \
117+
} while (0)
118+
119+
#define MPC_DBF_DEV_NAME(cat, dev, text) \
120+
do { \
121+
CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) : %s", \
122+
CTCM_FUNTAIL, dev->name, text); \
123+
} while (0)
124+
125+
#define CTCMY_DBF_DEV_NAME(cat, dev, text) \
126+
do { \
127+
if (IS_MPCDEV(dev)) \
128+
MPC_DBF_DEV_NAME(cat, dev, text); \
129+
else \
130+
CTCM_DBF_DEV_NAME(cat, dev, text); \
131+
} while (0)
132+
133+
/*
134+
* cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
135+
* dev : netdevice.
136+
* text: any text string.
137+
*/
138+
#define CTCM_DBF_DEV(cat, dev, text) \
139+
do { \
140+
CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) : %s", \
141+
CTCM_FUNTAIL, dev, text); \
142+
} while (0)
143+
144+
#define MPC_DBF_DEV(cat, dev, text) \
145+
do { \
146+
CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) : %s", \
147+
CTCM_FUNTAIL, dev, text); \
148+
} while (0)
149+
150+
#define CTCMY_DBF_DEV(cat, dev, text) \
151+
do { \
152+
if (IS_MPCDEV(dev)) \
153+
MPC_DBF_DEV(cat, dev, text); \
154+
else \
155+
CTCM_DBF_DEV(cat, dev, text); \
156+
} while (0)
157+
158+
#endif

0 commit comments

Comments
 (0)