Skip to contentSkip to conversation

s390: net drivers convert to net_device_ops

PATCH Superseded [email protected] 4 participants 8 messages Jan 9, 2009

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

cover s390: net drivers convert to net_device_ops

Hi Dave,

here are the remaining net_device_ops patches for s390 net drivers

lcs: convert to net_device_ops
ctcm: convert to net_device_ops
netiucv: convert to net_device_ops
claw: convert to net_device_ops

Thanks,
Frank

#1 lore raw

PATCH 1/4 lcs: convert to net_device_ops

From: Frank Blaschka <[email protected]>

lcs convert to net_device_ops.

---
 drivers/s390/net/lcs.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/s390/net/lcs.c +8 -5
Index: git_linus/drivers/s390/net/lcs.c
===================================================================
@@ -2097,6 +2097,12 @@ lcs_register_netdev(struct ccwgroup_devi
 /**
  * lcs_new_device will be called by setting the group device online.
  */
+static struct net_device_ops lcs_netdev_ops = {
+	.ndo_open		= lcs_open_device,
+	.ndo_stop		= lcs_stop_device,
+	.ndo_get_stats		= lcs_getstats,
+	.ndo_start_xmit		= lcs_start_xmit,
+};
 
 static int
 lcs_new_device(struct ccwgroup_device *ccwgdev)
@@ -2164,14 +2170,11 @@ lcs_new_device(struct ccwgroup_device *c
 		goto out;
 	card->dev = dev;
 	card->dev->ml_priv = card;
-	card->dev->open = lcs_open_device;
-	card->dev->stop = lcs_stop_device;
-	card->dev->hard_start_xmit = lcs_start_xmit;
-	card->dev->get_stats = lcs_getstats;
+	card->dev->netdev_ops = &lcs_netdev_ops;
 	memcpy(card->dev->dev_addr, card->mac, LCS_MAC_LENGTH);
 #ifdef CONFIG_IP_MULTICAST
 	if (!lcs_check_multicast_support(card))
-		card->dev->set_multicast_list = lcs_set_multicast_list;
+		lcs_netdev_ops.ndo_set_multicast_list = lcs_set_multicast_list;
 #endif
 netdev_out:
 	lcs_set_allowed_threads(card,0xffffffff);
#2 lore raw

Re: [patch 1/4] lcs: convert to net_device_ops

drivers/s390/net/lcs.c lcs_new_device(struct ccwgroup_device *c · line 2177

Quoted 4 lines · On Fri, Jan 09, 2009 at 10:01:57AM +0100, [email protected] wrote:

#ifdef CONFIG_IP_MULTICAST

drivers/s390/net/lcs.c +1 -1
 	if (!lcs_check_multicast_support(card))
-		card->dev->set_multicast_list = lcs_set_multicast_list;
+		lcs_netdev_ops.ndo_set_multicast_list = lcs_set_multicast_list;

This looks wrong. lcs_netdev_ops is static but this code used to set it up per card.

Bastian

Signature · 2 lines
History tends to exaggerate.
		-- Col. Green, "The Savage Curtain", stardate 5906.4
#3 lore raw

Re: [patch 1/4] lcs: convert to net_device_ops

good catch, thanks a lot. I will rework the complete patch set because there is the same issue with ctcm and qeth_l3.

Frank

Quoted 11 lines · On Fri, Jan 09, 2009 at 10:01:57AM +0100, [email protected] wrote:

drivers/s390/net/lcs.c lcs_new_device(struct ccwgroup_device *c · line 2177

Quoted 4 lines

#ifdef CONFIG_IP_MULTICAST

drivers/s390/net/lcs.c +1 -1
 	if (!lcs_check_multicast_support(card))
-		card->dev->set_multicast_list = lcs_set_multicast_list;
+		lcs_netdev_ops.ndo_set_multicast_list = lcs_set_multicast_list;

This looks wrong. lcs_netdev_ops is static but this code used to set it up per card.

Bastian

#4 lore raw

Re: [patch 1/4] lcs: convert to net_device_ops

In reply to [email protected]
Quoted 14 lines · On Fri, 09 Jan 2009 10:01:57 +0100 [email protected] wrote:

From: Frank Blaschka <[email protected]>

lcs convert to net_device_ops.

---
 drivers/s390/net/lcs.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Index: git_linus/drivers/s390/net/lcs.c
===================================================================

drivers/s390/net/lcs.c lcs_register_netdev(struct ccwgroup_devi · line 2100

Quoted 4 lines
drivers/s390/net/lcs.c +1 -0
@@ -2097,6 +2097,12 @@ lcs_register_netdev(struct ccwgroup_devi
 /**
  * lcs_new_device will be called by setting the group device online.
  */
+static struct net_device_ops lcs_netdev_ops = {

should be const (if it was you would catch your other problem

#5 lore raw

PATCH 2/4 ctcm: convert to net_device_ops

In reply to [email protected]

From: Frank Blaschka <[email protected]>

ctcm convert to net_device_ops.

---
 drivers/s390/net/ctcm_main.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/s390/net/ctcm_main.c +10 -6
Index: git_linus/drivers/s390/net/ctcm_main.c
===================================================================
@@ -1099,15 +1099,19 @@ static void ctcm_free_netdevice(struct n
 
 struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv);
 
+static struct net_device_ops ctcm_netdev_ops = {
+	.ndo_open		= ctcm_open,
+	.ndo_stop		= ctcm_close,
+	.ndo_get_stats		= ctcm_stats,
+	.ndo_change_mtu	   	= ctcm_change_mtu,
+};
+
 void static ctcm_dev_setup(struct net_device *dev)
 {
-	dev->open = ctcm_open;
-	dev->stop = ctcm_close;
-	dev->get_stats = ctcm_stats;
-	dev->change_mtu = ctcm_change_mtu;
 	dev->type = ARPHRD_SLIP;
 	dev->tx_queue_len = 100;
 	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
+	dev->netdev_ops = &ctcm_netdev_ops;
 }
 
 /*
@@ -1157,12 +1161,12 @@ static struct net_device *ctcm_init_netd
 		dev->mtu = MPC_BUFSIZE_DEFAULT -
 				TH_HEADER_LENGTH - PDU_HEADER_LENGTH;
 
-		dev->hard_start_xmit = ctcmpc_tx;
+		ctcm_netdev_ops.ndo_start_xmit = ctcmpc_tx;
 		dev->hard_header_len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH;
 		priv->buffer_size = MPC_BUFSIZE_DEFAULT;
 	} else {
 		dev->mtu = CTCM_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
-		dev->hard_start_xmit = ctcm_tx;
+		ctcm_netdev_ops.ndo_start_xmit = ctcm_tx;
 		dev->hard_header_len = LL_HEADER_LENGTH + 2;
 	}
 
#6 lore raw

PATCH 3/4 netiucv: convert to net_device_ops

In reply to [email protected]

From: Frank Blaschka <[email protected]>

netiucv convert to net_device_ops.

---
 drivers/s390/net/netiucv.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/s390/net/netiucv.c +9 -5
Index: git_linus/drivers/s390/net/netiucv.c
===================================================================
@@ -1876,20 +1876,24 @@ static void netiucv_free_netdevice(struc
 /**
  * Initialize a net device. (Called from kernel in alloc_netdev())
  */
+static struct net_device_ops netiucv_netdev_ops = {
+	.ndo_open		= netiucv_open,
+	.ndo_stop		= netiucv_close,
+	.ndo_get_stats		= netiucv_stats,
+	.ndo_start_xmit		= netiucv_tx,
+	.ndo_change_mtu	   	= netiucv_change_mtu,
+};
+
 static void netiucv_setup_netdevice(struct net_device *dev)
 {
 	dev->mtu	         = NETIUCV_MTU_DEFAULT;
-	dev->hard_start_xmit     = netiucv_tx;
-	dev->open	         = netiucv_open;
-	dev->stop	         = netiucv_close;
-	dev->get_stats	         = netiucv_stats;
-	dev->change_mtu          = netiucv_change_mtu;
 	dev->destructor          = netiucv_free_netdevice;
 	dev->hard_header_len     = NETIUCV_HDRLEN;
 	dev->addr_len            = 0;
 	dev->type                = ARPHRD_SLIP;
 	dev->tx_queue_len        = NETIUCV_QUEUELEN_DEFAULT;
 	dev->flags	         = IFF_POINTOPOINT | IFF_NOARP;
+	dev->netdev_ops		 = &netiucv_netdev_ops;
 }
 
 /**
#7 lore raw

PATCH 4/4 claw: convert to net_device_ops

In reply to [email protected]

From: Frank Blaschka <[email protected]>

claw convert to net_device_ops.

---
 drivers/s390/net/claw.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/s390/net/claw.c +9 -5
Index: git_linus/drivers/s390/net/claw.c
===================================================================
@@ -2816,22 +2816,26 @@ claw_free_netdevice(struct net_device * 
  * Initialize everything of the net device except the name and the
  * channel structs.
  */
+static struct net_device_ops claw_netdev_ops = {
+	.ndo_open		= claw_open,
+	.ndo_stop		= claw_release,
+	.ndo_get_stats		= claw_stats,
+	.ndo_start_xmit		= claw_tx,
+	.ndo_change_mtu		= claw_change_mtu,
+};
+
 static void
 claw_init_netdevice(struct net_device * dev)
 {
 	CLAW_DBF_TEXT(2, setup, "init_dev");
 	CLAW_DBF_TEXT_(2, setup, "%s", dev->name);
 	dev->mtu = CLAW_DEFAULT_MTU_SIZE;
-	dev->hard_start_xmit = claw_tx;
-	dev->open = claw_open;
-	dev->stop = claw_release;
-	dev->get_stats = claw_stats;
-	dev->change_mtu = claw_change_mtu;
 	dev->hard_header_len = 0;
 	dev->addr_len = 0;
 	dev->type = ARPHRD_SLIP;
 	dev->tx_queue_len = 1300;
 	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
+	dev->netdev_ops = &claw_netdev_ops;
 	CLAW_DBF_TEXT(2, setup, "initok");
 	return;
 }