diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-03-20 15:35:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-21 22:19:12 -0400 |
commit | 788dee0a954745a182f9341539e5e0fe874b48fc (patch) | |
tree | 68e02cf2ca9f1e275594cd9d79583afe25f98275 | |
parent | 6fb70fd1b57707a5c7b9fb167b7790b2cba13f04 (diff) |
atm: convert mpc device to using netdev_ops
This converts the mpc device to using new netdevice_ops.
Compile tested only, needs more than usual review since
device was swaping pointers around etc.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/atm/mpc.c | 32 | ||||
-rw-r--r-- | net/atm/mpc.h | 5 |
2 files changed, 18 insertions, 19 deletions
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 039d5cc72c3d..e5bf11453a18 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -286,33 +286,32 @@ static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) | |||
286 | { | 286 | { |
287 | 287 | ||
288 | dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); | 288 | dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); |
289 | if (dev->hard_start_xmit == NULL) { | 289 | if (!dev->netdev_ops) |
290 | printk("mpoa: (%s) start_mpc: dev->hard_start_xmit == NULL, not starting\n", | 290 | printk("mpoa: (%s) start_mpc not starting\n", dev->name); |
291 | dev->name); | 291 | else { |
292 | return; | 292 | mpc->old_ops = dev->netdev_ops; |
293 | mpc->new_ops = *mpc->old_ops; | ||
294 | mpc->new_ops.ndo_start_xmit = mpc_send_packet; | ||
295 | dev->netdev_ops = &mpc->new_ops; | ||
293 | } | 296 | } |
294 | mpc->old_hard_start_xmit = dev->hard_start_xmit; | ||
295 | dev->hard_start_xmit = mpc_send_packet; | ||
296 | |||
297 | return; | ||
298 | } | 297 | } |
299 | 298 | ||
300 | static void stop_mpc(struct mpoa_client *mpc) | 299 | static void stop_mpc(struct mpoa_client *mpc) |
301 | { | 300 | { |
302 | 301 | struct net_device *dev = mpc->dev; | |
303 | dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name); | 302 | dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name); |
304 | 303 | ||
305 | /* Lets not nullify lec device's dev->hard_start_xmit */ | 304 | /* Lets not nullify lec device's dev->hard_start_xmit */ |
306 | if (mpc->dev->hard_start_xmit != mpc_send_packet) { | 305 | if (dev->netdev_ops != &mpc->new_ops) { |
307 | dprintk(" mpc already stopped, not fatal\n"); | 306 | dprintk(" mpc already stopped, not fatal\n"); |
308 | return; | 307 | return; |
309 | } | 308 | } |
310 | dprintk("\n"); | 309 | dprintk("\n"); |
311 | mpc->dev->hard_start_xmit = mpc->old_hard_start_xmit; | ||
312 | mpc->old_hard_start_xmit = NULL; | ||
313 | /* close_shortcuts(mpc); ??? FIXME */ | ||
314 | 310 | ||
315 | return; | 311 | dev->netdev_ops = mpc->old_ops; |
312 | mpc->old_ops = NULL; | ||
313 | |||
314 | /* close_shortcuts(mpc); ??? FIXME */ | ||
316 | } | 315 | } |
317 | 316 | ||
318 | static const char *mpoa_device_type_string(char type) __attribute__ ((unused)); | 317 | static const char *mpoa_device_type_string(char type) __attribute__ ((unused)); |
@@ -531,7 +530,6 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) | |||
531 | */ | 530 | */ |
532 | static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev) | 531 | static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev) |
533 | { | 532 | { |
534 | int retval; | ||
535 | struct mpoa_client *mpc; | 533 | struct mpoa_client *mpc; |
536 | struct ethhdr *eth; | 534 | struct ethhdr *eth; |
537 | int i = 0; | 535 | int i = 0; |
@@ -561,9 +559,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
561 | } | 559 | } |
562 | 560 | ||
563 | non_ip: | 561 | non_ip: |
564 | retval = mpc->old_hard_start_xmit(skb,dev); | 562 | return mpc->old_ops->ndo_start_xmit(skb,dev); |
565 | |||
566 | return retval; | ||
567 | } | 563 | } |
568 | 564 | ||
569 | static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | 565 | static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) |
diff --git a/net/atm/mpc.h b/net/atm/mpc.h index 24c386c35f57..0919a88bbc70 100644 --- a/net/atm/mpc.h +++ b/net/atm/mpc.h | |||
@@ -15,7 +15,7 @@ struct mpoa_client { | |||
15 | struct mpoa_client *next; | 15 | struct mpoa_client *next; |
16 | struct net_device *dev; /* lec in question */ | 16 | struct net_device *dev; /* lec in question */ |
17 | int dev_num; /* e.g. 2 for lec2 */ | 17 | int dev_num; /* e.g. 2 for lec2 */ |
18 | int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev); | 18 | |
19 | struct atm_vcc *mpoad_vcc; /* control channel to mpoad */ | 19 | struct atm_vcc *mpoad_vcc; /* control channel to mpoad */ |
20 | uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */ | 20 | uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */ |
21 | uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */ | 21 | uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */ |
@@ -31,6 +31,9 @@ struct mpoa_client { | |||
31 | uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */ | 31 | uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */ |
32 | int number_of_mps_macs; /* number of the above MAC addresses */ | 32 | int number_of_mps_macs; /* number of the above MAC addresses */ |
33 | struct mpc_parameters parameters; /* parameters for this client */ | 33 | struct mpc_parameters parameters; /* parameters for this client */ |
34 | |||
35 | const struct net_device_ops *old_ops; | ||
36 | struct net_device_ops new_ops; | ||
34 | }; | 37 | }; |
35 | 38 | ||
36 | 39 | ||