diff options
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_main.c')
| -rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 44 | 
1 files changed, 21 insertions, 23 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 2a3d8aef7f4e..f70c478dafdb 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -196,10 +196,6 @@ int i40e_free_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem)   * @id: an owner id to stick on the items assigned   *   * Returns the base item index of the lump, or negative for error - * - * The search_hint trick and lack of advanced fit-finding only work - * because we're highly likely to have all the same size lump requests. - * Linear search time and any fragmentation should be minimal.   **/  static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,  			 u16 needed, u16 id) @@ -214,8 +210,21 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,  		return -EINVAL;  	} -	/* start the linear search with an imperfect hint */ -	i = pile->search_hint; +	/* Allocate last queue in the pile for FDIR VSI queue +	 * so it doesn't fragment the qp_pile +	 */ +	if (pile == pf->qp_pile && pf->vsi[id]->type == I40E_VSI_FDIR) { +		if (pile->list[pile->num_entries - 1] & I40E_PILE_VALID_BIT) { +			dev_err(&pf->pdev->dev, +				"Cannot allocate queue %d for I40E_VSI_FDIR\n", +				pile->num_entries - 1); +			return -ENOMEM; +		} +		pile->list[pile->num_entries - 1] = id | I40E_PILE_VALID_BIT; +		return pile->num_entries - 1; +	} + +	i = 0;  	while (i < pile->num_entries) {  		/* skip already allocated entries */  		if (pile->list[i] & I40E_PILE_VALID_BIT) { @@ -234,7 +243,6 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,  			for (j = 0; j < needed; j++)  				pile->list[i+j] = id | I40E_PILE_VALID_BIT;  			ret = i; -			pile->search_hint = i + j;  			break;  		} @@ -257,7 +265,7 @@ static int i40e_put_lump(struct i40e_lump_tracking *pile, u16 index, u16 id)  {  	int valid_id = (id | I40E_PILE_VALID_BIT);  	int count = 0; -	int i; +	u16 i;  	if (!pile || index >= pile->num_entries)  		return -EINVAL; @@ -269,8 +277,6 @@ static int i40e_put_lump(struct i40e_lump_tracking *pile, u16 index, u16 id)  		count++;  	} -	if (count && index < pile->search_hint) -		pile->search_hint = index;  	return count;  } @@ -772,9 +778,9 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)  	struct rtnl_link_stats64 *ns;   /* netdev stats */  	struct i40e_eth_stats *oes;  	struct i40e_eth_stats *es;     /* device's eth stats */ -	u32 tx_restart, tx_busy; +	u64 tx_restart, tx_busy;  	struct i40e_ring *p; -	u32 rx_page, rx_buf; +	u64 rx_page, rx_buf;  	u64 bytes, packets;  	unsigned int start;  	u64 tx_linearize; @@ -10574,15 +10580,9 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)  	}  	i40e_get_oem_version(&pf->hw); -	if (test_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state) && -	    ((hw->aq.fw_maj_ver == 4 && hw->aq.fw_min_ver <= 33) || -	     hw->aq.fw_maj_ver < 4) && hw->mac.type == I40E_MAC_XL710) { -		/* The following delay is necessary for 4.33 firmware and older -		 * to recover after EMP reset. 200 ms should suffice but we -		 * put here 300 ms to be sure that FW is ready to operate -		 * after reset. -		 */ -		mdelay(300); +	if (test_and_clear_bit(__I40E_EMP_RESET_INTR_RECEIVED, pf->state)) { +		/* The following delay is necessary for firmware update. */ +		mdelay(1000);  	}  	/* re-verify the eeprom if we just had an EMP reset */ @@ -11792,7 +11792,6 @@ static int i40e_init_interrupt_scheme(struct i40e_pf *pf)  		return -ENOMEM;  	pf->irq_pile->num_entries = vectors; -	pf->irq_pile->search_hint = 0;  	/* track first vector for misc interrupts, ignore return */  	(void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1); @@ -12595,7 +12594,6 @@ static int i40e_sw_init(struct i40e_pf *pf)  		goto sw_init_done;  	}  	pf->qp_pile->num_entries = pf->hw.func_caps.num_tx_qp; -	pf->qp_pile->search_hint = 0;  	pf->tx_timeout_recovery_level = 1;  |