Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132336
b: refs/heads/master
c: 55c8baf
h: refs/heads/master
v: v3
  • Loading branch information
Chris Leech authored and James Bottomley committed Mar 10, 2009
1 parent e209beb commit b345e8e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 58 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: c826a3145736e3baabebccfd0aecfbb6dae059f2
refs/heads/master: 55c8bafba549e3e82f6999db8c5a62fc3c255c14
81 changes: 24 additions & 57 deletions trunk/drivers/scsi/fcoe/libfcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ struct fcoe_percpu_s *fcoe_percpu[NR_CPUS];

/* Function Prototyes */
static int fcoe_check_wait_queue(struct fc_lport *);
static void fcoe_insert_wait_queue_head(struct fc_lport *, struct sk_buff *);
static void fcoe_insert_wait_queue(struct fc_lport *, struct sk_buff *);
static void fcoe_recv_flogi(struct fcoe_softc *, struct fc_frame *, u8 *);
#ifdef CONFIG_HOTPLUG_CPU
static int fcoe_cpu_callback(struct notifier_block *, ulong, void *);
Expand Down Expand Up @@ -501,7 +499,9 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
rc = fcoe_start_io(skb);

if (rc) {
fcoe_insert_wait_queue(lp, skb);
spin_lock_bh(&fc->fcoe_pending_queue.lock);
__skb_queue_tail(&fc->fcoe_pending_queue, skb);
spin_unlock_bh(&fc->fcoe_pending_queue.lock);
if (fc->fcoe_pending_queue.qlen > FCOE_MAX_QUEUE_DEPTH)
lp->qfull = 1;
}
Expand Down Expand Up @@ -756,76 +756,43 @@ void fcoe_watchdog(ulong vp)
*/
static int fcoe_check_wait_queue(struct fc_lport *lp)
{
struct fcoe_softc *fc = lport_priv(lp);
struct sk_buff *skb;
struct fcoe_softc *fc;
int rc = -1;

fc = lport_priv(lp);
spin_lock_bh(&fc->fcoe_pending_queue.lock);

if (fc->fcoe_pending_queue_active)
goto out;
fc->fcoe_pending_queue_active = 1;
if (fc->fcoe_pending_queue.qlen) {
while ((skb = __skb_dequeue(&fc->fcoe_pending_queue)) != NULL) {
spin_unlock_bh(&fc->fcoe_pending_queue.lock);
rc = fcoe_start_io(skb);
if (rc)
fcoe_insert_wait_queue_head(lp, skb);
spin_lock_bh(&fc->fcoe_pending_queue.lock);
if (rc)
break;

while (fc->fcoe_pending_queue.qlen) {
/* keep qlen > 0 until fcoe_start_io succeeds */
fc->fcoe_pending_queue.qlen++;
skb = __skb_dequeue(&fc->fcoe_pending_queue);

spin_unlock_bh(&fc->fcoe_pending_queue.lock);
rc = fcoe_start_io(skb);
spin_lock_bh(&fc->fcoe_pending_queue.lock);

if (rc) {
__skb_queue_head(&fc->fcoe_pending_queue, skb);
/* undo temporary increment above */
fc->fcoe_pending_queue.qlen--;
break;
}
/*
* if interface pending queue is below FCOE_LOW_QUEUE_DEPTH
* then clear qfull flag.
*/
if (fc->fcoe_pending_queue.qlen < FCOE_LOW_QUEUE_DEPTH)
lp->qfull = 0;
/* undo temporary increment above */
fc->fcoe_pending_queue.qlen--;
}

if (fc->fcoe_pending_queue.qlen < FCOE_LOW_QUEUE_DEPTH)
lp->qfull = 0;
fc->fcoe_pending_queue_active = 0;
rc = fc->fcoe_pending_queue.qlen;
out:
spin_unlock_bh(&fc->fcoe_pending_queue.lock);
return rc;
}

/**
* fcoe_insert_wait_queue_head() - puts skb to fcoe pending queue head
* @lp: the fc_port for this skb
* @skb: the associated skb to be xmitted
*
* Returns: none
*/
static void fcoe_insert_wait_queue_head(struct fc_lport *lp,
struct sk_buff *skb)
{
struct fcoe_softc *fc;

fc = lport_priv(lp);
spin_lock_bh(&fc->fcoe_pending_queue.lock);
__skb_queue_head(&fc->fcoe_pending_queue, skb);
spin_unlock_bh(&fc->fcoe_pending_queue.lock);
}

/**
* fcoe_insert_wait_queue() - put the skb into fcoe pending queue tail
* @lp: the fc_port for this skb
* @skb: the associated skb to be xmitted
*
* Returns: none
*/
static void fcoe_insert_wait_queue(struct fc_lport *lp,
struct sk_buff *skb)
{
struct fcoe_softc *fc;

fc = lport_priv(lp);
spin_lock_bh(&fc->fcoe_pending_queue.lock);
__skb_queue_tail(&fc->fcoe_pending_queue, skb);
spin_unlock_bh(&fc->fcoe_pending_queue.lock);
}

/**
* fcoe_dev_setup() - setup link change notification interface
*/
Expand Down

0 comments on commit b345e8e

Please sign in to comment.