diff options
author | Chris Leech <christopher.leech@intel.com> | 2009-08-25 16:59:35 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-10 13:07:32 -0400 |
commit | 250249898a92a1228050f40fbe3c05deb1392da8 (patch) | |
tree | 37835c6c378c1024b1f0e3a4432d63011b3f3e61 /drivers/scsi | |
parent | 014f5c3f560a336cb8ad5b9f828c85de0398e7bb (diff) |
[SCSI] fcoe: move netdev to fcoe_interface
The network interface needs to be shared between all NPIV VN_Ports, therefor
it should be tracked in the fcoe_interface and not for each SCSI host in
fcoe_port.
Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 61 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe.h | 9 |
2 files changed, 38 insertions, 32 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 0ae54b2bce34..44c963c8bc7d 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -165,7 +165,7 @@ static int fcoe_fip_recv(struct sk_buff *skb, struct net_device *dev, | |||
165 | */ | 165 | */ |
166 | static void fcoe_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb) | 166 | static void fcoe_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb) |
167 | { | 167 | { |
168 | skb->dev = fcoe_from_ctlr(fip)->netdev; | 168 | skb->dev = fcoe_from_ctlr(fip)->fcoe->netdev; |
169 | dev_queue_xmit(skb); | 169 | dev_queue_xmit(skb); |
170 | } | 170 | } |
171 | 171 | ||
@@ -180,13 +180,16 @@ static void fcoe_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb) | |||
180 | */ | 180 | */ |
181 | static void fcoe_update_src_mac(struct fcoe_ctlr *fip, u8 *old, u8 *new) | 181 | static void fcoe_update_src_mac(struct fcoe_ctlr *fip, u8 *old, u8 *new) |
182 | { | 182 | { |
183 | struct fcoe_interface *fcoe; | ||
183 | struct fcoe_port *port; | 184 | struct fcoe_port *port; |
184 | 185 | ||
185 | port = fcoe_from_ctlr(fip); | 186 | port = fcoe_from_ctlr(fip); |
187 | fcoe = port->fcoe; | ||
188 | |||
186 | rtnl_lock(); | 189 | rtnl_lock(); |
187 | if (!is_zero_ether_addr(old)) | 190 | if (!is_zero_ether_addr(old)) |
188 | dev_unicast_delete(port->netdev, old); | 191 | dev_unicast_delete(fcoe->netdev, old); |
189 | dev_unicast_add(port->netdev, new); | 192 | dev_unicast_add(fcoe->netdev, new); |
190 | rtnl_unlock(); | 193 | rtnl_unlock(); |
191 | } | 194 | } |
192 | 195 | ||
@@ -229,6 +232,7 @@ static int fcoe_lport_config(struct fc_lport *lp) | |||
229 | void fcoe_netdev_cleanup(struct fcoe_port *port) | 232 | void fcoe_netdev_cleanup(struct fcoe_port *port) |
230 | { | 233 | { |
231 | u8 flogi_maddr[ETH_ALEN]; | 234 | u8 flogi_maddr[ETH_ALEN]; |
235 | struct fcoe_interface *fcoe = port->fcoe; | ||
232 | 236 | ||
233 | /* Don't listen for Ethernet packets anymore */ | 237 | /* Don't listen for Ethernet packets anymore */ |
234 | dev_remove_pack(&port->fcoe_packet_type); | 238 | dev_remove_pack(&port->fcoe_packet_type); |
@@ -237,12 +241,12 @@ void fcoe_netdev_cleanup(struct fcoe_port *port) | |||
237 | /* Delete secondary MAC addresses */ | 241 | /* Delete secondary MAC addresses */ |
238 | rtnl_lock(); | 242 | rtnl_lock(); |
239 | memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); | 243 | memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); |
240 | dev_unicast_delete(port->netdev, flogi_maddr); | 244 | dev_unicast_delete(fcoe->netdev, flogi_maddr); |
241 | if (!is_zero_ether_addr(port->ctlr.data_src_addr)) | 245 | if (!is_zero_ether_addr(port->ctlr.data_src_addr)) |
242 | dev_unicast_delete(port->netdev, port->ctlr.data_src_addr); | 246 | dev_unicast_delete(fcoe->netdev, port->ctlr.data_src_addr); |
243 | if (port->ctlr.spma) | 247 | if (port->ctlr.spma) |
244 | dev_unicast_delete(port->netdev, port->ctlr.ctl_src_addr); | 248 | dev_unicast_delete(fcoe->netdev, port->ctlr.ctl_src_addr); |
245 | dev_mc_delete(port->netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); | 249 | dev_mc_delete(fcoe->netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); |
246 | rtnl_unlock(); | 250 | rtnl_unlock(); |
247 | } | 251 | } |
248 | 252 | ||
@@ -271,14 +275,16 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev) | |||
271 | { | 275 | { |
272 | u32 mfs; | 276 | u32 mfs; |
273 | u64 wwnn, wwpn; | 277 | u64 wwnn, wwpn; |
278 | struct fcoe_interface *fcoe; | ||
274 | struct fcoe_port *port; | 279 | struct fcoe_port *port; |
275 | u8 flogi_maddr[ETH_ALEN]; | 280 | u8 flogi_maddr[ETH_ALEN]; |
276 | struct netdev_hw_addr *ha; | 281 | struct netdev_hw_addr *ha; |
277 | 282 | ||
278 | /* Setup lport private data to point to fcoe softc */ | 283 | /* Setup lport private data to point to fcoe softc */ |
279 | port = lport_priv(lp); | 284 | port = lport_priv(lp); |
285 | fcoe = port->fcoe; | ||
280 | port->ctlr.lp = lp; | 286 | port->ctlr.lp = lp; |
281 | port->netdev = netdev; | 287 | fcoe->netdev = netdev; |
282 | 288 | ||
283 | /* Do not support for bonding device */ | 289 | /* Do not support for bonding device */ |
284 | if ((netdev->priv_flags & IFF_MASTER_ALB) || | 290 | if ((netdev->priv_flags & IFF_MASTER_ALB) || |
@@ -434,9 +440,10 @@ bool fcoe_oem_match(struct fc_frame *fp) | |||
434 | */ | 440 | */ |
435 | static inline int fcoe_em_config(struct fc_lport *lp) | 441 | static inline int fcoe_em_config(struct fc_lport *lp) |
436 | { | 442 | { |
437 | struct fcoe_interface *fcoe; | ||
438 | struct fcoe_port *port = lport_priv(lp); | 443 | struct fcoe_port *port = lport_priv(lp); |
439 | struct fcoe_port *oldfc = NULL; | 444 | struct fcoe_port *oldport = NULL; |
445 | struct fcoe_interface *fcoe = port->fcoe; | ||
446 | struct fcoe_interface *oldfcoe = NULL; | ||
440 | struct net_device *old_real_dev, *cur_real_dev; | 447 | struct net_device *old_real_dev, *cur_real_dev; |
441 | u16 min_xid = FCOE_MIN_XID; | 448 | u16 min_xid = FCOE_MIN_XID; |
442 | u16 max_xid = FCOE_MAX_XID; | 449 | u16 max_xid = FCOE_MAX_XID; |
@@ -454,20 +461,20 @@ static inline int fcoe_em_config(struct fc_lport *lp) | |||
454 | * Reuse existing offload em instance in case | 461 | * Reuse existing offload em instance in case |
455 | * it is already allocated on real eth device | 462 | * it is already allocated on real eth device |
456 | */ | 463 | */ |
457 | if (port->netdev->priv_flags & IFF_802_1Q_VLAN) | 464 | if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN) |
458 | cur_real_dev = vlan_dev_real_dev(port->netdev); | 465 | cur_real_dev = vlan_dev_real_dev(fcoe->netdev); |
459 | else | 466 | else |
460 | cur_real_dev = port->netdev; | 467 | cur_real_dev = fcoe->netdev; |
461 | 468 | ||
462 | list_for_each_entry(fcoe, &fcoe_hostlist, list) { | 469 | list_for_each_entry(oldfcoe, &fcoe_hostlist, list) { |
463 | oldfc = fcoe->priv; | 470 | oldport = oldfcoe->priv; |
464 | if (oldfc->netdev->priv_flags & IFF_802_1Q_VLAN) | 471 | if (oldfcoe->netdev->priv_flags & IFF_802_1Q_VLAN) |
465 | old_real_dev = vlan_dev_real_dev(oldfc->netdev); | 472 | old_real_dev = vlan_dev_real_dev(oldfcoe->netdev); |
466 | else | 473 | else |
467 | old_real_dev = oldfc->netdev; | 474 | old_real_dev = oldfcoe->netdev; |
468 | 475 | ||
469 | if (cur_real_dev == old_real_dev) { | 476 | if (cur_real_dev == old_real_dev) { |
470 | port->oem = oldfc->oem; | 477 | port->oem = oldport->oem; |
471 | break; | 478 | break; |
472 | } | 479 | } |
473 | } | 480 | } |
@@ -476,7 +483,7 @@ static inline int fcoe_em_config(struct fc_lport *lp) | |||
476 | if (!fc_exch_mgr_add(lp, port->oem, fcoe_oem_match)) { | 483 | if (!fc_exch_mgr_add(lp, port->oem, fcoe_oem_match)) { |
477 | printk(KERN_ERR "fcoe_em_config: failed to add " | 484 | printk(KERN_ERR "fcoe_em_config: failed to add " |
478 | "offload em:%p on interface:%s\n", | 485 | "offload em:%p on interface:%s\n", |
479 | port->oem, port->netdev->name); | 486 | port->oem, fcoe->netdev->name); |
480 | return -ENOMEM; | 487 | return -ENOMEM; |
481 | } | 488 | } |
482 | } else { | 489 | } else { |
@@ -486,7 +493,7 @@ static inline int fcoe_em_config(struct fc_lport *lp) | |||
486 | if (!port->oem) { | 493 | if (!port->oem) { |
487 | printk(KERN_ERR "fcoe_em_config: failed to allocate " | 494 | printk(KERN_ERR "fcoe_em_config: failed to allocate " |
488 | "em for offload exches on interface:%s\n", | 495 | "em for offload exches on interface:%s\n", |
489 | port->netdev->name); | 496 | fcoe->netdev->name); |
490 | return -ENOMEM; | 497 | return -ENOMEM; |
491 | } | 498 | } |
492 | } | 499 | } |
@@ -499,7 +506,7 @@ static inline int fcoe_em_config(struct fc_lport *lp) | |||
499 | skip_oem: | 506 | skip_oem: |
500 | if (!fc_exch_mgr_alloc(lp, FC_CLASS_3, min_xid, max_xid, NULL)) { | 507 | if (!fc_exch_mgr_alloc(lp, FC_CLASS_3, min_xid, max_xid, NULL)) { |
501 | printk(KERN_ERR "fcoe_em_config: failed to " | 508 | printk(KERN_ERR "fcoe_em_config: failed to " |
502 | "allocate em on interface %s\n", port->netdev->name); | 509 | "allocate em on interface %s\n", fcoe->netdev->name); |
503 | return -ENOMEM; | 510 | return -ENOMEM; |
504 | } | 511 | } |
505 | 512 | ||
@@ -514,7 +521,7 @@ static void fcoe_if_destroy(struct fc_lport *lport) | |||
514 | { | 521 | { |
515 | struct fcoe_port *port = lport_priv(lport); | 522 | struct fcoe_port *port = lport_priv(lport); |
516 | struct fcoe_interface *fcoe = port->fcoe; | 523 | struct fcoe_interface *fcoe = port->fcoe; |
517 | struct net_device *netdev = port->netdev; | 524 | struct net_device *netdev = fcoe->netdev; |
518 | 525 | ||
519 | FCOE_NETDEV_DBG(netdev, "Destroying interface\n"); | 526 | FCOE_NETDEV_DBG(netdev, "Destroying interface\n"); |
520 | 527 | ||
@@ -1194,7 +1201,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp) | |||
1194 | skb_reset_network_header(skb); | 1201 | skb_reset_network_header(skb); |
1195 | skb->mac_len = elen; | 1202 | skb->mac_len = elen; |
1196 | skb->protocol = htons(ETH_P_FCOE); | 1203 | skb->protocol = htons(ETH_P_FCOE); |
1197 | skb->dev = port->netdev; | 1204 | skb->dev = port->fcoe->netdev; |
1198 | 1205 | ||
1199 | /* fill up mac and fcoe headers */ | 1206 | /* fill up mac and fcoe headers */ |
1200 | eh = eth_hdr(skb); | 1207 | eh = eth_hdr(skb); |
@@ -1480,7 +1487,7 @@ static int fcoe_device_notification(struct notifier_block *notifier, | |||
1480 | read_lock(&fcoe_hostlist_lock); | 1487 | read_lock(&fcoe_hostlist_lock); |
1481 | list_for_each_entry(fcoe, &fcoe_hostlist, list) { | 1488 | list_for_each_entry(fcoe, &fcoe_hostlist, list) { |
1482 | port = fcoe->priv; | 1489 | port = fcoe->priv; |
1483 | if (port->netdev == netdev) { | 1490 | if (fcoe->netdev == netdev) { |
1484 | lp = port->ctlr.lp; | 1491 | lp = port->ctlr.lp; |
1485 | break; | 1492 | break; |
1486 | } | 1493 | } |
@@ -1709,7 +1716,7 @@ MODULE_PARM_DESC(destroy, "Destroy fcoe fcoe"); | |||
1709 | int fcoe_link_ok(struct fc_lport *lp) | 1716 | int fcoe_link_ok(struct fc_lport *lp) |
1710 | { | 1717 | { |
1711 | struct fcoe_port *port = lport_priv(lp); | 1718 | struct fcoe_port *port = lport_priv(lp); |
1712 | struct net_device *dev = port->netdev; | 1719 | struct net_device *dev = port->fcoe->netdev; |
1713 | struct ethtool_cmd ecmd = { ETHTOOL_GSET }; | 1720 | struct ethtool_cmd ecmd = { ETHTOOL_GSET }; |
1714 | 1721 | ||
1715 | if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) && | 1722 | if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) && |
@@ -1810,7 +1817,7 @@ fcoe_hostlist_lookup_port(const struct net_device *dev) | |||
1810 | struct fcoe_interface *fcoe; | 1817 | struct fcoe_interface *fcoe; |
1811 | 1818 | ||
1812 | list_for_each_entry(fcoe, &fcoe_hostlist, list) { | 1819 | list_for_each_entry(fcoe, &fcoe_hostlist, list) { |
1813 | if (fcoe->priv->netdev == dev) | 1820 | if (fcoe->netdev == dev) |
1814 | return fcoe; | 1821 | return fcoe; |
1815 | } | 1822 | } |
1816 | return NULL; | 1823 | return NULL; |
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h index 060a6dce6580..3b3886e99b48 100644 --- a/drivers/scsi/fcoe/fcoe.h +++ b/drivers/scsi/fcoe/fcoe.h | |||
@@ -82,6 +82,7 @@ struct fcoe_interface { | |||
82 | /* This will be removed once all the shared values are | 82 | /* This will be removed once all the shared values are |
83 | * moved out of fcoe_port */ | 83 | * moved out of fcoe_port */ |
84 | struct fcoe_port *priv; | 84 | struct fcoe_port *priv; |
85 | struct net_device *netdev; | ||
85 | }; | 86 | }; |
86 | 87 | ||
87 | /* | 88 | /* |
@@ -90,7 +91,6 @@ struct fcoe_interface { | |||
90 | */ | 91 | */ |
91 | struct fcoe_port { | 92 | struct fcoe_port { |
92 | struct fcoe_interface *fcoe; | 93 | struct fcoe_interface *fcoe; |
93 | struct net_device *netdev; | ||
94 | struct fc_exch_mgr *oem; /* offload exchange manger */ | 94 | struct fc_exch_mgr *oem; /* offload exchange manger */ |
95 | struct packet_type fcoe_packet_type; | 95 | struct packet_type fcoe_packet_type; |
96 | struct packet_type fip_packet_type; | 96 | struct packet_type fip_packet_type; |
@@ -100,12 +100,11 @@ struct fcoe_port { | |||
100 | struct fcoe_ctlr ctlr; | 100 | struct fcoe_ctlr ctlr; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | #define fcoe_from_ctlr(port) container_of(port, struct fcoe_port, ctlr) | 103 | #define fcoe_from_ctlr(fip) container_of(fip, struct fcoe_port, ctlr) |
104 | 104 | ||
105 | static inline struct net_device *fcoe_netdev( | 105 | static inline struct net_device *fcoe_netdev(const struct fc_lport *lp) |
106 | const struct fc_lport *lp) | ||
107 | { | 106 | { |
108 | return ((struct fcoe_port *)lport_priv(lp))->netdev; | 107 | return ((struct fcoe_port *)lport_priv(lp))->fcoe->netdev; |
109 | } | 108 | } |
110 | 109 | ||
111 | #endif /* _FCOE_H_ */ | 110 | #endif /* _FCOE_H_ */ |