Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 173d26f8 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'bnxt_en-fixes'



Michael Chan says:

====================
bnxt_en: Bug fix and add tx timeout recovery.

Fix a bitmap declaration bug and add missing tx timeout recovery.

v2: Fixed white space error.  Thanks Dave.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d110986c 028de140
Loading
Loading
Loading
Loading
+32 −14
Original line number Original line Diff line number Diff line
@@ -2693,17 +2693,16 @@ static int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp)
	req.ver_upd = DRV_VER_UPD;
	req.ver_upd = DRV_VER_UPD;


	if (BNXT_PF(bp)) {
	if (BNXT_PF(bp)) {
		unsigned long vf_req_snif_bmap[4];
		DECLARE_BITMAP(vf_req_snif_bmap, 256);
		u32 *data = (u32 *)vf_req_snif_bmap;
		u32 *data = (u32 *)vf_req_snif_bmap;


		memset(vf_req_snif_bmap, 0, 32);
		memset(vf_req_snif_bmap, 0, sizeof(vf_req_snif_bmap));
		for (i = 0; i < ARRAY_SIZE(bnxt_vf_req_snif); i++)
		for (i = 0; i < ARRAY_SIZE(bnxt_vf_req_snif); i++)
			__set_bit(bnxt_vf_req_snif[i], vf_req_snif_bmap);
			__set_bit(bnxt_vf_req_snif[i], vf_req_snif_bmap);


		for (i = 0; i < 8; i++) {
		for (i = 0; i < 8; i++)
			req.vf_req_fwd[i] = cpu_to_le32(*data);
			req.vf_req_fwd[i] = cpu_to_le32(data[i]);
			data++;

		}
		req.enables |=
		req.enables |=
			cpu_to_le32(FUNC_DRV_RGTR_REQ_ENABLES_VF_REQ_FWD);
			cpu_to_le32(FUNC_DRV_RGTR_REQ_ENABLES_VF_REQ_FWD);
	}
	}
@@ -4603,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->nge_port_cnt = 1;
	}
	}


	bp->state = BNXT_STATE_OPEN;
	set_bit(BNXT_STATE_OPEN, &bp->state);
	bnxt_enable_int(bp);
	bnxt_enable_int(bp);
	/* Enable TX queues */
	/* Enable TX queues */
	bnxt_tx_enable(bp);
	bnxt_tx_enable(bp);
@@ -4679,8 +4678,10 @@ 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 */
	/* Change device state to avoid TX queue wake up's */
	bnxt_tx_disable(bp);
	bnxt_tx_disable(bp);


	bp->state = BNXT_STATE_CLOSED;
	clear_bit(BNXT_STATE_OPEN, &bp->state);
	cancel_work_sync(&bp->sp_task);
	smp_mb__after_atomic();
	while (test_bit(BNXT_STATE_IN_SP_TASK, &bp->state))
		msleep(20);


	/* Flush rings before disabling interrupts */
	/* Flush rings before disabling interrupts */
	bnxt_shutdown_nic(bp, irq_re_init);
	bnxt_shutdown_nic(bp, irq_re_init);
@@ -5030,8 +5031,10 @@ static void bnxt_dbg_dump_states(struct bnxt *bp)
static void bnxt_reset_task(struct bnxt *bp)
static void bnxt_reset_task(struct bnxt *bp)
{
{
	bnxt_dbg_dump_states(bp);
	bnxt_dbg_dump_states(bp);
	if (netif_running(bp->dev))
	if (netif_running(bp->dev)) {
		bnxt_tx_disable(bp); /* prevent tx timout again */
		bnxt_close_nic(bp, false, false);
		bnxt_open_nic(bp, false, false);
	}
}
}


static void bnxt_tx_timeout(struct net_device *dev)
static void bnxt_tx_timeout(struct net_device *dev)
@@ -5081,8 +5084,12 @@ static void bnxt_sp_task(struct work_struct *work)
	struct bnxt *bp = container_of(work, struct bnxt, sp_task);
	struct bnxt *bp = container_of(work, struct bnxt, sp_task);
	int rc;
	int rc;


	if (bp->state != BNXT_STATE_OPEN)
	set_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
	smp_mb__after_atomic();
	if (!test_bit(BNXT_STATE_OPEN, &bp->state)) {
		clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
		return;
		return;
	}


	if (test_and_clear_bit(BNXT_RX_MASK_SP_EVENT, &bp->sp_event))
	if (test_and_clear_bit(BNXT_RX_MASK_SP_EVENT, &bp->sp_event))
		bnxt_cfg_rx_mode(bp);
		bnxt_cfg_rx_mode(bp);
@@ -5106,8 +5113,19 @@ static void bnxt_sp_task(struct work_struct *work)
		bnxt_hwrm_tunnel_dst_port_free(
		bnxt_hwrm_tunnel_dst_port_free(
			bp, TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN);
			bp, TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN);
	}
	}
	if (test_and_clear_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event))
	if (test_and_clear_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event)) {
		/* bnxt_reset_task() calls bnxt_close_nic() which waits
		 * for BNXT_STATE_IN_SP_TASK to clear.
		 */
		clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
		rtnl_lock();
		bnxt_reset_task(bp);
		bnxt_reset_task(bp);
		set_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
		rtnl_unlock();
	}

	smp_mb__before_atomic();
	clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
}
}


static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
@@ -5186,7 +5204,7 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
	bp->timer.function = bnxt_timer;
	bp->timer.function = bnxt_timer;
	bp->current_interval = BNXT_TIMER_INTERVAL;
	bp->current_interval = BNXT_TIMER_INTERVAL;


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


	return 0;
	return 0;


+3 −3
Original line number Original line Diff line number Diff line
@@ -925,9 +925,9 @@ struct bnxt {


	struct timer_list	timer;
	struct timer_list	timer;


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


	struct bnxt_irq	*irq_tbl;
	struct bnxt_irq	*irq_tbl;
	u8			mac_addr[ETH_ALEN];
	u8			mac_addr[ETH_ALEN];
+1 −1
Original line number Original line Diff line number Diff line
@@ -21,7 +21,7 @@
#ifdef CONFIG_BNXT_SRIOV
#ifdef CONFIG_BNXT_SRIOV
static int bnxt_vf_ndo_prep(struct bnxt *bp, int vf_id)
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");
		netdev_err(bp->dev, "vf ndo called though PF is down\n");
		return -EINVAL;
		return -EINVAL;
	}
	}