Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 293d984f authored by Peter Tiedemann's avatar Peter Tiedemann Committed by Jeff Garzik
Browse files

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: default avatarPeter Tiedemann <ptiedem@de.ibm.com>
Signed-off-by: default avatarUrsula Braun <braunu@de.ibm.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent f423f735
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -11,15 +11,17 @@ config LCS
	   To compile as a module, choose M. The module name is lcs.ko.
	   To compile as a module, choose M. The module name is lcs.ko.
	   If you do not know what it is, it's safe to choose Y.
	   If you do not know what it is, it's safe to choose Y.


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


@@ -85,6 +87,6 @@ config QETH_VLAN


config CCWGROUP
config CCWGROUP
	tristate
	tristate
	default (LCS || CTC || QETH)
	default (LCS || CTCM || QETH)


endmenu
endmenu
+2 −3
Original line number Original line Diff line number Diff line
@@ -2,11 +2,10 @@
# S/390 network devices
# S/390 network devices
#
#


ctc-objs := ctcmain.o ctcdbug.o
ctcm-y += ctcm_main.o ctcm_fsms.o ctcm_mpc.o ctcm_sysfs.o ctcm_dbug.o

obj-$(CONFIG_CTCM) += ctcm.o fsm.o cu3088.o
obj-$(CONFIG_NETIUCV) += netiucv.o fsm.o
obj-$(CONFIG_NETIUCV) += netiucv.o fsm.o
obj-$(CONFIG_SMSGIUCV) += smsgiucv.o
obj-$(CONFIG_SMSGIUCV) += smsgiucv.o
obj-$(CONFIG_CTC) += ctc.o fsm.o cu3088.o
obj-$(CONFIG_LCS) += lcs.o cu3088.o
obj-$(CONFIG_LCS) += lcs.o cu3088.o
obj-$(CONFIG_CLAW) += claw.o cu3088.o
obj-$(CONFIG_CLAW) += claw.o cu3088.o
qeth-y := qeth_main.o qeth_mpc.o qeth_sys.o qeth_eddp.o 
qeth-y := qeth_main.o qeth_mpc.o qeth_sys.o qeth_eddp.o 
+67 −0
Original line number Original line Diff line number Diff line
/*
 *	drivers/s390/net/ctcm_dbug.c
 *
 *	Copyright IBM Corp. 2001, 2007
 *	Authors:	Peter Tiedemann (ptiedem@de.ibm.com)
 *
 */

#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/sysctl.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/debugfs.h>
#include "ctcm_dbug.h"

/*
 * Debug Facility Stuff
 */

DEFINE_PER_CPU(char[256], ctcm_dbf_txt_buf);

struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS] = {
	[CTCM_DBF_SETUP]	= {"ctc_setup", 8, 1, 64, 5, NULL},
	[CTCM_DBF_ERROR]	= {"ctc_error", 8, 1, 64, 3, NULL},
	[CTCM_DBF_TRACE]	= {"ctc_trace", 8, 1, 64, 3, NULL},
	[CTCM_DBF_MPC_SETUP]	= {"mpc_setup", 8, 1, 64, 5, NULL},
	[CTCM_DBF_MPC_ERROR]	= {"mpc_error", 8, 1, 64, 3, NULL},
	[CTCM_DBF_MPC_TRACE]	= {"mpc_trace", 8, 1, 64, 3, NULL},
};

void ctcm_unregister_dbf_views(void)
{
	int x;
	for (x = 0; x < CTCM_DBF_INFOS; x++) {
		debug_unregister(ctcm_dbf[x].id);
		ctcm_dbf[x].id = NULL;
	}
}

int ctcm_register_dbf_views(void)
{
	int x;
	for (x = 0; x < CTCM_DBF_INFOS; x++) {
		/* register the areas */
		ctcm_dbf[x].id = debug_register(ctcm_dbf[x].name,
						ctcm_dbf[x].pages,
						ctcm_dbf[x].areas,
						ctcm_dbf[x].len);
		if (ctcm_dbf[x].id == NULL) {
			ctcm_unregister_dbf_views();
			return -ENOMEM;
		}

		/* register a view */
		debug_register_view(ctcm_dbf[x].id, &debug_hex_ascii_view);
		/* set a passing level */
		debug_set_level(ctcm_dbf[x].id, ctcm_dbf[x].level);
	}

	return 0;
}
+158 −0
Original line number Original line Diff line number Diff line
/*
 *	drivers/s390/net/ctcm_dbug.h
 *
 *	Copyright IBM Corp. 2001, 2007
 *	Authors:	Peter Tiedemann (ptiedem@de.ibm.com)
 *
 */

#ifndef _CTCM_DBUG_H_
#define _CTCM_DBUG_H_

/*
 * Debug Facility stuff
 */

#include <asm/debug.h>

#ifdef DEBUG
 #define do_debug 1
#else
 #define do_debug 0
#endif
#ifdef DEBUGDATA
 #define do_debug_data 1
#else
 #define do_debug_data 0
#endif
#ifdef DEBUGCCW
 #define do_debug_ccw 1
#else
 #define do_debug_ccw 0
#endif

/* define dbf debug levels similar to kernel msg levels */
#define	CTC_DBF_ALWAYS	0	/* always print this 			*/
#define	CTC_DBF_EMERG	0	/* system is unusable			*/
#define	CTC_DBF_ALERT	1	/* action must be taken immediately	*/
#define	CTC_DBF_CRIT	2	/* critical conditions			*/
#define	CTC_DBF_ERROR	3	/* error conditions			*/
#define	CTC_DBF_WARN	4	/* warning conditions			*/
#define	CTC_DBF_NOTICE	5	/* normal but significant condition	*/
#define	CTC_DBF_INFO	5	/* informational			*/
#define	CTC_DBF_DEBUG	6	/* debug-level messages			*/

DECLARE_PER_CPU(char[256], ctcm_dbf_txt_buf);

enum ctcm_dbf_names {
	CTCM_DBF_SETUP,
	CTCM_DBF_ERROR,
	CTCM_DBF_TRACE,
	CTCM_DBF_MPC_SETUP,
	CTCM_DBF_MPC_ERROR,
	CTCM_DBF_MPC_TRACE,
	CTCM_DBF_INFOS	/* must be last element */
};

struct ctcm_dbf_info {
	char name[DEBUG_MAX_NAME_LEN];
	int pages;
	int areas;
	int len;
	int level;
	debug_info_t *id;
};

extern struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS];

int ctcm_register_dbf_views(void);
void ctcm_unregister_dbf_views(void);

static inline const char *strtail(const char *s, int n)
{
	int l = strlen(s);
	return (l > n) ? s + (l - n) : s;
}

/* sort out levels early to avoid unnecessary sprintfs */
static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level)
{
	return (dbf_grp->level >= level);
}

#define CTCM_FUNTAIL strtail((char *)__func__, 16)

#define CTCM_DBF_TEXT(name, level, text) \
	do { \
		debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, level, text); \
	} while (0)

#define CTCM_DBF_HEX(name, level, addr, len) \
	do { \
		debug_event(ctcm_dbf[CTCM_DBF_##name].id, \
					level, (void *)(addr), len); \
	} while (0)

#define CTCM_DBF_TEXT_(name, level, text...) \
	do { \
		if (ctcm_dbf_passes(ctcm_dbf[CTCM_DBF_##name].id, level)) { \
			char *ctcm_dbf_txt_buf = \
					 get_cpu_var(ctcm_dbf_txt_buf); \
			sprintf(ctcm_dbf_txt_buf, text); \
			debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, \
					level, ctcm_dbf_txt_buf); \
			put_cpu_var(ctcm_dbf_txt_buf); \
		} \
	} while (0)

/*
 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
 * dev : netdevice with valid name field.
 * text: any text string.
 */
#define CTCM_DBF_DEV_NAME(cat, dev, text) \
	do { \
		CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) : %s", \
			CTCM_FUNTAIL, dev->name, text); \
	} while (0)

#define MPC_DBF_DEV_NAME(cat, dev, text) \
	do { \
		CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) : %s", \
			CTCM_FUNTAIL, dev->name, text); \
	} while (0)

#define CTCMY_DBF_DEV_NAME(cat, dev, text) \
	do { \
		if (IS_MPCDEV(dev)) \
			MPC_DBF_DEV_NAME(cat, dev, text); \
		else \
			CTCM_DBF_DEV_NAME(cat, dev, text); \
	} while (0)

/*
 * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}.
 * dev : netdevice.
 * text: any text string.
 */
#define CTCM_DBF_DEV(cat, dev, text) \
	do { \
		CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) : %s", \
			CTCM_FUNTAIL, dev, text); \
	} while (0)

#define MPC_DBF_DEV(cat, dev, text) \
	do { \
		CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) : %s", \
			CTCM_FUNTAIL, dev, text); \
	} while (0)

#define CTCMY_DBF_DEV(cat, dev, text) \
	do { \
		if (IS_MPCDEV(dev)) \
			MPC_DBF_DEV(cat, dev, text); \
		else \
			CTCM_DBF_DEV(cat, dev, text); \
	} while (0)

#endif
+2347 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading