Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130126
b: refs/heads/master
c: 237907c
h: refs/heads/master
v: v3
  • Loading branch information
Eilon Greenstein authored and David S. Miller committed Jan 20, 2009
1 parent 80c9bd8 commit 3319938
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 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: e47d7e6eb841c1850f0e69b95ae6cf3c86881f53
refs/heads/master: 237907c1ded8a1a447cea7c4f97ab853e8b46052
9 changes: 1 addition & 8 deletions trunk/drivers/net/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,7 @@ struct bnx2x_fastpath {

#define bnx2x_fp(bp, nr, var) (bp->fp[nr].var)

#define BNX2X_HAS_TX_WORK(fp) \
((fp->tx_pkt_prod != le16_to_cpu(*fp->tx_cons_sb)) || \
(fp->tx_pkt_prod != fp->tx_pkt_cons))

#define BNX2X_HAS_RX_WORK(fp) \
(fp->rx_comp_cons != rx_cons_sb)

#define BNX2X_HAS_WORK(fp) (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp))
#define BNX2X_HAS_WORK(fp) (bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))


/* MC hsi */
Expand Down
37 changes: 26 additions & 11 deletions trunk/drivers/net/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,17 @@ static u16 bnx2x_ack_int(struct bnx2x *bp)
* fast path service functions
*/

static inline int bnx2x_has_tx_work(struct bnx2x_fastpath *fp)
{
u16 tx_cons_sb;

/* Tell compiler that status block fields can change */
barrier();
tx_cons_sb = le16_to_cpu(*fp->tx_cons_sb);
return ((fp->tx_pkt_prod != tx_cons_sb) ||
(fp->tx_pkt_prod != fp->tx_pkt_cons));
}

/* free skb in the packet ring at pos idx
* return idx of last bd freed
*/
Expand Down Expand Up @@ -6693,7 +6704,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)

cnt = 1000;
smp_rmb();
while (BNX2X_HAS_TX_WORK(fp)) {
while (bnx2x_has_tx_work(fp)) {

bnx2x_tx_int(fp, 1000);
if (!cnt) {
Expand Down Expand Up @@ -9281,6 +9292,18 @@ static int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
return 0;
}

static inline int bnx2x_has_rx_work(struct bnx2x_fastpath *fp)
{
u16 rx_cons_sb;

/* Tell compiler that status block fields can change */
barrier();
rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
rx_cons_sb++;
return (fp->rx_comp_cons != rx_cons_sb);
}

/*
* net_device service functions
*/
Expand All @@ -9291,7 +9314,6 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
napi);
struct bnx2x *bp = fp->bp;
int work_done = 0;
u16 rx_cons_sb;

#ifdef BNX2X_STOP_ON_ERROR
if (unlikely(bp->panic))
Expand All @@ -9304,19 +9326,12 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)

bnx2x_update_fpsb_idx(fp);

if (BNX2X_HAS_TX_WORK(fp))
if (bnx2x_has_tx_work(fp))
bnx2x_tx_int(fp, budget);

rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
rx_cons_sb++;
if (BNX2X_HAS_RX_WORK(fp))
if (bnx2x_has_rx_work(fp))
work_done = bnx2x_rx_int(fp, budget);

rmb(); /* BNX2X_HAS_WORK() reads the status block */
rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
rx_cons_sb++;

/* must not complete if we consumed full budget */
if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) {
Expand Down

0 comments on commit 3319938

Please sign in to comment.