* [patch 0/1] s390: ctc patch for 2.6.24
@ 2007-11-29 16:36 Ursula Braun
2007-11-29 16:36 ` [patch 1/1] ctc: make use of alloc_netdev() Ursula Braun
0 siblings, 1 reply; 5+ messages in thread
From: Ursula Braun @ 2007-11-29 16:36 UTC (permalink / raw)
To: jgarzik, netdev, linux-s390
--
The following patch is intended for 2.6.24 and repairs the
ctc driver by introducing alloc_netdev().
^ permalink raw reply [flat|nested] 5+ messages in thread
* [patch 1/1] ctc: make use of alloc_netdev()
2007-11-29 16:36 [patch 0/1] s390: ctc patch for 2.6.24 Ursula Braun
@ 2007-11-29 16:36 ` Ursula Braun
2007-11-29 17:12 ` Stephen Hemminger
2007-12-01 21:33 ` Jeff Garzik
0 siblings, 2 replies; 5+ messages in thread
From: Ursula Braun @ 2007-11-29 16:36 UTC (permalink / raw)
To: jgarzik, netdev, linux-s390; +Cc: Peter Tiedemann
[-- Attachment #1: ctc.diff --]
[-- Type: text/plain, Size: 2861 bytes --]
From: Peter Tiedemann <ptiedem@de.ibm.com>
Currently ctc-device initialization is broken (kernel bug in
ctc_new_device).
The new network namespace code reveals a deficiency of the
ctc driver. It should make use of alloc_netdev() as described
in Documentation/networking/netdevices.txt.
Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com>
Signed-off-by: Ursula Braun <braunu@de.ibm.com>
---
drivers/s390/net/ctcmain.c | 45 ++++++++++++++++-----------------------------
1 file changed, 16 insertions(+), 29 deletions(-)
Index: linux-2.6-uschi/drivers/s390/net/ctcmain.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/ctcmain.c
+++ linux-2.6-uschi/drivers/s390/net/ctcmain.c
@@ -2782,35 +2782,14 @@ ctc_probe_device(struct ccwgroup_device
}
/**
- * Initialize everything of the net device except the name and the
- * channel structs.
+ * Device setup function called by alloc_netdev().
+ *
+ * @param dev Device to be setup.
*/
-static struct net_device *
-ctc_init_netdevice(struct net_device * dev, int alloc_device,
- struct ctc_priv *privptr)
+void ctc_init_netdevice(struct net_device * dev)
{
- if (!privptr)
- return NULL;
-
DBF_TEXT(setup, 3, __FUNCTION__);
- if (alloc_device) {
- dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
- if (!dev)
- return NULL;
- }
-
- dev->priv = privptr;
- privptr->fsm = init_fsm("ctcdev", dev_state_names,
- dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
- dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
- if (privptr->fsm == NULL) {
- if (alloc_device)
- kfree(dev);
- return NULL;
- }
- fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
- fsm_settimer(privptr->fsm, &privptr->restart_timer);
if (dev->mtu == 0)
dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
dev->hard_start_xmit = ctc_tx;
@@ -2823,7 +2802,7 @@ ctc_init_netdevice(struct net_device * d
dev->type = ARPHRD_SLIP;
dev->tx_queue_len = 100;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
- return dev;
+ SET_MODULE_OWNER(dev);
}
@@ -2879,14 +2858,22 @@ ctc_new_device(struct ccwgroup_device *c
"ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret);
}
- dev = ctc_init_netdevice(NULL, 1, privptr);
-
+ dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice);
if (!dev) {
ctc_pr_warn("ctc_init_netdevice failed\n");
goto out;
}
+ dev->priv = privptr;
- strlcpy(dev->name, "ctc%d", IFNAMSIZ);
+ privptr->fsm = init_fsm("ctcdev", dev_state_names,
+ dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
+ dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
+ if (privptr->fsm == NULL) {
+ free_netdev(dev);
+ goto out;
+ }
+ fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
+ fsm_settimer(privptr->fsm, &privptr->restart_timer);
for (direction = READ; direction <= WRITE; direction++) {
privptr->channel[direction] =
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 1/1] ctc: make use of alloc_netdev()
2007-11-29 16:36 ` [patch 1/1] ctc: make use of alloc_netdev() Ursula Braun
@ 2007-11-29 17:12 ` Stephen Hemminger
2007-11-30 1:33 ` Peter Tiedemann
2007-12-01 21:33 ` Jeff Garzik
1 sibling, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2007-11-29 17:12 UTC (permalink / raw)
To: Ursula Braun; +Cc: jgarzik, netdev, linux-s390, Peter Tiedemann
On Thu, 29 Nov 2007 17:36:27 +0100
Ursula Braun <braunu@de.ibm.com> wrote:
> From: Peter Tiedemann <ptiedem@de.ibm.com>
>
> Currently ctc-device initialization is broken (kernel bug in
> ctc_new_device).
> The new network namespace code reveals a deficiency of the
> ctc driver. It should make use of alloc_netdev() as described
> in Documentation/networking/netdevices.txt.
>
> Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com>
> Signed-off-by: Ursula Braun <braunu@de.ibm.com>
> ---
> drivers/s390/net/ctcmain.c | 45 ++++++++++++++++-----------------------------
> 1 file changed, 16 insertions(+), 29 deletions(-)
>
> Index: linux-2.6-uschi/drivers/s390/net/ctcmain.c
> ===================================================================
> --- linux-2.6-uschi.orig/drivers/s390/net/ctcmain.c
> +++ linux-2.6-uschi/drivers/s390/net/ctcmain.c
> @@ -2782,35 +2782,14 @@ ctc_probe_device(struct ccwgroup_device
> }
>
> /**
> - * Initialize everything of the net device except the name and the
> - * channel structs.
> + * Device setup function called by alloc_netdev().
> + *
> + * @param dev Device to be setup.
> */
> -static struct net_device *
> -ctc_init_netdevice(struct net_device * dev, int alloc_device,
> - struct ctc_priv *privptr)
> +void ctc_init_netdevice(struct net_device * dev)
> {
> - if (!privptr)
> - return NULL;
> -
> DBF_TEXT(setup, 3, __FUNCTION__);
>
> - if (alloc_device) {
> - dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
> - if (!dev)
> - return NULL;
> - }
> -
> - dev->priv = privptr;
> - privptr->fsm = init_fsm("ctcdev", dev_state_names,
> - dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
> - dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
> - if (privptr->fsm == NULL) {
> - if (alloc_device)
> - kfree(dev);
> - return NULL;
> - }
> - fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
> - fsm_settimer(privptr->fsm, &privptr->restart_timer);
> if (dev->mtu == 0)
> dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
> dev->hard_start_xmit = ctc_tx;
> @@ -2823,7 +2802,7 @@ ctc_init_netdevice(struct net_device * d
> dev->type = ARPHRD_SLIP;
> dev->tx_queue_len = 100;
> dev->flags = IFF_POINTOPOINT | IFF_NOARP;
> - return dev;
> + SET_MODULE_OWNER(dev);
> }
>
>
> @@ -2879,14 +2858,22 @@ ctc_new_device(struct ccwgroup_device *c
> "ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret);
> }
>
> - dev = ctc_init_netdevice(NULL, 1, privptr);
> -
> + dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice);
> if (!dev) {
> ctc_pr_warn("ctc_init_netdevice failed\n");
> goto out;
> }
> + dev->priv = privptr;
>
Why not use standard private data area, rather than allocating
it separately?
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 1/1] ctc: make use of alloc_netdev()
2007-11-29 17:12 ` Stephen Hemminger
@ 2007-11-30 1:33 ` Peter Tiedemann
0 siblings, 0 replies; 5+ messages in thread
From: Peter Tiedemann @ 2007-11-30 1:33 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: jgarzik, linux-s390, netdev, Ursula Braun1
To maintain the area used for sysfs attribute data which may be stored
already previously.
Mit freundlichen Grüßen / Best regards / Saluti,
Peter Tiedemann
---------------------------------
phone: +49-7031-16-4172 fax: ++3159 e-mail: PTiedem@de.ibm.com
IBM Deutschland Entwicklung GmbH
Linux for eServer Development, Dept. 3303
Schoenaicher Str. 220
71032 Boeblingen, Germany
IBM Deutschland Entwicklung GmbH, Vorsitzender des Aufsichtsrats: Martin
Jetter, Geschäftsführung: Herbert Kircher
Sitz der Gesellschaft: Böblingen, Registergericht: Amtsgericht Stuttgart,
HRB 243294
Stephen Hemminger
<shemminger@linux
-foundation.org> To
Ursula Braun1/Germany/IBM@IBMDE
29.11.2007 18:12 cc
jgarzik@pobox.com,
netdev@vger.kernel.org,
linux-s390@vger.kernel.org, Peter
Tiedemann/Germany/IBM@IBMDE
Subject
Re: [patch 1/1] ctc: make use of
alloc_netdev()
On Thu, 29 Nov 2007 17:36:27 +0100
Ursula Braun <braunu@de.ibm.com> wrote:
> From: Peter Tiedemann <ptiedem@de.ibm.com>
>
> Currently ctc-device initialization is broken (kernel bug in
> ctc_new_device).
> The new network namespace code reveals a deficiency of the
> ctc driver. It should make use of alloc_netdev() as described
> in Documentation/networking/netdevices.txt.
>
> Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com>
> Signed-off-by: Ursula Braun <braunu@de.ibm.com>
> ---
> drivers/s390/net/ctcmain.c | 45
++++++++++++++++-----------------------------
> 1 file changed, 16 insertions(+), 29 deletions(-)
>
> Index: linux-2.6-uschi/drivers/s390/net/ctcmain.c
> ===================================================================
> --- linux-2.6-uschi.orig/drivers/s390/net/ctcmain.c
> +++ linux-2.6-uschi/drivers/s390/net/ctcmain.c
> @@ -2782,35 +2782,14 @@ ctc_probe_device(struct ccwgroup_device
> }
>
> /**
> - * Initialize everything of the net device except the name and the
> - * channel structs.
> + * Device setup function called by alloc_netdev().
> + *
> + * @param dev Device to be setup.
> */
> -static struct net_device *
> -ctc_init_netdevice(struct net_device * dev, int alloc_device,
> - struct ctc_priv *privptr)
> +void ctc_init_netdevice(struct net_device * dev)
> {
> - if (!privptr)
> - return NULL;
> -
> DBF_TEXT(setup, 3, __FUNCTION__);
>
> - if (alloc_device) {
> - dev = kzalloc(sizeof(struct net_device),
GFP_KERNEL);
> - if (!dev)
> - return NULL;
> - }
> -
> - dev->priv = privptr;
> - privptr->fsm = init_fsm("ctcdev", dev_state_names,
> - dev_event_names,
CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
> - dev_fsm, DEV_FSM_LEN,
GFP_KERNEL);
> - if (privptr->fsm == NULL) {
> - if (alloc_device)
> - kfree(dev);
> - return NULL;
> - }
> - fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
> - fsm_settimer(privptr->fsm, &privptr->restart_timer);
> if (dev->mtu == 0)
> dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH
- 2;
> dev->hard_start_xmit = ctc_tx;
> @@ -2823,7 +2802,7 @@ ctc_init_netdevice(struct net_device * d
> dev->type = ARPHRD_SLIP;
> dev->tx_queue_len = 100;
> dev->flags = IFF_POINTOPOINT | IFF_NOARP;
> - return dev;
> + SET_MODULE_OWNER(dev);
> }
>
>
> @@ -2879,14 +2858,22 @@ ctc_new_device(struct ccwgroup_device *c
> "ccw_device_set_online (cdev[1])
failed with ret = %d\n", ret);
> }
>
> - dev = ctc_init_netdevice(NULL, 1, privptr);
> -
> + dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice);
> if (!dev) {
> ctc_pr_warn("ctc_init_netdevice failed\n");
> goto out;
> }
> + dev->priv = privptr;
>
Why not use standard private data area, rather than allocating
it separately?
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 1/1] ctc: make use of alloc_netdev()
2007-11-29 16:36 ` [patch 1/1] ctc: make use of alloc_netdev() Ursula Braun
2007-11-29 17:12 ` Stephen Hemminger
@ 2007-12-01 21:33 ` Jeff Garzik
1 sibling, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2007-12-01 21:33 UTC (permalink / raw)
To: Ursula Braun; +Cc: netdev, linux-s390, Peter Tiedemann
applied
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-12-01 21:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-29 16:36 [patch 0/1] s390: ctc patch for 2.6.24 Ursula Braun
2007-11-29 16:36 ` [patch 1/1] ctc: make use of alloc_netdev() Ursula Braun
2007-11-29 17:12 ` Stephen Hemminger
2007-11-30 1:33 ` Peter Tiedemann
2007-12-01 21:33 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).