From: Kiran Patil <[email protected]> Problem: Earlier mechanism of selection of CPU was, to select the same CPU which has received incoming request. Hence in case of rx_id = 0xFFFF, request was always posted to same NetRx queue, hence only 1 CPU is utilized for handling the command. It was also causing problem of "running out of exchanges from per CPU pool of exchanges (in case of DDP offload)
Fix: Implemented new algo. to select CPU for post-processing of incoming commands when rx_id is unknown. This is simple Round robin algo. for CPU selection. Notes/Dependencies: N/A Signed-off-by: Kiran Patil <[email protected]> --- drivers/scsi/fcoe/fcoe.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 6c170ba..6671815 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c @@ -1256,6 +1256,10 @@ static int fcoe_cpu_callback(struct notifier_block *nfb, return NOTIFY_OK; } +#define SELECT_NEXT_CPU(_cpu, online_cpus) (((_cpu) + 1) & ((online_cpus) - 1)) + +static int next_cpu; + /** * fcoe_rcv() - Receive packets from a net device * @skb: The received packet @@ -1278,6 +1282,7 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, struct fcoe_percpu_s *fps; struct ethhdr *eh; unsigned int cpu; + int online_cpus = num_online_cpus(); fcoe = container_of(ptype, struct fcoe_interface, fcoe_packet_type); lport = fcoe->ctlr.lp; @@ -1332,9 +1337,20 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, */ if (ntoh24(fh->fh_f_ctl) & FC_FC_EX_CTX) cpu = ntohs(fh->fh_ox_id) & fc_cpu_mask; - else + else { cpu = smp_processor_id(); + if ((fh->fh_type == FC_TYPE_FCP) && + (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN)) { + if (cpu == next_cpu) + next_cpu = SELECT_NEXT_CPU(next_cpu, + online_cpus); + cpu = next_cpu; + next_cpu = SELECT_NEXT_CPU(next_cpu, online_cpus); + if (next_cpu >= online_cpus) + cpu = smp_processor_id(); + } + } fps = &per_cpu(fcoe_percpu, cpu); spin_lock_bh(&fps->fcoe_rx_list.lock); if (unlikely(!fps->thread)) { _______________________________________________ devel mailing list [email protected] https://lists.open-fcoe.org/mailman/listinfo/devel
