Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35334
b: refs/heads/master
c: ecf7f35
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Garzik committed Sep 17, 2006
1 parent 98c19db commit e82b92d
Show file tree
Hide file tree
Showing 13 changed files with 454 additions and 342 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c233289c29369dba7177ca873e9b8ed457af2a78
refs/heads/master: ecf7f354e228ac9e80d2d25a0a0cbc8c876e9ab4
9 changes: 0 additions & 9 deletions trunk/drivers/s390/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ config QETH_VLAN
If CONFIG_QETH is switched on, this option will include IEEE
802.1q VLAN support in the qeth device driver.

config QETH_PERF_STATS
bool "Performance statistics in /proc"
depends on QETH
help
When switched on, this option will add a file in the proc-fs
(/proc/qeth_perf_stats) containing performance statistics. It
may slightly impact performance, so this is only recommended for
internal tuning of the device driver.

config CCWGROUP
tristate
default (LCS || CTC || QETH)
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/s390/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ obj-$(CONFIG_SMSGIUCV) += smsgiucv.o
obj-$(CONFIG_CTC) += ctc.o fsm.o cu3088.o
obj-$(CONFIG_LCS) += lcs.o cu3088.o
obj-$(CONFIG_CLAW) += claw.o cu3088.o
obj-$(CONFIG_MPC) += ctcmpc.o fsm.o cu3088.o
qeth-y := qeth_main.o qeth_mpc.o qeth_sys.o qeth_eddp.o
qeth-$(CONFIG_PROC_FS) += qeth_proc.o
obj-$(CONFIG_QETH) += qeth.o
3 changes: 3 additions & 0 deletions trunk/drivers/s390/net/ctcmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,9 @@ add_channel(struct ccw_device *cdev, enum channel_types type)
kfree(ch);
return 0;
}

spin_lock_init(&ch->collect_lock);

fsm_settimer(ch->fsm, &ch->timer);
skb_queue_head_init(&ch->io_queue);
skb_queue_head_init(&ch->collect_queue);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/s390/net/iucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ do { \

#else

#define iucv_debug(lvl, fmt, args...)
#define iucv_dumpit(title, buf, len)
#define iucv_debug(lvl, fmt, args...) do { } while (0)
#define iucv_dumpit(title, buf, len) do { } while (0)

#endif

Expand Down
13 changes: 5 additions & 8 deletions trunk/drivers/s390/net/lcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,8 @@ lcs_ready_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
int index, rc;

LCS_DBF_TEXT(5, trace, "rdybuff");
if (buffer->state != BUF_STATE_LOCKED &&
buffer->state != BUF_STATE_PROCESSED)
BUG();
BUG_ON(buffer->state != BUF_STATE_LOCKED &&
buffer->state != BUF_STATE_PROCESSED);
spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
buffer->state = BUF_STATE_READY;
index = buffer - channel->iob;
Expand All @@ -696,8 +695,7 @@ __lcs_processed_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
int index, prev, next;

LCS_DBF_TEXT(5, trace, "prcsbuff");
if (buffer->state != BUF_STATE_READY)
BUG();
BUG_ON(buffer->state != BUF_STATE_READY);
buffer->state = BUF_STATE_PROCESSED;
index = buffer - channel->iob;
prev = (index - 1) & (LCS_NUM_BUFFS - 1);
Expand Down Expand Up @@ -729,9 +727,8 @@ lcs_release_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
unsigned long flags;

LCS_DBF_TEXT(5, trace, "relbuff");
if (buffer->state != BUF_STATE_LOCKED &&
buffer->state != BUF_STATE_PROCESSED)
BUG();
BUG_ON(buffer->state != BUF_STATE_LOCKED &&
buffer->state != BUF_STATE_PROCESSED);
spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
buffer->state = BUF_STATE_EMPTY;
spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
Expand Down
80 changes: 64 additions & 16 deletions trunk/drivers/s390/net/netiucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ struct iucv_connection {
/**
* Linked list of all connection structs.
*/
static struct iucv_connection *iucv_connections;
struct iucv_connection_struct {
struct iucv_connection *iucv_connections;
rwlock_t iucv_rwlock;
};

static struct iucv_connection_struct iucv_conns;

/**
* Representation of event-data for the
Expand Down Expand Up @@ -1368,8 +1373,10 @@ user_write (struct device *dev, struct device_attribute *attr, const char *buf,
struct net_device *ndev = priv->conn->netdev;
char *p;
char *tmp;
char username[10];
char username[9];
int i;
struct iucv_connection **clist = &iucv_conns.iucv_connections;
unsigned long flags;

IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
if (count>9) {
Expand All @@ -1382,7 +1389,7 @@ user_write (struct device *dev, struct device_attribute *attr, const char *buf,
tmp = strsep((char **) &buf, "\n");
for (i=0, p=tmp; i<8 && *p; i++, p++) {
if (isalnum(*p) || (*p == '$'))
username[i]= *p;
username[i]= toupper(*p);
else if (*p == '\n') {
/* trailing lf, grr */
break;
Expand All @@ -1395,11 +1402,11 @@ user_write (struct device *dev, struct device_attribute *attr, const char *buf,
return -EINVAL;
}
}
while (i<9)
while (i<8)
username[i++] = ' ';
username[9] = '\0';
username[8] = '\0';

if (memcmp(username, priv->conn->userid, 8)) {
if (memcmp(username, priv->conn->userid, 9)) {
/* username changed */
if (ndev->flags & (IFF_UP | IFF_RUNNING)) {
PRINT_WARN(
Expand All @@ -1410,6 +1417,19 @@ user_write (struct device *dev, struct device_attribute *attr, const char *buf,
return -EBUSY;
}
}
read_lock_irqsave(&iucv_conns.iucv_rwlock, flags);
while (*clist) {
if (!strncmp(username, (*clist)->userid, 9) ||
((*clist)->netdev != ndev))
break;
clist = &((*clist)->next);
}
read_unlock_irqrestore(&iucv_conns.iucv_rwlock, flags);
if (*clist) {
PRINT_WARN("netiucv: Connection to %s already exists\n",
username);
return -EEXIST;
}
memcpy(priv->conn->userid, username, 9);

return count;
Expand Down Expand Up @@ -1781,13 +1801,15 @@ netiucv_unregister_device(struct device *dev)
static struct iucv_connection *
netiucv_new_connection(struct net_device *dev, char *username)
{
struct iucv_connection **clist = &iucv_connections;
unsigned long flags;
struct iucv_connection **clist = &iucv_conns.iucv_connections;
struct iucv_connection *conn =
kzalloc(sizeof(struct iucv_connection), GFP_KERNEL);

if (conn) {
skb_queue_head_init(&conn->collect_queue);
skb_queue_head_init(&conn->commit_queue);
spin_lock_init(&conn->collect_lock);
conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT;
conn->netdev = dev;

Expand Down Expand Up @@ -1822,8 +1844,10 @@ netiucv_new_connection(struct net_device *dev, char *username)
fsm_newstate(conn->fsm, CONN_STATE_STOPPED);
}

write_lock_irqsave(&iucv_conns.iucv_rwlock, flags);
conn->next = *clist;
*clist = conn;
write_unlock_irqrestore(&iucv_conns.iucv_rwlock, flags);
}
return conn;
}
Expand All @@ -1835,14 +1859,17 @@ netiucv_new_connection(struct net_device *dev, char *username)
static void
netiucv_remove_connection(struct iucv_connection *conn)
{
struct iucv_connection **clist = &iucv_connections;
struct iucv_connection **clist = &iucv_conns.iucv_connections;
unsigned long flags;

IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
if (conn == NULL)
return;
write_lock_irqsave(&iucv_conns.iucv_rwlock, flags);
while (*clist) {
if (*clist == conn) {
*clist = conn->next;
write_unlock_irqrestore(&iucv_conns.iucv_rwlock, flags);
if (conn->handle) {
iucv_unregister_program(conn->handle);
conn->handle = NULL;
Expand All @@ -1855,6 +1882,7 @@ netiucv_remove_connection(struct iucv_connection *conn)
}
clist = &((*clist)->next);
}
write_unlock_irqrestore(&iucv_conns.iucv_rwlock, flags);
}

/**
Expand Down Expand Up @@ -1947,9 +1975,11 @@ static ssize_t
conn_write(struct device_driver *drv, const char *buf, size_t count)
{
char *p;
char username[10];
char username[9];
int i, ret;
struct net_device *dev;
struct iucv_connection **clist = &iucv_conns.iucv_connections;
unsigned long flags;

IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
if (count>9) {
Expand All @@ -1960,7 +1990,7 @@ conn_write(struct device_driver *drv, const char *buf, size_t count)

for (i=0, p=(char *)buf; i<8 && *p; i++, p++) {
if (isalnum(*p) || (*p == '$'))
username[i]= *p;
username[i]= toupper(*p);
else if (*p == '\n') {
/* trailing lf, grr */
break;
Expand All @@ -1971,9 +2001,22 @@ conn_write(struct device_driver *drv, const char *buf, size_t count)
return -EINVAL;
}
}
while (i<9)
while (i<8)
username[i++] = ' ';
username[9] = '\0';
username[8] = '\0';

read_lock_irqsave(&iucv_conns.iucv_rwlock, flags);
while (*clist) {
if (!strncmp(username, (*clist)->userid, 9))
break;
clist = &((*clist)->next);
}
read_unlock_irqrestore(&iucv_conns.iucv_rwlock, flags);
if (*clist) {
PRINT_WARN("netiucv: Connection to %s already exists\n",
username);
return -EEXIST;
}
dev = netiucv_init_netdevice(username);
if (!dev) {
PRINT_WARN(
Expand Down Expand Up @@ -2015,7 +2058,8 @@ DRIVER_ATTR(connection, 0200, NULL, conn_write);
static ssize_t
remove_write (struct device_driver *drv, const char *buf, size_t count)
{
struct iucv_connection **clist = &iucv_connections;
struct iucv_connection **clist = &iucv_conns.iucv_connections;
unsigned long flags;
struct net_device *ndev;
struct netiucv_priv *priv;
struct device *dev;
Expand All @@ -2026,7 +2070,7 @@ remove_write (struct device_driver *drv, const char *buf, size_t count)
IUCV_DBF_TEXT(trace, 3, __FUNCTION__);

if (count >= IFNAMSIZ)
count = IFNAMSIZ-1;
count = IFNAMSIZ - 1;;

for (i=0, p=(char *)buf; i<count && *p; i++, p++) {
if ((*p == '\n') || (*p == ' ')) {
Expand All @@ -2038,6 +2082,7 @@ remove_write (struct device_driver *drv, const char *buf, size_t count)
}
name[i] = '\0';

read_lock_irqsave(&iucv_conns.iucv_rwlock, flags);
while (*clist) {
ndev = (*clist)->netdev;
priv = (struct netiucv_priv*)ndev->priv;
Expand All @@ -2047,6 +2092,7 @@ remove_write (struct device_driver *drv, const char *buf, size_t count)
clist = &((*clist)->next);
continue;
}
read_unlock_irqrestore(&iucv_conns.iucv_rwlock, flags);
if (ndev->flags & (IFF_UP | IFF_RUNNING)) {
PRINT_WARN(
"netiucv: net device %s active with peer %s\n",
Expand All @@ -2060,6 +2106,7 @@ remove_write (struct device_driver *drv, const char *buf, size_t count)
netiucv_unregister_device(dev);
return count;
}
read_unlock_irqrestore(&iucv_conns.iucv_rwlock, flags);
PRINT_WARN("netiucv: net device %s unknown\n", name);
IUCV_DBF_TEXT(data, 2, "remove_write: unknown device\n");
return -EINVAL;
Expand All @@ -2077,8 +2124,8 @@ static void __exit
netiucv_exit(void)
{
IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
while (iucv_connections) {
struct net_device *ndev = iucv_connections->netdev;
while (iucv_conns.iucv_connections) {
struct net_device *ndev = iucv_conns.iucv_connections->netdev;
struct netiucv_priv *priv = (struct netiucv_priv*)ndev->priv;
struct device *dev = priv->dev;

Expand Down Expand Up @@ -2120,6 +2167,7 @@ netiucv_init(void)
if (!ret) {
ret = driver_create_file(&netiucv_driver, &driver_attr_remove);
netiucv_banner();
rwlock_init(&iucv_conns.iucv_rwlock);
} else {
PRINT_ERR("NETIUCV: failed to add driver attribute.\n");
IUCV_DBF_TEXT_(setup, 2, "ret %d from driver_create_file\n", ret);
Expand Down
Loading

0 comments on commit e82b92d

Please sign in to comment.