Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 261735
b: refs/heads/master
c: d272281
h: refs/heads/master
i:
  261733: 67a883b
  261731: c55a150
  261727: 1152add
v: v3
  • Loading branch information
Vasu Dev authored and James Bottomley committed Jul 28, 2011
1 parent 7e1b6eb commit a007c98
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 980f5156ab2d75e0462f3811e8a92acd06b0577b
refs/heads/master: d272281c390eb6c3f1e70ed0337c9e619d99cd9c
43 changes: 13 additions & 30 deletions trunk/drivers/scsi/fcoe/fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1270,30 +1270,20 @@ static int fcoe_cpu_callback(struct notifier_block *nfb,
/**
* fcoe_select_cpu() - Selects CPU to handle post-processing of incoming
* command.
* @curr_cpu: CPU which received request
*
* This routine selects next CPU based on cpumask.
* This routine selects next CPU based on cpumask to distribute
* incoming requests in round robin.
*
* Returns: int (CPU number). Caller to verify if returned CPU is online or not.
* Returns: int CPU number
*/
static unsigned int fcoe_select_cpu(unsigned int curr_cpu)
static inline unsigned int fcoe_select_cpu(void)
{
static unsigned int selected_cpu;

if (num_online_cpus() == 1)
return curr_cpu;
/*
* Doing following check, to skip "curr_cpu (smp_processor_id)"
* from selection of CPU is intentional. This is to avoid same CPU
* doing post-processing of command. "curr_cpu" to just receive
* incoming request in case where rx_id is UNKNOWN and all other
* CPU to actually process the command(s)
*/
do {
selected_cpu = cpumask_next(selected_cpu, cpu_online_mask);
if (selected_cpu >= nr_cpu_ids)
selected_cpu = cpumask_first(cpu_online_mask);
} while (selected_cpu == curr_cpu);
selected_cpu = cpumask_next(selected_cpu, cpu_online_mask);
if (selected_cpu >= nr_cpu_ids)
selected_cpu = cpumask_first(cpu_online_mask);

return selected_cpu;
}

Expand Down Expand Up @@ -1368,23 +1358,16 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev,
* In case the incoming frame's exchange is originated from
* the initiator, then received frame's exchange id is ANDed
* with fc_cpu_mask bits to get the same cpu on which exchange
* was originated, otherwise just use the current cpu.
* was originated, otherwise select cpu using rx exchange id
* or fcoe_select_cpu().
*/
if (ntoh24(fh->fh_f_ctl) & FC_FC_EX_CTX)
cpu = ntohs(fh->fh_ox_id) & fc_cpu_mask;
else {
cpu = smp_processor_id();

if ((fh->fh_type == FC_TYPE_FCP) &&
(ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN)) {
do {
cpu = fcoe_select_cpu(cpu);
} while (!cpu_online(cpu));
} else if ((fh->fh_type == FC_TYPE_FCP) &&
(ntohs(fh->fh_rx_id) != FC_XID_UNKNOWN)) {
if (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN)
cpu = fcoe_select_cpu();
else
cpu = ntohs(fh->fh_rx_id) & fc_cpu_mask;
} else
cpu = smp_processor_id();
}

if (cpu >= nr_cpu_ids)
Expand Down

0 comments on commit a007c98

Please sign in to comment.