aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fcoe
diff options
context:
space:
mode:
authorVasu Dev <vasu.dev@intel.com>2009-08-25 16:58:53 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 10:47:37 -0400
commitb2f0091fbf8b475fa09b5e1712e0ab84cb3e1ca4 (patch)
tree98d3427aaae0b3d20d5fd077023b4ea23f5b575c /drivers/scsi/fcoe
parente4bc50bedf0dd6c63f20a7bc0a2b46667664fba1 (diff)
[SCSI] fcoe, libfc: fully makes use of per cpu exch pool and then removes em_lock
1. Updates fcoe_rcv() to queue incoming frames to the fcoe per cpu thread on which this frame's exch was originated and simply use current cpu for request exch not originated by initiator. It is redundant to add this code under CONFIG_SMP, so removes CONFIG_SMP uses around this code. 2. Updates fc_exch_em_alloc, fc_exch_delete, fc_exch_find to use per cpu exch pools, here fc_exch_delete is rename of older fc_exch_mgr_delete_ep since ep/exch are now deleted in pools of EM and so brief new name is sufficient and better name. Updates these functions to map exch id to their index into exch pool using fc_cpu_mask, fc_cpu_order and EM min_xid. This mapping is as per detailed explanation about this in last patch and basically this is just as lower fc_cpu_mask bits of exch id as cpu number and upper bit sum of EM min_xid and exch index in pool. Uses pool next_index to keep track of exch allocation from pool along with pool_max_index as upper bound of exches array in pool. 3. Adds exch pool ptr to fc_exch to free exch to its pool in fc_exch_delete. 4. Updates fc_exch_mgr_reset to reset all exch pools of an EM, this required adding fc_exch_pool_reset func to reset exches in pool and then have fc_exch_mgr_reset call fc_exch_pool_reset for each pool within each EM for a lport. 5. Removes no longer needed exches array, em_lock, next_xid, and total_exches from struct fc_exch_mgr, these are not needed after use of per cpu exch pool, also removes not used max_read, last_read from struct fc_exch_mgr. 6. Updates locking notes for exch pool lock with fc_exch lock and uses pool lock in exch allocation, lookup and reset. Signed-off-by: Vasu Dev <vasu.dev@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/fcoe')
-rw-r--r--drivers/scsi/fcoe/fcoe.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 757aa28f0f04..e32a0ed266aa 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -912,8 +912,7 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
912 struct fcoe_softc *fc; 912 struct fcoe_softc *fc;
913 struct fc_frame_header *fh; 913 struct fc_frame_header *fh;
914 struct fcoe_percpu_s *fps; 914 struct fcoe_percpu_s *fps;
915 unsigned short oxid; 915 unsigned int cpu;
916 unsigned int cpu = 0;
917 916
918 fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type); 917 fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type);
919 lp = fc->ctlr.lp; 918 lp = fc->ctlr.lp;
@@ -947,20 +946,20 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
947 skb_set_transport_header(skb, sizeof(struct fcoe_hdr)); 946 skb_set_transport_header(skb, sizeof(struct fcoe_hdr));
948 fh = (struct fc_frame_header *) skb_transport_header(skb); 947 fh = (struct fc_frame_header *) skb_transport_header(skb);
949 948
950 oxid = ntohs(fh->fh_ox_id);
951
952 fr = fcoe_dev_from_skb(skb); 949 fr = fcoe_dev_from_skb(skb);
953 fr->fr_dev = lp; 950 fr->fr_dev = lp;
954 fr->ptype = ptype; 951 fr->ptype = ptype;
955 952
956#ifdef CONFIG_SMP
957 /* 953 /*
958 * The incoming frame exchange id(oxid) is ANDed with num of online 954 * In case the incoming frame's exchange is originated from
959 * cpu bits to get cpu and then this cpu is used for selecting 955 * the initiator, then received frame's exchange id is ANDed
960 * a per cpu kernel thread from fcoe_percpu. 956 * with fc_cpu_mask bits to get the same cpu on which exchange
957 * was originated, otherwise just use the current cpu.
961 */ 958 */
962 cpu = oxid & (num_online_cpus() - 1); 959 if (ntoh24(fh->fh_f_ctl) & FC_FC_EX_CTX)
963#endif 960 cpu = ntohs(fh->fh_ox_id) & fc_cpu_mask;
961 else
962 cpu = smp_processor_id();
964 963
965 fps = &per_cpu(fcoe_percpu, cpu); 964 fps = &per_cpu(fcoe_percpu, cpu);
966 spin_lock_bh(&fps->fcoe_rx_list.lock); 965 spin_lock_bh(&fps->fcoe_rx_list.lock);