channel device layer The channel device layer is a layer to provide a consistent interface for configuration & default machine check (devices appearing & disappearing ) handling Linux for zSeries channel devices. These include among others

lcs ( the most common ethernet/token ring/fddi standard on zSeries )

ctc/escon hi speed like serial link standard on zSeries.

claw used to talk to cisco routers.

qeth gigabit ethernet.
These devices use two channels one read & one write for configuration & or communication. The motivation behind producing this layer was that there is a lot of duplicate code among the drivers for configuration so the lcs & ctc drivers tended to fight over 3088/08's & 3088/1F's which could be either 2216/3172 lcs compatible devices or escons/ctc's & to resolve this fight both device drivers had to be reconfigured rather than doing the configuration in a single place. The current setup can be read from /proc/chandev arguments can be entered by...

1.  Piping to /proc/chandev.

2.  Entering them into /etc/chandev.conf comments are prefixed #.

3.  Or from the boot command line using the 'chandev=' keyword

Multiple options can be passed separated by semicolons but no spaces are allowed between parameters. The script /bin/chandev will be called automatically on startup or a machine check of a device as follows. /bin/chandev <start starting_devnames> <machine_check (devnames pre_recovery_action_status) (post_recovery_action_status)>. The chandev layer doesn't open stdin stdout or stderr so it is advisable that you add the following lines to the start of your script.

#!/bin/bash

exec >/dev/console 2>&1 0>&1
e.g. if tr0 & ctc0 were starting up & eth0 & eth1 didn't recover from a gone machine check at the same instant the parameters would be. /bin/chandev start tr0 ctc0 machine_check eth0 gone gone eth1 gone gone This can be used for example to call /etc/rc.d/init.d/network start when a device appears & make the ipldelay kernel boot parameter obselete on native machines or recover from bad machine checks where the default machine check handling isn't adequete. The machine checks that can be presented as parameters are good not_operational no_path revalidate device_gone. valid chandev arguments are <> indicate optional parameters, | indicate a choice.

devno: is a 16 bit unsigned number used to uniquely identify a subchannel to a device.

force list: is a term specific to channel device layer describing a range of devno's to be forced to configure in a particular manner as opposed to autodetect

read_devno, write_devno, <port_no/protocol_no>, <checksum_received_ip_pkts>, <use_hw_stats>

e.g. ctc0,0x7c00,0x7c01,0,0,0

Tells the channel layer to force ctc0 if detected to use cuu's 7c00 & 7c01 port,port_no is the relative adapter no on lcs, on ctc/escon this field is the ctc/escon protocol number ( normally 0 ), don't do checksumming on received ip packets & as ctc doesn't have hardware stats so it ignores this parameter.

,chan_type,<string>

chan_type bitfield

ctc=0x1, escon=0x2, lcs=0x4, osad=0x8, qeth=0x10, claw=0x20.

This is for device driver specific options passed as a string to the driver not dealt with by the channel device layer it can't contain spaces.

<,chan_type,exact_match>

This deletes some or all device driver specific options not specifying chan_type causes it to delete all the strings. exact_match=1 specifies only to remove driver parms where chan_type is exactly equal exact_match=0 specifies to remove parms where any bit matches chan_type.

,<lo_devno>-<hi_devno>

Don't probe a range of device numbers for channel devices.

Tells the channel layer to assign device names based on the read channel cuu number.

e.g. a token ring read channel 0x7c00 would have an interface called tr0x7c00 this avoids name collisions on devices.

,<devno>

Delete a range or all noauto ranges when devno is within a range.

,read_devno

Delete a forced channel device from force list.

Opposite to use_devno_names described above.

,chan_type, cu_type, cu_model, dev_type, dev_model, max_port_no, automatic_machine_check_handling

Tells the channel layer to probe for the device described, -1 for any of the parameters other than chan_type & automatic_machine_check_handling is a wildcard. Set max_port_no to 0 for non lcs devices.

auto machine check recovery bitfield

not_operational=0x1, no_path=0x2, revalidate=0x4, gone=0x8

chan_type bitfield

ctc=0x1, escon=0x2, lcs=0x4, osad=0x8, qeth=0x10, claw=0x20

,cu_type,cu_model,dev_type,dev_model

-1 for any parameter is a wildcard,

<,lo_devno>,<hi_devno>,auto_msck_recovery

This is used to specify the kind of machine check recovery that occurs over a device range.

<,devno>

Delete a range or all machine check recovery ranges when devno is within a range.

Resets all model info, forced devices & noauto lists to null.

Resets all model info, forced devices & noauto lists back to default settings.

Resets all model info, forced devices & noauto lists to empty.

<device name|read devno>

Shuts down a particular device by device name or read devno, deregisters it & releases its interrupts or shuts down all devices if no parameter is used.

Calls probe method for channels whose interrupts are not owned.

Read instructions from /etc/chandev.conf.

Don't automatically read /etc/chandev.conf on boot.

e.g the following sequence of commands should be roughly equivalent to rebooting for channel devices.

shutdown

reset_conf

read_conf

reprobe

If you wish to write a driver channel device layer compatible

/linux/include/asm-s390/chandev.h for the apis which are commented.

/linux/drivers/s390/misc/chandev.c for the code.

cat /proc/chandev to see current options chosen. echo <command> >proc/chandev to enter a new command

A file which can be used to configure the channel device layer.

kernel parameters with the keyword.

A user script/executable which is run when devices come online "appear" or go offline "disappear".
DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)