Skip to content

Commit

Permalink
bnxt_en: Change bp->state to bitmap.
Browse files Browse the repository at this point in the history
This allows multiple independent bits to be set for various states.
Subsequent patches to implement tx timeout reset will require this.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Michael Chan authored and David S. Miller committed Dec 12, 2015
1 parent de68f5d commit caefe52
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4602,7 +4602,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
bp->nge_port_cnt = 1;
}

bp->state = BNXT_STATE_OPEN;
set_bit(BNXT_STATE_OPEN, &bp->state);
bnxt_enable_int(bp);
/* Enable TX queues */
bnxt_tx_enable(bp);
Expand Down Expand Up @@ -4678,7 +4678,7 @@ int bnxt_close_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
/* Change device state to avoid TX queue wake up's */
bnxt_tx_disable(bp);

bp->state = BNXT_STATE_CLOSED;
clear_bit(BNXT_STATE_OPEN, &bp->state);
cancel_work_sync(&bp->sp_task);

/* Flush rings before disabling interrupts */
Expand Down Expand Up @@ -5080,7 +5080,7 @@ static void bnxt_sp_task(struct work_struct *work)
struct bnxt *bp = container_of(work, struct bnxt, sp_task);
int rc;

if (bp->state != BNXT_STATE_OPEN)
if (!test_bit(BNXT_STATE_OPEN, &bp->state))
return;

if (test_and_clear_bit(BNXT_RX_MASK_SP_EVENT, &bp->sp_event))
Expand Down Expand Up @@ -5185,7 +5185,7 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
bp->timer.function = bnxt_timer;
bp->current_interval = BNXT_TIMER_INTERVAL;

bp->state = BNXT_STATE_CLOSED;
clear_bit(BNXT_STATE_OPEN, &bp->state);

return 0;

Expand Down
5 changes: 2 additions & 3 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.h
Original file line number Diff line number Diff line change
Expand Up @@ -925,9 +925,8 @@ struct bnxt {

struct timer_list timer;

int state;
#define BNXT_STATE_CLOSED 0
#define BNXT_STATE_OPEN 1
unsigned long state;
#define BNXT_STATE_OPEN 0

struct bnxt_irq *irq_tbl;
u8 mac_addr[ETH_ALEN];
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#ifdef CONFIG_BNXT_SRIOV
static int bnxt_vf_ndo_prep(struct bnxt *bp, int vf_id)
{
if (bp->state != BNXT_STATE_OPEN) {
if (!test_bit(BNXT_STATE_OPEN, &bp->state)) {
netdev_err(bp->dev, "vf ndo called though PF is down\n");
return -EINVAL;
}
Expand Down

0 comments on commit caefe52

Please sign in to comment.