Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203159
b: refs/heads/master
c: 644b9d4
h: refs/heads/master
i:
  203157: ba0c808
  203155: 147de3a
  203151: 54fd2c2
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Jun 26, 2010
1 parent d2988f9 commit 6b06fc1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 55 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: e6c2889478f04b30e5a71d753734644c579472fa
refs/heads/master: 644b9d4f8b8d74f4d87f14dede5e331555d3e701
76 changes: 22 additions & 54 deletions trunk/drivers/net/cnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2141,18 +2141,20 @@ static u16 cnic_bnx2x_hw_idx(u16 idx)
return idx;
}

static int cnic_get_kcqes(struct cnic_dev *dev, u16 hw_prod, u16 *sw_prod)
static int cnic_get_kcqes(struct cnic_dev *dev, struct kcq_info *info)
{
struct cnic_local *cp = dev->cnic_priv;
u16 i, ri, last;
u16 i, ri, hw_prod, last;
struct kcqe *kcqe;
int kcqe_cnt = 0, last_cnt = 0;

i = ri = last = *sw_prod;
i = ri = last = info->sw_prod_idx;
ri &= MAX_KCQ_IDX;
hw_prod = *info->hw_prod_idx_ptr;
hw_prod = cp->hw_idx(hw_prod);

while ((i != hw_prod) && (kcqe_cnt < MAX_COMPLETED_KCQE)) {
kcqe = &cp->kcq1.kcq[KCQ_PG(ri)][KCQ_IDX(ri)];
kcqe = &info->kcq[KCQ_PG(ri)][KCQ_IDX(ri)];
cp->completed_kcq[kcqe_cnt++] = kcqe;
i = cp->next_idx(i);
ri = i & MAX_KCQ_IDX;
Expand All @@ -2162,7 +2164,7 @@ static int cnic_get_kcqes(struct cnic_dev *dev, u16 hw_prod, u16 *sw_prod)
}
}

*sw_prod = last;
info->sw_prod_idx = last;
return last_cnt;
}

Expand Down Expand Up @@ -2224,40 +2226,29 @@ static void cnic_chk_pkt_rings(struct cnic_local *cp)
static int cnic_service_bnx2(void *data, void *status_blk)
{
struct cnic_dev *dev = data;
struct status_block *sblk = status_blk;
struct cnic_local *cp = dev->cnic_priv;
u32 status_idx = sblk->status_idx;
u16 hw_prod, sw_prod;
u32 status_idx = *cp->kcq1.status_idx_ptr;
int kcqe_cnt;

if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags)))
return status_idx;

cp->kwq_con_idx = *cp->kwq_con_idx_ptr;

hw_prod = sblk->status_completion_producer_index;
sw_prod = cp->kcq1.sw_prod_idx;
while (sw_prod != hw_prod) {
kcqe_cnt = cnic_get_kcqes(dev, hw_prod, &sw_prod);
if (kcqe_cnt == 0)
goto done;
while ((kcqe_cnt = cnic_get_kcqes(dev, &cp->kcq1))) {

service_kcqes(dev, kcqe_cnt);

/* Tell compiler that status_blk fields can change. */
barrier();
if (status_idx != sblk->status_idx) {
status_idx = sblk->status_idx;
if (status_idx != *cp->kcq1.status_idx_ptr) {
status_idx = *cp->kcq1.status_idx_ptr;
cp->kwq_con_idx = *cp->kwq_con_idx_ptr;
hw_prod = sblk->status_completion_producer_index;
} else
break;
}

done:
CNIC_WR16(dev, cp->kcq1.io_addr, sw_prod);

cp->kcq1.sw_prod_idx = sw_prod;
CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx);

cnic_chk_pkt_rings(cp);
return status_idx;
Expand All @@ -2268,34 +2259,25 @@ static void cnic_service_bnx2_msix(unsigned long data)
struct cnic_dev *dev = (struct cnic_dev *) data;
struct cnic_local *cp = dev->cnic_priv;
struct status_block_msix *status_blk = cp->status_blk.bnx2;
u32 status_idx = status_blk->status_idx;
u16 hw_prod, sw_prod;
u32 status_idx = *cp->kcq1.status_idx_ptr;
int kcqe_cnt;

cp->kwq_con_idx = status_blk->status_cmd_consumer_index;

hw_prod = status_blk->status_completion_producer_index;
sw_prod = cp->kcq1.sw_prod_idx;
while (sw_prod != hw_prod) {
kcqe_cnt = cnic_get_kcqes(dev, hw_prod, &sw_prod);
if (kcqe_cnt == 0)
goto done;
while ((kcqe_cnt = cnic_get_kcqes(dev, &cp->kcq1))) {

service_kcqes(dev, kcqe_cnt);

/* Tell compiler that status_blk fields can change. */
barrier();
if (status_idx != status_blk->status_idx) {
status_idx = status_blk->status_idx;
if (status_idx != *cp->kcq1.status_idx_ptr) {
status_idx = *cp->kcq1.status_idx_ptr;
cp->kwq_con_idx = status_blk->status_cmd_consumer_index;
hw_prod = status_blk->status_completion_producer_index;
} else
break;
}

done:
CNIC_WR16(dev, cp->kcq1.io_addr, sw_prod);
cp->kcq1.sw_prod_idx = sw_prod;
CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx);

cnic_chk_pkt_rings(cp);

Expand Down Expand Up @@ -2360,41 +2342,27 @@ static void cnic_service_bnx2x_bh(unsigned long data)
{
struct cnic_dev *dev = (struct cnic_dev *) data;
struct cnic_local *cp = dev->cnic_priv;
u16 hw_prod, sw_prod;
struct cstorm_status_block_c *sblk =
&cp->status_blk.bnx2x->c_status_block;
u32 status_idx = sblk->status_block_index;
u32 status_idx = *cp->kcq1.status_idx_ptr;
int kcqe_cnt;

if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags)))
return;

hw_prod = sblk->index_values[HC_INDEX_C_ISCSI_EQ_CONS];
hw_prod = cp->hw_idx(hw_prod);
sw_prod = cp->kcq1.sw_prod_idx;
while (sw_prod != hw_prod) {
kcqe_cnt = cnic_get_kcqes(dev, hw_prod, &sw_prod);
if (kcqe_cnt == 0)
goto done;
while ((kcqe_cnt = cnic_get_kcqes(dev, &cp->kcq1))) {

service_kcqes(dev, kcqe_cnt);

/* Tell compiler that sblk fields can change. */
barrier();
if (status_idx == sblk->status_block_index)
if (status_idx == *cp->kcq1.status_idx_ptr)
break;

status_idx = sblk->status_block_index;
hw_prod = sblk->index_values[HC_INDEX_C_ISCSI_EQ_CONS];
hw_prod = cp->hw_idx(hw_prod);
status_idx = *cp->kcq1.status_idx_ptr;
}

done:
CNIC_WR16(dev, cp->kcq1.io_addr, sw_prod + MAX_KCQ_IDX);
CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx + MAX_KCQ_IDX);
cnic_ack_bnx2x_int(dev, cp->status_blk_num, CSTORM_ID,
status_idx, IGU_INT_ENABLE, 1);

cp->kcq1.sw_prod_idx = sw_prod;
}

static int cnic_service_bnx2x(void *data, void *status_blk)
Expand Down

0 comments on commit 6b06fc1

Please sign in to comment.