aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChris Leech <christopher.leech@intel.com>2009-08-25 16:59:41 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 13:07:32 -0400
commit259ad85d8dbbcd508e3dad29a36e3e76365853b7 (patch)
tree4330e34aea6c87aa09264d1e0d548b5bcfcb8b0f /drivers/scsi
parent250249898a92a1228050f40fbe3c05deb1392da8 (diff)
[SCSI] fcoe: move packet handlers from fcoe_port to fcoe_interface
The packet handlers need to be tracked in fcoe_interface so there is only one set per net_device. When NPIV is enabled there will be multiple SCSI hosts and multiple fcoe_port structures on a single net_device. The packet handlers match by ethertype and netdev. If the same handler gets registered on a single netdev multiple times, the receive function will be called multiple times for each frame. 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.c28
-rw-r--r--drivers/scsi/fcoe/fcoe.h4
2 files changed, 18 insertions, 14 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 44c963c8bc7d..c215235ee39f 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -151,9 +151,11 @@ static int fcoe_fip_recv(struct sk_buff *skb, struct net_device *dev,
151 struct packet_type *ptype, 151 struct packet_type *ptype,
152 struct net_device *orig_dev) 152 struct net_device *orig_dev)
153{ 153{
154 struct fcoe_interface *fcoe;
154 struct fcoe_port *port; 155 struct fcoe_port *port;
155 156
156 port = container_of(ptype, struct fcoe_port, fip_packet_type); 157 fcoe = container_of(ptype, struct fcoe_interface, fip_packet_type);
158 port = fcoe->priv;
157 fcoe_ctlr_recv(&port->ctlr, skb); 159 fcoe_ctlr_recv(&port->ctlr, skb);
158 return 0; 160 return 0;
159} 161}
@@ -235,8 +237,8 @@ void fcoe_netdev_cleanup(struct fcoe_port *port)
235 struct fcoe_interface *fcoe = port->fcoe; 237 struct fcoe_interface *fcoe = port->fcoe;
236 238
237 /* Don't listen for Ethernet packets anymore */ 239 /* Don't listen for Ethernet packets anymore */
238 dev_remove_pack(&port->fcoe_packet_type); 240 dev_remove_pack(&fcoe->fcoe_packet_type);
239 dev_remove_pack(&port->fip_packet_type); 241 dev_remove_pack(&fcoe->fip_packet_type);
240 242
241 /* Delete secondary MAC addresses */ 243 /* Delete secondary MAC addresses */
242 rtnl_lock(); 244 rtnl_lock();
@@ -368,15 +370,15 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
368 * setup the receive function from ethernet driver 370 * setup the receive function from ethernet driver
369 * on the ethertype for the given device 371 * on the ethertype for the given device
370 */ 372 */
371 port->fcoe_packet_type.func = fcoe_rcv; 373 fcoe->fcoe_packet_type.func = fcoe_rcv;
372 port->fcoe_packet_type.type = __constant_htons(ETH_P_FCOE); 374 fcoe->fcoe_packet_type.type = __constant_htons(ETH_P_FCOE);
373 port->fcoe_packet_type.dev = netdev; 375 fcoe->fcoe_packet_type.dev = netdev;
374 dev_add_pack(&port->fcoe_packet_type); 376 dev_add_pack(&fcoe->fcoe_packet_type);
375 377
376 port->fip_packet_type.func = fcoe_fip_recv; 378 fcoe->fip_packet_type.func = fcoe_fip_recv;
377 port->fip_packet_type.type = htons(ETH_P_FIP); 379 fcoe->fip_packet_type.type = htons(ETH_P_FIP);
378 port->fip_packet_type.dev = netdev; 380 fcoe->fip_packet_type.dev = netdev;
379 dev_add_pack(&port->fip_packet_type); 381 dev_add_pack(&fcoe->fip_packet_type);
380 382
381 return 0; 383 return 0;
382} 384}
@@ -926,12 +928,14 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
926{ 928{
927 struct fc_lport *lp; 929 struct fc_lport *lp;
928 struct fcoe_rcv_info *fr; 930 struct fcoe_rcv_info *fr;
931 struct fcoe_interface *fcoe;
929 struct fcoe_port *port; 932 struct fcoe_port *port;
930 struct fc_frame_header *fh; 933 struct fc_frame_header *fh;
931 struct fcoe_percpu_s *fps; 934 struct fcoe_percpu_s *fps;
932 unsigned int cpu; 935 unsigned int cpu;
933 936
934 port = container_of(ptype, struct fcoe_port, fcoe_packet_type); 937 fcoe = container_of(ptype, struct fcoe_interface, fcoe_packet_type);
938 port = fcoe->priv;
935 lp = port->ctlr.lp; 939 lp = port->ctlr.lp;
936 if (unlikely(lp == NULL)) { 940 if (unlikely(lp == NULL)) {
937 FCOE_NETDEV_DBG(dev, "Cannot find hba structure"); 941 FCOE_NETDEV_DBG(dev, "Cannot find hba structure");
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h
index 3b3886e99b48..685aa9d02226 100644
--- a/drivers/scsi/fcoe/fcoe.h
+++ b/drivers/scsi/fcoe/fcoe.h
@@ -83,6 +83,8 @@ struct fcoe_interface {
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 struct net_device *netdev;
86 struct packet_type fcoe_packet_type;
87 struct packet_type fip_packet_type;
86}; 88};
87 89
88/* 90/*
@@ -92,8 +94,6 @@ struct fcoe_interface {
92struct fcoe_port { 94struct fcoe_port {
93 struct fcoe_interface *fcoe; 95 struct fcoe_interface *fcoe;
94 struct fc_exch_mgr *oem; /* offload exchange manger */ 96 struct fc_exch_mgr *oem; /* offload exchange manger */
95 struct packet_type fcoe_packet_type;
96 struct packet_type fip_packet_type;
97 struct sk_buff_head fcoe_pending_queue; 97 struct sk_buff_head fcoe_pending_queue;
98 u8 fcoe_pending_queue_active; 98 u8 fcoe_pending_queue_active;
99 struct timer_list timer; /* queue timer */ 99 struct timer_list timer; /* queue timer */