Skip to contentSkip to conversation

s390 (6/7): network drivers.

PATCH In review Martin Schwidefsky 2 participants 2 messages Sep 11, 2003

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390 (6/7): network drivers.

- Add type attribute to ctc and lcs driver.
- Add user attribute to netiucv driver.
- Remove initialization of device.name from ctc, lcs and qeth.
- Some qeth bug fixes:
+ Call qeth_free_card on removal.
+ Remove async hsi.
+ Remove contig memusage.
+ Add check for -EFAULT to copy_from_user/copy_to_user.
+ Some inlining.
+ vlan header fixes.
+ Replace atomic_return_sub with atomic_add_return.

diffstat:

 drivers/s390/net/ctcmain.c |   40 ++-
 drivers/s390/net/cu3088.c  |    3 
 drivers/s390/net/iucv.c    |    9 
 drivers/s390/net/lcs.c     |   25 +-
 drivers/s390/net/netiucv.c |   20 +
 drivers/s390/net/qeth.c    |  537 +++++++++++++++++----------------------------
 drivers/s390/net/qeth.h    |   46 ---
 7 files changed, 279 insertions(+), 401 deletions(-)
drivers/s390/net/ctcmain.c +30 -10
diff -urN linux-2.6/drivers/s390/net/ctcmain.c linux-2.6-s390/drivers/s390/net/ctcmain.c
@@ -1,5 +1,5 @@
 /*
- * $Id: ctcmain.c,v 1.43 2003/05/27 11:34:23 mschwide Exp $
+ * $Id: ctcmain.c,v 1.46 2003/09/01 09:03:23 cohuck Exp $
  *
  * CTC / ESCON network driver
  *
@@ -36,7 +36,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.43 $
+ * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.46 $
  *
  */
 
@@ -102,7 +102,7 @@
 #define READ			0
 #define WRITE			1
 
-#define CTC_ID_SIZE             DEVICE_ID_SIZE+3
+#define CTC_ID_SIZE             BUS_ID_SIZE+3
 
 
 struct ctc_profile {
@@ -272,7 +272,7 @@
 print_banner(void)
 {
 	static int printed = 0;
-	char vbuf[] = "$Revision: 1.43 $";
+	char vbuf[] = "$Revision: 1.46 $";
 	char *version = vbuf;
 
 	if (printed)
@@ -1791,7 +1791,7 @@
 	ch->ccw[7].cda = 0;
 
 	ch->cdev = cdev;
-	snprintf(ch->id, DEVICE_ID_SIZE, "ch-%s", cdev->dev.bus_id);
+	snprintf(ch->id, CTC_ID_SIZE, "ch-%s", cdev->dev.bus_id);
 	ch->type = type;
 	ch->fsm = init_fsm(ch->id, ch_state_names,
 			   ch_event_names, NR_CH_STATES, NR_CH_EVENTS,
@@ -2786,16 +2786,38 @@
 
 static DEVICE_ATTR(protocol, 0644, ctc_proto_show, ctc_proto_store);
 
+static ssize_t
+ctc_type_show(struct device *dev, char *buf)
+{
+	struct ccwgroup_device *cgdev;
+
+	cgdev = to_ccwgroupdev(dev);
+	if (!cgdev)
+		return -ENODEV;
+
+	return sprintf(buf, "%s\n", cu3088_type[cgdev->cdev[0]->id.driver_info]);
+}
+
+static DEVICE_ATTR(type, 0444, ctc_type_show, NULL);
+
 static int
 ctc_add_files(struct device *dev)
 {
-	return device_create_file(dev, &dev_attr_protocol);
+	int rc;
 
+	rc = device_create_file(dev, &dev_attr_protocol);
+	if (rc)
+		return rc;
+	rc = device_create_file(dev, &dev_attr_type);
+	if (rc)
+		device_remove_file(dev, &dev_attr_protocol);
+	return rc;
 }
 
 static void
 ctc_remove_files(struct device *dev)
 {
+	device_remove_file(dev, &dev_attr_type);
 	device_remove_file(dev, &dev_attr_protocol);
 
 }
@@ -2838,8 +2860,6 @@
 	cgdev->dev.driver_data = priv;
 	cgdev->cdev[0]->dev.driver_data = priv;
 	cgdev->cdev[1]->dev.driver_data = priv;
-	snprintf(cgdev->dev.name, DEVICE_NAME_SIZE, "%s",
-		 cu3088_type[cgdev->cdev[0]->id.driver_info]);
 
 	return 0;
 }
@@ -2868,8 +2888,8 @@
 
 	type = get_channel_type(&cgdev->cdev[0]->id);
 	
-	snprintf(read_id, DEVICE_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id);
-	snprintf(write_id, DEVICE_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id);
+	snprintf(read_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id);
+	snprintf(write_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id);
 
 	if (add_channel(cgdev->cdev[0], type))
 		return -ENOMEM;
drivers/s390/net/cu3088.c +1 -2
diff -urN linux-2.6/drivers/s390/net/cu3088.c linux-2.6-s390/drivers/s390/net/cu3088.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cu3088.c,v 1.26 2003/01/17 13:46:13 cohuck Exp $
+ * $Id: cu3088.c,v 1.30 2003/08/28 11:14:11 cohuck Exp $
  *
  * CTC / LCS ccw_device driver
  *
@@ -56,7 +56,6 @@
 static struct ccw_driver cu3088_driver;
 
 struct device cu3088_root_dev = {
-	.name   = "CU3088 Devices",
 	.bus_id = "cu3088",
 };
 
drivers/s390/net/iucv.c +5 -4
diff -urN linux-2.6/drivers/s390/net/iucv.c linux-2.6-s390/drivers/s390/net/iucv.c
@@ -1,5 +1,5 @@
 /* 
- * $Id: iucv.c,v 1.11 2003/04/15 16:45:37 aberg Exp $
+ * $Id: iucv.c,v 1.12 2003/07/31 15:11:13 cohuck Exp $
  *
  * IUCV network driver
  *
@@ -29,11 +29,12 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.11 $
+ * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.12 $
  *
  */
 
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/config.h>
 
 #include <linux/spinlock.h>
@@ -283,7 +284,7 @@
 #ifdef DEBUG
 static int debuglevel = 0;
 
-MODULE_PARM(debuglevel, "i");
+module_param(debuglevel, int, 0);
 MODULE_PARM_DESC(debuglevel,
  "Specifies the debug level (0=off ... 3=all)");
 
@@ -332,7 +333,7 @@
 static void
 iucv_banner(void)
 {
-	char vbuf[] = "$Revision: 1.11 $";
+	char vbuf[] = "$Revision: 1.12 $";
 	char *version = vbuf;
 
 	if ((version = strchr(version, ':'))) {
drivers/s390/net/lcs.c +21 -4
diff -urN linux-2.6/drivers/s390/net/lcs.c linux-2.6-s390/drivers/s390/net/lcs.c
@@ -11,7 +11,7 @@
  *			  Frank Pavlic ([email protected]) and
  *		 	  Martin Schwidefsky <[email protected]>
  *
- *    $Revision: 1.53 $	 $Date: 2003/06/17 11:36:45 $
+ *    $Revision: 1.55 $	 $Date: 2003/08/28 11:14:11 $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@
 /**
  * initialization string for output
  */
-#define VERSION_LCS_C  "$Revision: 1.53 $"
+#define VERSION_LCS_C  "$Revision: 1.55 $"
 
 static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")";
 
@@ -1675,6 +1675,20 @@
 
 static DEVICE_ATTR(portno, 0644, lcs_portno_show, lcs_portno_store);
 
+static ssize_t
+lcs_type_show(struct device *dev, char *buf)
+{
+	struct ccwgroup_device *cgdev;
+
+	cgdev = to_ccwgroupdev(dev);
+	if (!cgdev)
+		return -ENODEV;
+
+	return sprintf(buf, "%s\n", cu3088_type[cgdev->cdev[0]->id.driver_info]);
+}
+
+static DEVICE_ATTR(type, 0444, lcs_type_show, NULL);
+
 /**
  * lcs_probe_device is called on establishing a new ccwgroup_device.
  */
@@ -1695,15 +1709,16 @@
                 return -ENOMEM;
         }
 	ret = device_create_file(&ccwgdev->dev, &dev_attr_portno);
+	if (!ret)
+		ret = device_create_file(&ccwgdev->dev, &dev_attr_type);
 	if (ret) {
                 PRINT_ERR("Creating attributes failed");
+		device_remove_file(&ccwgdev->dev, &dev_attr_portno);
 		lcs_free_card(card);
 		put_device(&ccwgdev->dev);
 		return ret;
         }
 	ccwgdev->dev.driver_data = card;
-	snprintf(ccwgdev->dev.name, DEVICE_NAME_SIZE, "%s",
-		 cu3088_type[ccwgdev->cdev[0]->id.driver_info]);
 	ccwgdev->cdev[0]->dev.driver_data = card;
 	ccwgdev->cdev[0]->handler = lcs_irq;
 	ccwgdev->cdev[1]->dev.driver_data = card;
@@ -1826,6 +1841,8 @@
 	card = (struct lcs_card *)ccwgdev->dev.driver_data;
 	if (!card)
 		return 0;
+	device_remove_file(&ccwgdev->dev, &dev_attr_type);
+	device_remove_file(&ccwgdev->dev, &dev_attr_portno);
 	lcs_cleanup_card(card);
 	lcs_free_card(card);
 	put_device(&ccwgdev->dev);
drivers/s390/net/netiucv.c +15 -5
diff -urN linux-2.6/drivers/s390/net/netiucv.c linux-2.6-s390/drivers/s390/net/netiucv.c
@@ -1,5 +1,5 @@
 /*
- * $Id: netiucv.c,v 1.20 2003/05/27 11:34:24 mschwide Exp $
+ * $Id: netiucv.c,v 1.22 2003/08/28 16:22:40 mschwide Exp $
  *
  * IUCV network driver
  *
@@ -30,7 +30,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: IUCV network driver $Revision: 1.20 $
+ * RELEASE-TAG: IUCV network driver $Revision: 1.22 $
  *
  */
 
@@ -128,7 +128,6 @@
 };	
 
 static struct device iucv_root = {
-	.name   = "IUCV",
 	.bus_id = "iucv",
 };
 
@@ -1255,6 +1254,16 @@
 #define CTRL_BUFSIZE 40
 
 static ssize_t
+user_show (struct device *dev, char *buf)
+{
+	struct netiucv_priv *priv = dev->driver_data;
+
+	return sprintf(buf, "%s\n", netiucv_printname(priv->conn->userid));
+}
+
+static DEVICE_ATTR(user, 0444, user_show, NULL);
+
+static ssize_t
 buffer_show (struct device *dev, char *buf)
 {
 	struct netiucv_priv *priv = dev->driver_data;
@@ -1441,6 +1450,7 @@
 	int ret = 0;
 
 	if ((ret = device_create_file(dev, &dev_attr_buffer)) ||
+	    (ret = device_create_file(dev, &dev_attr_user)) ||
 	    (ret = device_create_file(dev, &dev_attr_device_fsm_state)) ||
 	    (ret = device_create_file(dev, &dev_attr_connection_fsm_state)) ||
 	    (ret = device_create_file(dev, &dev_attr_max_tx_buffer_used)) ||
@@ -1456,6 +1466,7 @@
 		device_remove_file(dev, &dev_attr_max_tx_buffer_used);
 		device_remove_file(dev, &dev_attr_connection_fsm_state);
 		device_remove_file(dev, &dev_attr_device_fsm_state);
+		device_remove_file(dev, &dev_attr_user);
 		device_remove_file(dev, &dev_attr_buffer);
 	}
 	return ret;
@@ -1469,7 +1480,6 @@
 	int ret;
 	char *str = "netiucv";
 
-	snprintf(dev->name, DEVICE_NAME_SIZE, "%s", priv->conn->userid);
 	snprintf(dev->bus_id, BUS_ID_SIZE, "%s%x", str, ifno);
 	dev->bus = &iucv_bus;
 	dev->parent = &iucv_root;
@@ -1717,7 +1727,7 @@
 static void
 netiucv_banner(void)
 {
-	char vbuf[] = "$Revision: 1.20 $";
+	char vbuf[] = "$Revision: 1.22 $";
 	char *version = vbuf;
 
 	if ((version = strchr(version, ':'))) {
drivers/s390/net/qeth.c +206 -331

954 lines not on this page · raw message

drivers/s390/net/qeth.h +1 -45

136 lines not on this page · raw message

#1 lore raw

drivers/s390/net/qeth.c line 8488

Quoted 5 lines · Martin Schwidefsky
drivers/s390/net/qeth.c +4 -1
-	spin_lock_init(&card->wait_q_lock);
+	/* setup net_device stuff */
+	card->dev->priv = card;
+
+	strncpy(card->dev->name, card->dev_name, IFNAMSIZ);

what's this about? Why avoid the net stack's dev->name assignment?

drivers/s390/net/qeth.c line 8516

Quoted 4 lines
drivers/s390/net/qeth.c +4 -0
+	QETH_DBF_TEXT3(0, trace, "alloccrd");
+	card = (struct qeth_card *) vmalloc(sizeof (struct qeth_card));
+	if (!card)
+		return NULL;

Is the card's private info really so large that you need vmalloc() ?

Most of the patch looks ok to me, except for these minor niggles.

Jeff