diff options
| author | Mark Brown <[email protected]> | 2015-10-12 18:09:27 +0100 | 
|---|---|---|
| committer | Mark Brown <[email protected]> | 2015-10-12 18:09:27 +0100 | 
| commit | 79828b4fa835f73cdaf4bffa48696abdcbea9d02 (patch) | |
| tree | 5e0fa7156acb75ba603022bc807df8f2fedb97a8 /drivers/net/ethernet/intel/i40e/i40e_main.c | |
| parent | 721b51fcf91898299d96f4b72cb9434cda29dce6 (diff) | |
| parent | 8c1a9d6323abf0fb1e5dad96cf3f1c783505ea5a (diff) | |
Merge remote-tracking branch 'asoc/fix/rt5645' into asoc-fix-rt5645
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_main.c')
| -rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 784 | 
1 files changed, 525 insertions, 259 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 48a52b35b614..851c1a159be8 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -39,7 +39,7 @@ static const char i40e_driver_string[] =  #define DRV_VERSION_MAJOR 1  #define DRV_VERSION_MINOR 3 -#define DRV_VERSION_BUILD 4 +#define DRV_VERSION_BUILD 9  #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \  	     __stringify(DRV_VERSION_MINOR) "." \  	     __stringify(DRV_VERSION_BUILD)    DRV_KERN @@ -76,6 +76,9 @@ static const struct pci_device_id i40e_pci_tbl[] = {  	{PCI_VDEVICE(INTEL, I40E_DEV_ID_QSFP_C), 0},  	{PCI_VDEVICE(INTEL, I40E_DEV_ID_10G_BASE_T), 0},  	{PCI_VDEVICE(INTEL, I40E_DEV_ID_20G_KR2), 0}, +	{PCI_VDEVICE(INTEL, I40E_DEV_ID_SFP_X722), 0}, +	{PCI_VDEVICE(INTEL, I40E_DEV_ID_1G_BASE_T_X722), 0}, +	{PCI_VDEVICE(INTEL, I40E_DEV_ID_10G_BASE_T_X722), 0},  	/* required last entry */  	{0, }  }; @@ -520,7 +523,7 @@ static void i40e_stat_update48(struct i40e_hw *hw, u32 hireg, u32 loreg,  	if (likely(new_data >= *offset))  		*stat = new_data - *offset;  	else -		*stat = (new_data + ((u64)1 << 48)) - *offset; +		*stat = (new_data + BIT_ULL(48)) - *offset;  	*stat &= 0xFFFFFFFFFFFFULL;  } @@ -543,7 +546,7 @@ static void i40e_stat_update32(struct i40e_hw *hw, u32 reg,  	if (likely(new_data >= *offset))  		*stat = (u32)(new_data - *offset);  	else -		*stat = (u32)((new_data + ((u64)1 << 32)) - *offset); +		*stat = (u32)((new_data + BIT_ULL(32)) - *offset);  }  /** @@ -621,11 +624,15 @@ static void i40e_update_veb_stats(struct i40e_veb *veb)  	struct i40e_hw *hw = &pf->hw;  	struct i40e_eth_stats *oes;  	struct i40e_eth_stats *es;     /* device's eth stats */ -	int idx = 0; +	struct i40e_veb_tc_stats *veb_oes; +	struct i40e_veb_tc_stats *veb_es; +	int i, idx = 0;  	idx = veb->stats_idx;  	es = &veb->stats;  	oes = &veb->stats_offsets; +	veb_es = &veb->tc_stats; +	veb_oes = &veb->tc_stats_offsets;  	/* Gather up the stats that the hw collects */  	i40e_stat_update32(hw, I40E_GLSW_TDPC(idx), @@ -661,6 +668,28 @@ static void i40e_update_veb_stats(struct i40e_veb *veb)  	i40e_stat_update48(hw, I40E_GLSW_BPTCH(idx), I40E_GLSW_BPTCL(idx),  			   veb->stat_offsets_loaded,  			   &oes->tx_broadcast, &es->tx_broadcast); +	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { +		i40e_stat_update48(hw, I40E_GLVEBTC_RPCH(i, idx), +				   I40E_GLVEBTC_RPCL(i, idx), +				   veb->stat_offsets_loaded, +				   &veb_oes->tc_rx_packets[i], +				   &veb_es->tc_rx_packets[i]); +		i40e_stat_update48(hw, I40E_GLVEBTC_RBCH(i, idx), +				   I40E_GLVEBTC_RBCL(i, idx), +				   veb->stat_offsets_loaded, +				   &veb_oes->tc_rx_bytes[i], +				   &veb_es->tc_rx_bytes[i]); +		i40e_stat_update48(hw, I40E_GLVEBTC_TPCH(i, idx), +				   I40E_GLVEBTC_TPCL(i, idx), +				   veb->stat_offsets_loaded, +				   &veb_oes->tc_tx_packets[i], +				   &veb_es->tc_tx_packets[i]); +		i40e_stat_update48(hw, I40E_GLVEBTC_TBCH(i, idx), +				   I40E_GLVEBTC_TBCL(i, idx), +				   veb->stat_offsets_loaded, +				   &veb_oes->tc_tx_bytes[i], +				   &veb_es->tc_tx_bytes[i]); +	}  	veb->stat_offsets_loaded = true;  } @@ -1123,6 +1152,18 @@ static void i40e_update_pf_stats(struct i40e_pf *pf)  			   pf->stat_offsets_loaded,  			   &osd->rx_lpi_count, &nsd->rx_lpi_count); +	if (pf->flags & I40E_FLAG_FD_SB_ENABLED && +	    !(pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)) +		nsd->fd_sb_status = true; +	else +		nsd->fd_sb_status = false; + +	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED && +	    !(pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED)) +		nsd->fd_atr_status = true; +	else +		nsd->fd_atr_status = false; +  	pf->stat_offsets_loaded = true;  } @@ -1240,6 +1281,8 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi, u8 *macaddr,  	struct i40e_mac_filter *f;  	list_for_each_entry(f, &vsi->mac_filter_list, list) { +		if (vsi->info.pvid) +			f->vlan = le16_to_cpu(vsi->info.pvid);  		if (!i40e_find_filter(vsi, macaddr, f->vlan,  				      is_vf, is_netdev)) {  			if (!i40e_add_filter(vsi, macaddr, f->vlan, @@ -1264,7 +1307,7 @@ static int i40e_rm_default_mac_filter(struct i40e_vsi *vsi, u8 *macaddr)  {  	struct i40e_aqc_remove_macvlan_element_data element;  	struct i40e_pf *pf = vsi->back; -	i40e_status aq_ret; +	i40e_status ret;  	/* Only appropriate for the PF main VSI */  	if (vsi->type != I40E_VSI_MAIN) @@ -1275,8 +1318,8 @@ static int i40e_rm_default_mac_filter(struct i40e_vsi *vsi, u8 *macaddr)  	element.vlan_tag = 0;  	element.flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH |  			I40E_AQC_MACVLAN_DEL_IGNORE_VLAN; -	aq_ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL); -	if (aq_ret) +	ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL); +	if (ret)  		return -ENOENT;  	return 0; @@ -1514,7 +1557,7 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,  	if (enabled_tc && (vsi->back->flags & I40E_FLAG_DCB_ENABLED)) {  		/* Find numtc from enabled TC bitmap */  		for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { -			if (enabled_tc & (1 << i)) /* TC is enabled */ +			if (enabled_tc & BIT_ULL(i)) /* TC is enabled */  				numtc++;  		}  		if (!numtc) { @@ -1533,14 +1576,18 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,  	 * vectors available and so we need to lower the used  	 * q count.  	 */ -	qcount = min_t(int, vsi->alloc_queue_pairs, pf->num_lan_msix); +	if (pf->flags & I40E_FLAG_MSIX_ENABLED) +		qcount = min_t(int, vsi->alloc_queue_pairs, pf->num_lan_msix); +	else +		qcount = vsi->alloc_queue_pairs;  	num_tc_qps = qcount / numtc; -	num_tc_qps = min_t(int, num_tc_qps, I40E_MAX_QUEUES_PER_TC); +	num_tc_qps = min_t(int, num_tc_qps, i40e_pf_get_max_q_per_tc(pf));  	/* Setup queue offset/count for all TCs for given VSI */  	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {  		/* See if the given TC is enabled for the given VSI */ -		if (vsi->tc_config.enabled_tc & (1 << i)) { /* TC is enabled */ +		if (vsi->tc_config.enabled_tc & BIT_ULL(i)) { +			/* TC is enabled */  			int pow, num_qps;  			switch (vsi->type) { @@ -1566,7 +1613,7 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,  			/* find the next higher power-of-2 of num queue pairs */  			num_qps = qcount;  			pow = 0; -			while (num_qps && ((1 << pow) < qcount)) { +			while (num_qps && (BIT_ULL(pow) < qcount)) {  				pow++;  				num_qps >>= 1;  			} @@ -1596,7 +1643,7 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,  	if ((vsi->type == I40E_VSI_MAIN) && (numtc == 1)) {  		if (vsi->req_queue_pairs > 0)  			vsi->num_queue_pairs = vsi->req_queue_pairs; -		else +		else if (pf->flags & I40E_FLAG_MSIX_ENABLED)  			vsi->num_queue_pairs = pf->num_lan_msix;  	} @@ -1716,10 +1763,11 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)  	bool add_happened = false;  	int filter_list_len = 0;  	u32 changed_flags = 0; -	i40e_status aq_ret = 0; +	i40e_status ret = 0;  	struct i40e_pf *pf;  	int num_add = 0;  	int num_del = 0; +	int aq_err = 0;  	u16 cmd_flags;  	/* empty array typed pointers, kcalloc later */ @@ -1771,31 +1819,31 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)  			/* flush a full buffer */  			if (num_del == filter_list_len) { -				aq_ret = i40e_aq_remove_macvlan(&pf->hw, -					    vsi->seid, del_list, num_del, -					    NULL); +				ret = i40e_aq_remove_macvlan(&pf->hw, +						  vsi->seid, del_list, num_del, +						  NULL); +				aq_err = pf->hw.aq.asq_last_status;  				num_del = 0;  				memset(del_list, 0, sizeof(*del_list)); -				if (aq_ret && -				    pf->hw.aq.asq_last_status != -							      I40E_AQ_RC_ENOENT) +				if (ret && aq_err != I40E_AQ_RC_ENOENT)  					dev_info(&pf->pdev->dev, -						 "ignoring delete macvlan error, err %d, aq_err %d while flushing a full buffer\n", -						 aq_ret, -						 pf->hw.aq.asq_last_status); +						 "ignoring delete macvlan error, err %s, aq_err %s while flushing a full buffer\n", +						 i40e_stat_str(&pf->hw, ret), +						 i40e_aq_str(&pf->hw, aq_err));  			}  		}  		if (num_del) { -			aq_ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, +			ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid,  						     del_list, num_del, NULL); +			aq_err = pf->hw.aq.asq_last_status;  			num_del = 0; -			if (aq_ret && -			    pf->hw.aq.asq_last_status != I40E_AQ_RC_ENOENT) +			if (ret && aq_err != I40E_AQ_RC_ENOENT)  				dev_info(&pf->pdev->dev, -					 "ignoring delete macvlan error, err %d, aq_err %d\n", -					 aq_ret, pf->hw.aq.asq_last_status); +					 "ignoring delete macvlan error, err %s aq_err %s\n", +					 i40e_stat_str(&pf->hw, ret), +					 i40e_aq_str(&pf->hw, aq_err));  		}  		kfree(del_list); @@ -1833,29 +1881,31 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)  			/* flush a full buffer */  			if (num_add == filter_list_len) { -				aq_ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, -							     add_list, num_add, -							     NULL); +				ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, +							  add_list, num_add, +							  NULL); +				aq_err = pf->hw.aq.asq_last_status;  				num_add = 0; -				if (aq_ret) +				if (ret)  					break;  				memset(add_list, 0, sizeof(*add_list));  			}  		}  		if (num_add) { -			aq_ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, -						     add_list, num_add, NULL); +			ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, +						  add_list, num_add, NULL); +			aq_err = pf->hw.aq.asq_last_status;  			num_add = 0;  		}  		kfree(add_list);  		add_list = NULL; -		if (add_happened && aq_ret && -		    pf->hw.aq.asq_last_status != I40E_AQ_RC_EINVAL) { +		if (add_happened && ret && aq_err != I40E_AQ_RC_EINVAL) {  			dev_info(&pf->pdev->dev, -				 "add filter failed, err %d, aq_err %d\n", -				 aq_ret, pf->hw.aq.asq_last_status); +				 "add filter failed, err %s aq_err %s\n", +				 i40e_stat_str(&pf->hw, ret), +				 i40e_aq_str(&pf->hw, aq_err));  			if ((pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOSPC) &&  			    !test_bit(__I40E_FILTER_OVERFLOW_PROMISC,  				      &vsi->state)) { @@ -1871,34 +1921,60 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)  	if (changed_flags & IFF_ALLMULTI) {  		bool cur_multipromisc;  		cur_multipromisc = !!(vsi->current_netdev_flags & IFF_ALLMULTI); -		aq_ret = i40e_aq_set_vsi_multicast_promiscuous(&vsi->back->hw, -							       vsi->seid, -							       cur_multipromisc, -							       NULL); -		if (aq_ret) +		ret = i40e_aq_set_vsi_multicast_promiscuous(&vsi->back->hw, +							    vsi->seid, +							    cur_multipromisc, +							    NULL); +		if (ret)  			dev_info(&pf->pdev->dev, -				 "set multi promisc failed, err %d, aq_err %d\n", -				 aq_ret, pf->hw.aq.asq_last_status); +				 "set multi promisc failed, err %s aq_err %s\n", +				 i40e_stat_str(&pf->hw, ret), +				 i40e_aq_str(&pf->hw, +					     pf->hw.aq.asq_last_status));  	}  	if ((changed_flags & IFF_PROMISC) || promisc_forced_on) {  		bool cur_promisc;  		cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) ||  			       test_bit(__I40E_FILTER_OVERFLOW_PROMISC,  					&vsi->state)); -		aq_ret = i40e_aq_set_vsi_unicast_promiscuous(&vsi->back->hw, -							     vsi->seid, -							     cur_promisc, NULL); -		if (aq_ret) -			dev_info(&pf->pdev->dev, -				 "set uni promisc failed, err %d, aq_err %d\n", -				 aq_ret, pf->hw.aq.asq_last_status); -		aq_ret = i40e_aq_set_vsi_broadcast(&vsi->back->hw, -						   vsi->seid, -						   cur_promisc, NULL); -		if (aq_ret) +		if (vsi->type == I40E_VSI_MAIN && pf->lan_veb != I40E_NO_VEB) { +			/* set defport ON for Main VSI instead of true promisc +			 * this way we will get all unicast/multicast and VLAN +			 * promisc behavior but will not get VF or VMDq traffic +			 * replicated on the Main VSI. +			 */ +			if (pf->cur_promisc != cur_promisc) { +				pf->cur_promisc = cur_promisc; +				i40e_do_reset_safe(pf, +						BIT(__I40E_PF_RESET_REQUESTED)); +			} +		} else { +			ret = i40e_aq_set_vsi_unicast_promiscuous( +							  &vsi->back->hw, +							  vsi->seid, +							  cur_promisc, NULL); +			if (ret) +				dev_info(&pf->pdev->dev, +					 "set unicast promisc failed, err %d, aq_err %d\n", +					 ret, pf->hw.aq.asq_last_status); +			ret = i40e_aq_set_vsi_multicast_promiscuous( +							  &vsi->back->hw, +							  vsi->seid, +							  cur_promisc, NULL); +			if (ret) +				dev_info(&pf->pdev->dev, +					 "set multicast promisc failed, err %d, aq_err %d\n", +					 ret, pf->hw.aq.asq_last_status); +		} +		ret = i40e_aq_set_vsi_broadcast(&vsi->back->hw, +						vsi->seid, +						cur_promisc, NULL); +		if (ret)  			dev_info(&pf->pdev->dev, -				 "set brdcast promisc failed, err %d, aq_err %d\n", -				 aq_ret, pf->hw.aq.asq_last_status); +				 "set brdcast promisc failed, err %s, aq_err %s\n", +				 i40e_stat_str(&pf->hw, ret), +				 i40e_aq_str(&pf->hw, +					     pf->hw.aq.asq_last_status));  	}  	clear_bit(__I40E_CONFIG_BUSY, &vsi->state); @@ -1994,8 +2070,10 @@ void i40e_vlan_stripping_enable(struct i40e_vsi *vsi)  	ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL);  	if (ret) {  		dev_info(&vsi->back->pdev->dev, -			 "%s: update vsi failed, aq_err=%d\n", -			 __func__, vsi->back->hw.aq.asq_last_status); +			 "update vlan stripping failed, err %s aq_err %s\n", +			 i40e_stat_str(&vsi->back->hw, ret), +			 i40e_aq_str(&vsi->back->hw, +				     vsi->back->hw.aq.asq_last_status));  	}  } @@ -2023,8 +2101,10 @@ void i40e_vlan_stripping_disable(struct i40e_vsi *vsi)  	ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL);  	if (ret) {  		dev_info(&vsi->back->pdev->dev, -			 "%s: update vsi failed, aq_err=%d\n", -			 __func__, vsi->back->hw.aq.asq_last_status); +			 "update vlan stripping failed, err %s aq_err %s\n", +			 i40e_stat_str(&vsi->back->hw, ret), +			 i40e_aq_str(&vsi->back->hw, +				     vsi->back->hw.aq.asq_last_status));  	}  } @@ -2294,7 +2374,7 @@ static void i40e_restore_vlan(struct i40e_vsi *vsi)  int i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid)  {  	struct i40e_vsi_context ctxt; -	i40e_status aq_ret; +	i40e_status ret;  	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);  	vsi->info.pvid = cpu_to_le16(vid); @@ -2304,11 +2384,13 @@ int i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid)  	ctxt.seid = vsi->seid;  	ctxt.info = vsi->info; -	aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); -	if (aq_ret) { +	ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); +	if (ret) {  		dev_info(&vsi->back->pdev->dev, -			 "%s: update vsi failed, aq_err=%d\n", -			 __func__, vsi->back->hw.aq.asq_last_status); +			 "add pvid failed, err %s aq_err %s\n", +			 i40e_stat_str(&vsi->back->hw, ret), +			 i40e_aq_str(&vsi->back->hw, +				     vsi->back->hw.aq.asq_last_status));  		return -ENOENT;  	} @@ -2696,9 +2778,9 @@ static int i40e_vsi_configure_rx(struct i40e_vsi *vsi)  #endif /* I40E_FCOE */  	/* round up for the chip's needs */  	vsi->rx_hdr_len = ALIGN(vsi->rx_hdr_len, -				(1 << I40E_RXQ_CTX_HBUFF_SHIFT)); +				BIT_ULL(I40E_RXQ_CTX_HBUFF_SHIFT));  	vsi->rx_buf_len = ALIGN(vsi->rx_buf_len, -				(1 << I40E_RXQ_CTX_DBUFF_SHIFT)); +				BIT_ULL(I40E_RXQ_CTX_DBUFF_SHIFT));  	/* set up individual rings */  	for (i = 0; i < vsi->num_queue_pairs && !err; i++) @@ -2728,7 +2810,7 @@ static void i40e_vsi_config_dcb_rings(struct i40e_vsi *vsi)  	}  	for (n = 0; n < I40E_MAX_TRAFFIC_CLASS; n++) { -		if (!(vsi->tc_config.enabled_tc & (1 << n))) +		if (!(vsi->tc_config.enabled_tc & BIT_ULL(n)))  			continue;  		qoffset = vsi->tc_config.tc_info[n].qoffset; @@ -2877,6 +2959,9 @@ static void i40e_enable_misc_int_causes(struct i40e_pf *pf)  	      I40E_PFINT_ICR0_ENA_VFLR_MASK          |  	      I40E_PFINT_ICR0_ENA_ADMINQ_MASK; +	if (pf->flags & I40E_FLAG_IWARP_ENABLED) +		val |= I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK; +  	if (pf->flags & I40E_FLAG_PTP)  		val |= I40E_PFINT_ICR0_ENA_TIMESYNC_MASK; @@ -3167,6 +3252,13 @@ static irqreturn_t i40e_intr(int irq, void *data)  	    (icr0 & I40E_PFINT_ICR0_SWINT_MASK))  		pf->sw_int_count++; +	if ((pf->flags & I40E_FLAG_IWARP_ENABLED) && +	    (ena_mask & I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK)) { +		ena_mask &= ~I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK; +		icr0 &= ~I40E_PFINT_ICR0_ENA_PE_CRITERR_MASK; +		dev_info(&pf->pdev->dev, "cleared PE_CRITERR\n"); +	} +  	/* only q0 is used in MSI/Legacy mode, and none are used in MSIX */  	if (icr0 & I40E_PFINT_ICR0_QUEUE_0_MASK) { @@ -3373,7 +3465,7 @@ static irqreturn_t i40e_fdir_clean_ring(int irq, void *data)   * @v_idx: vector index   * @qp_idx: queue pair index   **/ -static void map_vector_to_qp(struct i40e_vsi *vsi, int v_idx, int qp_idx) +static void i40e_map_vector_to_qp(struct i40e_vsi *vsi, int v_idx, int qp_idx)  {  	struct i40e_q_vector *q_vector = vsi->q_vectors[v_idx];  	struct i40e_ring *tx_ring = vsi->tx_rings[qp_idx]; @@ -3427,7 +3519,7 @@ static void i40e_vsi_map_rings_to_vectors(struct i40e_vsi *vsi)  		q_vector->tx.ring = NULL;  		while (num_ringpairs--) { -			map_vector_to_qp(vsi, v_start, qp_idx); +			i40e_map_vector_to_qp(vsi, v_start, qp_idx);  			qp_idx++;  			qp_remaining--;  		} @@ -3929,6 +4021,7 @@ static void i40e_vsi_close(struct i40e_vsi *vsi)  	i40e_vsi_free_irq(vsi);  	i40e_vsi_free_tx_resources(vsi);  	i40e_vsi_free_rx_resources(vsi); +	vsi->current_netdev_flags = 0;  }  /** @@ -4073,7 +4166,7 @@ static u8 i40e_get_iscsi_tc_map(struct i40e_pf *pf)  		if (app.selector == I40E_APP_SEL_TCPIP &&  		    app.protocolid == I40E_APP_PROTOID_ISCSI) {  			tc = dcbcfg->etscfg.prioritytable[app.priority]; -			enabled_tc |= (1 << tc); +			enabled_tc |= BIT_ULL(tc);  			break;  		}  	} @@ -4122,7 +4215,7 @@ static u8 i40e_dcb_get_enabled_tc(struct i40e_dcbx_config *dcbcfg)  	u8 i;  	for (i = 0; i < num_tc; i++) -		enabled_tc |= 1 << i; +		enabled_tc |= BIT(i);  	return enabled_tc;  } @@ -4157,7 +4250,7 @@ static u8 i40e_pf_get_num_tc(struct i40e_pf *pf)  	/* At least have TC0 */  	enabled_tc = (enabled_tc ? enabled_tc : 0x1);  	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { -		if (enabled_tc & (1 << i)) +		if (enabled_tc & BIT_ULL(i))  			num_tc++;  	}  	return num_tc; @@ -4179,11 +4272,11 @@ static u8 i40e_pf_get_default_tc(struct i40e_pf *pf)  	/* Find the first enabled TC */  	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { -		if (enabled_tc & (1 << i)) +		if (enabled_tc & BIT_ULL(i))  			break;  	} -	return 1 << i; +	return BIT(i);  }  /** @@ -4221,26 +4314,28 @@ static int i40e_vsi_get_bw_info(struct i40e_vsi *vsi)  	struct i40e_aqc_query_vsi_bw_config_resp bw_config = {0};  	struct i40e_pf *pf = vsi->back;  	struct i40e_hw *hw = &pf->hw; -	i40e_status aq_ret; +	i40e_status ret;  	u32 tc_bw_max;  	int i;  	/* Get the VSI level BW configuration */ -	aq_ret = i40e_aq_query_vsi_bw_config(hw, vsi->seid, &bw_config, NULL); -	if (aq_ret) { +	ret = i40e_aq_query_vsi_bw_config(hw, vsi->seid, &bw_config, NULL); +	if (ret) {  		dev_info(&pf->pdev->dev, -			 "couldn't get PF vsi bw config, err %d, aq_err %d\n", -			 aq_ret, pf->hw.aq.asq_last_status); +			 "couldn't get PF vsi bw config, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		return -EINVAL;  	}  	/* Get the VSI level BW configuration per TC */ -	aq_ret = i40e_aq_query_vsi_ets_sla_config(hw, vsi->seid, &bw_ets_config, -						  NULL); -	if (aq_ret) { +	ret = i40e_aq_query_vsi_ets_sla_config(hw, vsi->seid, &bw_ets_config, +					       NULL); +	if (ret) {  		dev_info(&pf->pdev->dev, -			 "couldn't get PF vsi ets bw config, err %d, aq_err %d\n", -			 aq_ret, pf->hw.aq.asq_last_status); +			 "couldn't get PF vsi ets bw config, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		return -EINVAL;  	} @@ -4279,16 +4374,16 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc,  				       u8 *bw_share)  {  	struct i40e_aqc_configure_vsi_tc_bw_data bw_data; -	i40e_status aq_ret; +	i40e_status ret;  	int i;  	bw_data.tc_valid_bits = enabled_tc;  	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)  		bw_data.tc_bw_credits[i] = bw_share[i]; -	aq_ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, &bw_data, -					  NULL); -	if (aq_ret) { +	ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, &bw_data, +				       NULL); +	if (ret) {  		dev_info(&vsi->back->pdev->dev,  			 "AQ command Config VSI BW allocation per TC failed = %d\n",  			 vsi->back->hw.aq.asq_last_status); @@ -4337,7 +4432,7 @@ static void i40e_vsi_config_netdev_tc(struct i40e_vsi *vsi, u8 enabled_tc)  		 * will set the numtc for netdev as 2 that will be  		 * referenced by the netdev layer as TC 0 and 1.  		 */ -		if (vsi->tc_config.enabled_tc & (1 << i)) +		if (vsi->tc_config.enabled_tc & BIT_ULL(i))  			netdev_set_tc_queue(netdev,  					vsi->tc_config.tc_info[i].netdev_tc,  					vsi->tc_config.tc_info[i].qcount, @@ -4399,7 +4494,7 @@ static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc)  	/* Enable ETS TCs with equal BW Share for now across all VSIs */  	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { -		if (enabled_tc & (1 << i)) +		if (enabled_tc & BIT_ULL(i))  			bw_share[i] = 1;  	} @@ -4423,8 +4518,10 @@ static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc)  	ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL);  	if (ret) {  		dev_info(&vsi->back->pdev->dev, -			 "update vsi failed, aq_err=%d\n", -			 vsi->back->hw.aq.asq_last_status); +			 "Update vsi tc config failed, err %s aq_err %s\n", +			 i40e_stat_str(&vsi->back->hw, ret), +			 i40e_aq_str(&vsi->back->hw, +				     vsi->back->hw.aq.asq_last_status));  		goto out;  	}  	/* update the local VSI info with updated queue map */ @@ -4435,8 +4532,10 @@ static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc)  	ret = i40e_vsi_get_bw_info(vsi);  	if (ret) {  		dev_info(&vsi->back->pdev->dev, -			 "Failed updating vsi bw info, aq_err=%d\n", -			 vsi->back->hw.aq.asq_last_status); +			 "Failed updating vsi bw info, err %s aq_err %s\n", +			 i40e_stat_str(&vsi->back->hw, ret), +			 i40e_aq_str(&vsi->back->hw, +				     vsi->back->hw.aq.asq_last_status));  		goto out;  	} @@ -4469,7 +4568,7 @@ int i40e_veb_config_tc(struct i40e_veb *veb, u8 enabled_tc)  	/* Enable ETS TCs with equal BW Share for now */  	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { -		if (enabled_tc & (1 << i)) +		if (enabled_tc & BIT_ULL(i))  			bw_data.tc_bw_share_credits[i] = 1;  	} @@ -4477,8 +4576,9 @@ int i40e_veb_config_tc(struct i40e_veb *veb, u8 enabled_tc)  						   &bw_data, NULL);  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "veb bw config failed, aq_err=%d\n", -			 pf->hw.aq.asq_last_status); +			 "VEB bw config failed, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		goto out;  	} @@ -4486,8 +4586,9 @@ int i40e_veb_config_tc(struct i40e_veb *veb, u8 enabled_tc)  	ret = i40e_veb_get_bw_info(veb);  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "Failed getting veb bw config, aq_err=%d\n", -			 pf->hw.aq.asq_last_status); +			 "Failed getting veb bw config, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  	}  out: @@ -4574,8 +4675,9 @@ static int i40e_resume_port_tx(struct i40e_pf *pf)  	ret = i40e_aq_resume_port_tx(hw, NULL);  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "AQ command Resume Port Tx failed = %d\n", -			  pf->hw.aq.asq_last_status); +			 "Resume Port Tx failed, err %s aq_err %s\n", +			  i40e_stat_str(&pf->hw, ret), +			  i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		/* Schedule PF reset to recover */  		set_bit(__I40E_PF_RESET_REQUESTED, &pf->state);  		i40e_service_event_schedule(pf); @@ -4627,8 +4729,9 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)  		}  	} else {  		dev_info(&pf->pdev->dev, -			 "AQ Querying DCB configuration failed: aq_err %d\n", -			 pf->hw.aq.asq_last_status); +			 "Query for DCB configuration failed, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, err), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  	}  out: @@ -4859,7 +4962,7 @@ static int i40e_setup_tc(struct net_device *netdev, u8 tc)  	/* Generate TC map for number of tc requested */  	for (i = 0; i < tc; i++) -		enabled_tc |= (1 << i); +		enabled_tc |= BIT_ULL(i);  	/* Requesting same TC configuration as already enabled */  	if (enabled_tc == vsi->tc_config.enabled_tc) @@ -4998,7 +5101,7 @@ err_setup_rx:  err_setup_tx:  	i40e_vsi_free_tx_resources(vsi);  	if (vsi == pf->vsi[pf->lan_vsi]) -		i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED)); +		i40e_do_reset(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED));  	return err;  } @@ -5066,7 +5169,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)  		i40e_vc_notify_reset(pf);  	/* do the biggest reset indicated */ -	if (reset_flags & (1 << __I40E_GLOBAL_RESET_REQUESTED)) { +	if (reset_flags & BIT_ULL(__I40E_GLOBAL_RESET_REQUESTED)) {  		/* Request a Global Reset  		 * @@ -5081,7 +5184,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)  		val |= I40E_GLGEN_RTRIG_GLOBR_MASK;  		wr32(&pf->hw, I40E_GLGEN_RTRIG, val); -	} else if (reset_flags & (1 << __I40E_CORE_RESET_REQUESTED)) { +	} else if (reset_flags & BIT_ULL(__I40E_CORE_RESET_REQUESTED)) {  		/* Request a Core Reset  		 * @@ -5093,7 +5196,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)  		wr32(&pf->hw, I40E_GLGEN_RTRIG, val);  		i40e_flush(&pf->hw); -	} else if (reset_flags & (1 << __I40E_PF_RESET_REQUESTED)) { +	} else if (reset_flags & BIT_ULL(__I40E_PF_RESET_REQUESTED)) {  		/* Request a PF Reset  		 * @@ -5106,7 +5209,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)  		dev_dbg(&pf->pdev->dev, "PFR requested\n");  		i40e_handle_reset_warning(pf); -	} else if (reset_flags & (1 << __I40E_REINIT_REQUESTED)) { +	} else if (reset_flags & BIT_ULL(__I40E_REINIT_REQUESTED)) {  		int v;  		/* Find the VSI(s) that requested a re-init */ @@ -5123,7 +5226,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)  		/* no further action needed, so return now */  		return; -	} else if (reset_flags & (1 << __I40E_DOWN_REQUESTED)) { +	} else if (reset_flags & BIT_ULL(__I40E_DOWN_REQUESTED)) {  		int v;  		/* Find the VSI(s) that needs to be brought down */ @@ -5253,7 +5356,10 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,  	/* Get updated DCBX data from firmware */  	ret = i40e_get_dcb_config(&pf->hw);  	if (ret) { -		dev_info(&pf->pdev->dev, "Failed querying DCB configuration data from firmware.\n"); +		dev_info(&pf->pdev->dev, +			 "Failed querying DCB configuration data from firmware, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		goto exit;  	} @@ -5761,23 +5867,23 @@ static void i40e_reset_subtask(struct i40e_pf *pf)  	rtnl_lock();  	if (test_bit(__I40E_REINIT_REQUESTED, &pf->state)) { -		reset_flags |= (1 << __I40E_REINIT_REQUESTED); +		reset_flags |= BIT_ULL(__I40E_REINIT_REQUESTED);  		clear_bit(__I40E_REINIT_REQUESTED, &pf->state);  	}  	if (test_bit(__I40E_PF_RESET_REQUESTED, &pf->state)) { -		reset_flags |= (1 << __I40E_PF_RESET_REQUESTED); +		reset_flags |= BIT_ULL(__I40E_PF_RESET_REQUESTED);  		clear_bit(__I40E_PF_RESET_REQUESTED, &pf->state);  	}  	if (test_bit(__I40E_CORE_RESET_REQUESTED, &pf->state)) { -		reset_flags |= (1 << __I40E_CORE_RESET_REQUESTED); +		reset_flags |= BIT_ULL(__I40E_CORE_RESET_REQUESTED);  		clear_bit(__I40E_CORE_RESET_REQUESTED, &pf->state);  	}  	if (test_bit(__I40E_GLOBAL_RESET_REQUESTED, &pf->state)) { -		reset_flags |= (1 << __I40E_GLOBAL_RESET_REQUESTED); +		reset_flags |= BIT_ULL(__I40E_GLOBAL_RESET_REQUESTED);  		clear_bit(__I40E_GLOBAL_RESET_REQUESTED, &pf->state);  	}  	if (test_bit(__I40E_DOWN_REQUESTED, &pf->state)) { -		reset_flags |= (1 << __I40E_DOWN_REQUESTED); +		reset_flags |= BIT_ULL(__I40E_DOWN_REQUESTED);  		clear_bit(__I40E_DOWN_REQUESTED, &pf->state);  	} @@ -5983,27 +6089,29 @@ static void i40e_enable_pf_switch_lb(struct i40e_pf *pf)  {  	struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];  	struct i40e_vsi_context ctxt; -	int aq_ret; +	int ret;  	ctxt.seid = pf->main_vsi_seid;  	ctxt.pf_num = pf->hw.pf_id;  	ctxt.vf_num = 0; -	aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); -	if (aq_ret) { +	ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); +	if (ret) {  		dev_info(&pf->pdev->dev, -			 "%s couldn't get PF vsi config, err %d, aq_err %d\n", -			 __func__, aq_ret, pf->hw.aq.asq_last_status); +			 "couldn't get PF vsi config, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		return;  	}  	ctxt.flags = I40E_AQ_VSI_TYPE_PF;  	ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);  	ctxt.info.switch_id |= cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); -	aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); -	if (aq_ret) { +	ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); +	if (ret) {  		dev_info(&pf->pdev->dev, -			 "%s: update vsi switch failed, aq_err=%d\n", -			 __func__, vsi->back->hw.aq.asq_last_status); +			 "update vsi switch failed, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  	}  } @@ -6017,27 +6125,29 @@ static void i40e_disable_pf_switch_lb(struct i40e_pf *pf)  {  	struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];  	struct i40e_vsi_context ctxt; -	int aq_ret; +	int ret;  	ctxt.seid = pf->main_vsi_seid;  	ctxt.pf_num = pf->hw.pf_id;  	ctxt.vf_num = 0; -	aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); -	if (aq_ret) { +	ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL); +	if (ret) {  		dev_info(&pf->pdev->dev, -			 "%s couldn't get PF vsi config, err %d, aq_err %d\n", -			 __func__, aq_ret, pf->hw.aq.asq_last_status); +			 "couldn't get PF vsi config, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		return;  	}  	ctxt.flags = I40E_AQ_VSI_TYPE_PF;  	ctxt.info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);  	ctxt.info.switch_id &= ~cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); -	aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); -	if (aq_ret) { +	ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); +	if (ret) {  		dev_info(&pf->pdev->dev, -			 "%s: update vsi switch failed, aq_err=%d\n", -			 __func__, vsi->back->hw.aq.asq_last_status); +			 "update vsi switch failed, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  	}  } @@ -6097,7 +6207,8 @@ static int i40e_reconstitute_veb(struct i40e_veb *veb)  	ret = i40e_add_vsi(ctl_vsi);  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "rebuild of owner VSI failed: %d\n", ret); +			 "rebuild of veb_idx %d owner VSI failed: %d\n", +			 veb->idx, ret);  		goto end_reconstitute;  	}  	i40e_vsi_reset_stats(ctl_vsi); @@ -6176,8 +6287,10 @@ static int i40e_get_capabilities(struct i40e_pf *pf)  			buf_len = data_size;  		} else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK) {  			dev_info(&pf->pdev->dev, -				 "capability discovery failed: aq=%d\n", -				 pf->hw.aq.asq_last_status); +				 "capability discovery failed, err %s aq_err %s\n", +				 i40e_stat_str(&pf->hw, err), +				 i40e_aq_str(&pf->hw, +					     pf->hw.aq.asq_last_status));  			return -ENODEV;  		}  	} while (err); @@ -6363,7 +6476,9 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)  	/* rebuild the basics for the AdminQ, HMC, and initial HW switch */  	ret = i40e_init_adminq(&pf->hw);  	if (ret) { -		dev_info(&pf->pdev->dev, "Rebuild AdminQ failed, %d\n", ret); +		dev_info(&pf->pdev->dev, "Rebuild AdminQ failed, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		goto clear_recovery;  	} @@ -6373,11 +6488,8 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)  	i40e_clear_pxe_mode(hw);  	ret = i40e_get_capabilities(pf); -	if (ret) { -		dev_info(&pf->pdev->dev, "i40e_get_capabilities failed, %d\n", -			 ret); +	if (ret)  		goto end_core_reset; -	}  	ret = i40e_init_lan_hmc(hw, hw->func_caps.num_tx_qp,  				hw->func_caps.num_rx_qp, @@ -6418,12 +6530,16 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)  				       I40E_AQ_EVENT_LINK_UPDOWN |  				       I40E_AQ_EVENT_MODULE_QUAL_FAIL, NULL);  	if (ret) -		dev_info(&pf->pdev->dev, "set phy mask fail, aq_err %d\n", ret); +		dev_info(&pf->pdev->dev, "set phy mask fail, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  	/* make sure our flow control settings are restored */  	ret = i40e_set_fc(&pf->hw, &set_fc_aq_fail, true);  	if (ret) -		dev_info(&pf->pdev->dev, "set fc fail, aq_err %d\n", ret); +		dev_info(&pf->pdev->dev, "set fc fail, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  	/* Rebuild the VSIs and VEBs that existed before reset.  	 * They are still in our local switch element arrays, so only @@ -6484,8 +6600,10 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)  		msleep(75);  		ret = i40e_aq_set_link_restart_an(&pf->hw, true, NULL);  		if (ret) -			dev_info(&pf->pdev->dev, "link restart failed, aq_err=%d\n", -				 pf->hw.aq.asq_last_status); +			dev_info(&pf->pdev->dev, "link restart failed, err %s aq_err %s\n", +				 i40e_stat_str(&pf->hw, ret), +				 i40e_aq_str(&pf->hw, +					     pf->hw.aq.asq_last_status));  	}  	/* reinit the misc interrupt */  	if (pf->flags & I40E_FLAG_MSIX_ENABLED) @@ -6647,8 +6765,8 @@ static void i40e_sync_vxlan_filters_subtask(struct i40e_pf *pf)  	pf->flags &= ~I40E_FLAG_VXLAN_FILTER_SYNC;  	for (i = 0; i < I40E_MAX_PF_UDP_OFFLOAD_PORTS; i++) { -		if (pf->pending_vxlan_bitmap & (1 << i)) { -			pf->pending_vxlan_bitmap &= ~(1 << i); +		if (pf->pending_vxlan_bitmap & BIT_ULL(i)) { +			pf->pending_vxlan_bitmap &= ~BIT_ULL(i);  			port = pf->vxlan_ports[i];  			if (port)  				ret = i40e_aq_add_udp_tunnel(hw, ntohs(port), @@ -6659,10 +6777,12 @@ static void i40e_sync_vxlan_filters_subtask(struct i40e_pf *pf)  			if (ret) {  				dev_info(&pf->pdev->dev, -					 "%s vxlan port %d, index %d failed, err %d, aq_err %d\n", +					 "%s vxlan port %d, index %d failed, err %s aq_err %s\n",  					 port ? "add" : "delete", -					 ntohs(port), i, ret, -					 pf->hw.aq.asq_last_status); +					 ntohs(port), i, +					 i40e_stat_str(&pf->hw, ret), +					 i40e_aq_str(&pf->hw, +						    pf->hw.aq.asq_last_status));  				pf->vxlan_ports[i] = 0;  			}  		} @@ -7013,6 +7133,10 @@ static int i40e_alloc_rings(struct i40e_vsi *vsi)  		tx_ring->count = vsi->num_desc;  		tx_ring->size = 0;  		tx_ring->dcb_tc = 0; +		if (vsi->back->flags & I40E_FLAG_WB_ON_ITR_CAPABLE) +			tx_ring->flags = I40E_TXR_FLAGS_WB_ON_ITR; +		if (vsi->back->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE) +			tx_ring->flags |= I40E_TXR_FLAGS_OUTER_UDP_CSUM;  		vsi->tx_rings[i] = tx_ring;  		rx_ring = &tx_ring[1]; @@ -7411,62 +7535,139 @@ static int i40e_setup_misc_vector(struct i40e_pf *pf)  }  /** - * i40e_config_rss - Prepare for RSS if used + * i40e_config_rss_aq - Prepare for RSS using AQ commands + * @vsi: vsi structure + * @seed: RSS hash seed + **/ +static int i40e_config_rss_aq(struct i40e_vsi *vsi, const u8 *seed) +{ +	struct i40e_aqc_get_set_rss_key_data rss_key; +	struct i40e_pf *pf = vsi->back; +	struct i40e_hw *hw = &pf->hw; +	bool pf_lut = false; +	u8 *rss_lut; +	int ret, i; + +	memset(&rss_key, 0, sizeof(rss_key)); +	memcpy(&rss_key, seed, sizeof(rss_key)); + +	rss_lut = kzalloc(pf->rss_table_size, GFP_KERNEL); +	if (!rss_lut) +		return -ENOMEM; + +	/* Populate the LUT with max no. of queues in round robin fashion */ +	for (i = 0; i < vsi->rss_table_size; i++) +		rss_lut[i] = i % vsi->rss_size; + +	ret = i40e_aq_set_rss_key(hw, vsi->id, &rss_key); +	if (ret) { +		dev_info(&pf->pdev->dev, +			 "Cannot set RSS key, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); +		return ret; +	} + +	if (vsi->type == I40E_VSI_MAIN) +		pf_lut = true; + +	ret = i40e_aq_set_rss_lut(hw, vsi->id, pf_lut, rss_lut, +				  vsi->rss_table_size); +	if (ret) +		dev_info(&pf->pdev->dev, +			 "Cannot set RSS lut, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); + +	return ret; +} + +/** + * i40e_vsi_config_rss - Prepare for VSI(VMDq) RSS if used + * @vsi: VSI structure + **/ +static int i40e_vsi_config_rss(struct i40e_vsi *vsi) +{ +	u8 seed[I40E_HKEY_ARRAY_SIZE]; +	struct i40e_pf *pf = vsi->back; + +	netdev_rss_key_fill((void *)seed, I40E_HKEY_ARRAY_SIZE); +	vsi->rss_size = min_t(int, pf->rss_size, vsi->num_queue_pairs); + +	if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE) +		return i40e_config_rss_aq(vsi, seed); + +	return 0; +} + +/** + * i40e_config_rss_reg - Prepare for RSS if used   * @pf: board private structure + * @seed: RSS hash seed   **/ -static int i40e_config_rss(struct i40e_pf *pf) +static int i40e_config_rss_reg(struct i40e_pf *pf, const u8 *seed)  { -	u32 rss_key[I40E_PFQF_HKEY_MAX_INDEX + 1];  	struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];  	struct i40e_hw *hw = &pf->hw; +	u32 *seed_dw = (u32 *)seed; +	u32 current_queue = 0;  	u32 lut = 0;  	int i, j; -	u64 hena; -	u32 reg_val; -	netdev_rss_key_fill(rss_key, sizeof(rss_key)); +	/* Fill out hash function seed */  	for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) -		wr32(hw, I40E_PFQF_HKEY(i), rss_key[i]); +		wr32(hw, I40E_PFQF_HKEY(i), seed_dw[i]); + +	for (i = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) { +		lut = 0; +		for (j = 0; j < 4; j++) { +			if (current_queue == vsi->rss_size) +				current_queue = 0; +			lut |= ((current_queue) << (8 * j)); +			current_queue++; +		} +		wr32(&pf->hw, I40E_PFQF_HLUT(i), lut); +	} +	i40e_flush(hw); + +	return 0; +} + +/** + * i40e_config_rss - Prepare for RSS if used + * @pf: board private structure + **/ +static int i40e_config_rss(struct i40e_pf *pf) +{ +	struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; +	u8 seed[I40E_HKEY_ARRAY_SIZE]; +	struct i40e_hw *hw = &pf->hw; +	u32 reg_val; +	u64 hena; + +	netdev_rss_key_fill((void *)seed, I40E_HKEY_ARRAY_SIZE);  	/* By default we enable TCP/UDP with IPv4/IPv6 ptypes */  	hena = (u64)rd32(hw, I40E_PFQF_HENA(0)) |  		((u64)rd32(hw, I40E_PFQF_HENA(1)) << 32); -	hena |= I40E_DEFAULT_RSS_HENA; +	hena |= i40e_pf_get_default_rss_hena(pf); +  	wr32(hw, I40E_PFQF_HENA(0), (u32)hena);  	wr32(hw, I40E_PFQF_HENA(1), (u32)(hena >> 32));  	vsi->rss_size = min_t(int, pf->rss_size, vsi->num_queue_pairs); -	/* Check capability and Set table size and register per hw expectation*/ +	/* Determine the RSS table size based on the hardware capabilities */  	reg_val = rd32(hw, I40E_PFQF_CTL_0); -	if (pf->rss_table_size == 512) -		reg_val |= I40E_PFQF_CTL_0_HASHLUTSIZE_512; -	else -		reg_val &= ~I40E_PFQF_CTL_0_HASHLUTSIZE_512; +	reg_val = (pf->rss_table_size == 512) ? +			(reg_val | I40E_PFQF_CTL_0_HASHLUTSIZE_512) : +			(reg_val & ~I40E_PFQF_CTL_0_HASHLUTSIZE_512);  	wr32(hw, I40E_PFQF_CTL_0, reg_val); -	/* Populate the LUT with max no. of queues in round robin fashion */ -	for (i = 0, j = 0; i < pf->rss_table_size; i++, j++) { - -		/* The assumption is that lan qp count will be the highest -		 * qp count for any PF VSI that needs RSS. -		 * If multiple VSIs need RSS support, all the qp counts -		 * for those VSIs should be a power of 2 for RSS to work. -		 * If LAN VSI is the only consumer for RSS then this requirement -		 * is not necessary. -		 */ -		if (j == vsi->rss_size) -			j = 0; -		/* lut = 4-byte sliding window of 4 lut entries */ -		lut = (lut << 8) | (j & -			 ((0x1 << pf->hw.func_caps.rss_table_entry_width) - 1)); -		/* On i = 3, we have 4 entries in lut; write to the register */ -		if ((i & 3) == 3) -			wr32(hw, I40E_PFQF_HLUT(i >> 2), lut); -	} -	i40e_flush(hw); - -	return 0; +	if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE) +		return i40e_config_rss_aq(pf->vsi[pf->lan_vsi], seed); +	else +		return i40e_config_rss_reg(pf, seed);  }  /** @@ -7533,7 +7734,7 @@ i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf)  	i40e_status status;  	/* Set the valid bit for this PF */ -	bw_data.pf_valid_bits = cpu_to_le16(1 << pf->hw.pf_id); +	bw_data.pf_valid_bits = cpu_to_le16(BIT(pf->hw.pf_id));  	bw_data.max_bw[pf->hw.pf_id] = pf->npar_max_bw & I40E_ALT_BW_VALUE_MASK;  	bw_data.min_bw[pf->hw.pf_id] = pf->npar_min_bw & I40E_ALT_BW_VALUE_MASK; @@ -7567,8 +7768,9 @@ i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf)  	last_aq_status = pf->hw.aq.asq_last_status;  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "Cannot acquire NVM for read access, err %d: aq_err %d\n", -			 ret, last_aq_status); +			 "Cannot acquire NVM for read access, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, last_aq_status));  		goto bw_commit_out;  	} @@ -7583,8 +7785,9 @@ i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf)  	last_aq_status = pf->hw.aq.asq_last_status;  	i40e_release_nvm(&pf->hw);  	if (ret) { -		dev_info(&pf->pdev->dev, "NVM read error, err %d aq_err %d\n", -			 ret, last_aq_status); +		dev_info(&pf->pdev->dev, "NVM read error, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, last_aq_status));  		goto bw_commit_out;  	} @@ -7596,8 +7799,9 @@ i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf)  	last_aq_status = pf->hw.aq.asq_last_status;  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "Cannot acquire NVM for write access, err %d: aq_err %d\n", -			 ret, last_aq_status); +			 "Cannot acquire NVM for write access, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, last_aq_status));  		goto bw_commit_out;  	}  	/* Write it back out unchanged to initiate update NVM, @@ -7615,8 +7819,9 @@ i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf)  	i40e_release_nvm(&pf->hw);  	if (ret)  		dev_info(&pf->pdev->dev, -			 "BW settings NOT SAVED, err %d aq_err %d\n", -			 ret, last_aq_status); +			 "BW settings NOT SAVED, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, last_aq_status));  bw_commit_out:  	return ret; @@ -7662,7 +7867,7 @@ static int i40e_sw_init(struct i40e_pf *pf)  	/* Depending on PF configurations, it is possible that the RSS  	 * maximum might end up larger than the available queues  	 */ -	pf->rss_size_max = 0x1 << pf->hw.func_caps.rss_table_entry_width; +	pf->rss_size_max = BIT(pf->hw.func_caps.rss_table_entry_width);  	pf->rss_size = 1;  	pf->rss_table_size = pf->hw.func_caps.rss_table_size;  	pf->rss_size_max = min_t(int, pf->rss_size_max, @@ -7673,7 +7878,7 @@ static int i40e_sw_init(struct i40e_pf *pf)  	}  	/* MFP mode enabled */ -	if (pf->hw.func_caps.npar_enable || pf->hw.func_caps.mfp_mode_1) { +	if (pf->hw.func_caps.npar_enable || pf->hw.func_caps.flex10_enable) {  		pf->flags |= I40E_FLAG_MFP_ENABLED;  		dev_info(&pf->pdev->dev, "MFP mode Enabled\n");  		if (i40e_get_npar_bw_setting(pf)) @@ -7703,9 +7908,8 @@ static int i40e_sw_init(struct i40e_pf *pf)  	}  	if (pf->hw.func_caps.vmdq) { -		pf->flags |= I40E_FLAG_VMDQ_ENABLED;  		pf->num_vmdq_vsis = I40E_DEFAULT_NUM_VMDQ_VSI; -		pf->num_vmdq_qps = I40E_DEFAULT_QUEUES_PER_VMDQ; +		pf->flags |= I40E_FLAG_VMDQ_ENABLED;  	}  #ifdef I40E_FCOE @@ -7723,6 +7927,14 @@ static int i40e_sw_init(struct i40e_pf *pf)  					I40E_MAX_VF_COUNT);  	}  #endif /* CONFIG_PCI_IOV */ +	if (pf->hw.mac.type == I40E_MAC_X722) { +		pf->flags |= I40E_FLAG_RSS_AQ_CAPABLE | +			     I40E_FLAG_128_QP_RSS_CAPABLE | +			     I40E_FLAG_HW_ATR_EVICT_CAPABLE | +			     I40E_FLAG_OUTER_UDP_CSUM_CAPABLE | +			     I40E_FLAG_WB_ON_ITR_CAPABLE | +			     I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE; +	}  	pf->eeprom_version = 0xDEAD;  	pf->lan_veb = I40E_NO_VEB;  	pf->lan_vsi = I40E_NO_VSI; @@ -7812,7 +8024,7 @@ static int i40e_set_features(struct net_device *netdev,  	need_reset = i40e_set_ntuple(pf, features);  	if (need_reset) -		i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED)); +		i40e_do_reset(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED));  	return 0;  } @@ -7875,10 +8087,8 @@ static void i40e_add_vxlan_port(struct net_device *netdev,  	/* New port: add it and mark its index in the bitmap */  	pf->vxlan_ports[next_idx] = port; -	pf->pending_vxlan_bitmap |= (1 << next_idx); +	pf->pending_vxlan_bitmap |= BIT_ULL(next_idx);  	pf->flags |= I40E_FLAG_VXLAN_FILTER_SYNC; - -	dev_info(&pf->pdev->dev, "adding vxlan port %d\n", ntohs(port));  }  /** @@ -7906,7 +8116,7 @@ static void i40e_del_vxlan_port(struct net_device *netdev,  		 * and make it pending  		 */  		pf->vxlan_ports[idx] = 0; -		pf->pending_vxlan_bitmap |= (1 << idx); +		pf->pending_vxlan_bitmap |= BIT_ULL(idx);  		pf->flags |= I40E_FLAG_VXLAN_FILTER_SYNC;  		dev_info(&pf->pdev->dev, "deleting vxlan port %d\n", @@ -7981,7 +8191,6 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],  	return err;  } -#ifdef HAVE_BRIDGE_ATTRIBS  /**   * i40e_ndo_bridge_setlink - Set the hardware bridge mode   * @dev: the netdev being configured @@ -7995,7 +8204,8 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],   * bridge mode enabled.   **/  static int i40e_ndo_bridge_setlink(struct net_device *dev, -				   struct nlmsghdr *nlh) +				   struct nlmsghdr *nlh, +				   u16 flags)  {  	struct i40e_netdev_priv *np = netdev_priv(dev);  	struct i40e_vsi *vsi = np->vsi; @@ -8066,14 +8276,9 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,   * Return the mode in which the hardware bridge is operating in   * i.e VEB or VEPA.   **/ -#ifdef HAVE_BRIDGE_FILTER  static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,  				   struct net_device *dev,  				   u32 filter_mask, int nlflags) -#else -static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, -				   struct net_device *dev, int nlflags) -#endif /* HAVE_BRIDGE_FILTER */  {  	struct i40e_netdev_priv *np = netdev_priv(dev);  	struct i40e_vsi *vsi = np->vsi; @@ -8097,7 +8302,25 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode,  				       nlflags, 0, 0, filter_mask, NULL);  } -#endif /* HAVE_BRIDGE_ATTRIBS */ + +#define I40E_MAX_TUNNEL_HDR_LEN 80 +/** + * i40e_features_check - Validate encapsulated packet conforms to limits + * @skb: skb buff + * @netdev: This physical port's netdev + * @features: Offload features that the stack believes apply + **/ +static netdev_features_t i40e_features_check(struct sk_buff *skb, +					     struct net_device *dev, +					     netdev_features_t features) +{ +	if (skb->encapsulation && +	    (skb_inner_mac_header(skb) - skb_transport_header(skb) > +	     I40E_MAX_TUNNEL_HDR_LEN)) +		return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK); + +	return features; +}  static const struct net_device_ops i40e_netdev_ops = {  	.ndo_open		= i40e_open, @@ -8133,10 +8356,9 @@ static const struct net_device_ops i40e_netdev_ops = {  #endif  	.ndo_get_phys_port_id	= i40e_get_phys_port_id,  	.ndo_fdb_add		= i40e_ndo_fdb_add, -#ifdef HAVE_BRIDGE_ATTRIBS +	.ndo_features_check	= i40e_features_check,  	.ndo_bridge_getlink	= i40e_ndo_bridge_getlink,  	.ndo_bridge_setlink	= i40e_ndo_bridge_setlink, -#endif /* HAVE_BRIDGE_ATTRIBS */  };  /** @@ -8304,8 +8526,10 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)  		ctxt.flags = I40E_AQ_VSI_TYPE_PF;  		if (ret) {  			dev_info(&pf->pdev->dev, -				 "couldn't get PF vsi config, err %d, aq_err %d\n", -				 ret, pf->hw.aq.asq_last_status); +				 "couldn't get PF vsi config, err %s aq_err %s\n", +				 i40e_stat_str(&pf->hw, ret), +				 i40e_aq_str(&pf->hw, +					     pf->hw.aq.asq_last_status));  			return -ENOENT;  		}  		vsi->info = ctxt.info; @@ -8327,8 +8551,10 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)  			ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);  			if (ret) {  				dev_info(&pf->pdev->dev, -					 "update vsi failed, aq_err=%d\n", -					 pf->hw.aq.asq_last_status); +					 "update vsi failed, err %s aq_err %s\n", +					 i40e_stat_str(&pf->hw, ret), +					 i40e_aq_str(&pf->hw, +						    pf->hw.aq.asq_last_status));  				ret = -ENOENT;  				goto err;  			} @@ -8345,9 +8571,11 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)  			ret = i40e_vsi_config_tc(vsi, enabled_tc);  			if (ret) {  				dev_info(&pf->pdev->dev, -					 "failed to configure TCs for main VSI tc_map 0x%08x, err %d, aq_err %d\n", -					 enabled_tc, ret, -					 pf->hw.aq.asq_last_status); +					 "failed to configure TCs for main VSI tc_map 0x%08x, err %s aq_err %s\n", +					 enabled_tc, +					 i40e_stat_str(&pf->hw, ret), +					 i40e_aq_str(&pf->hw, +						    pf->hw.aq.asq_last_status));  				ret = -ENOENT;  			}  		} @@ -8438,8 +8666,10 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)  		ret = i40e_aq_add_vsi(hw, &ctxt, NULL);  		if (ret) {  			dev_info(&vsi->back->pdev->dev, -				 "add vsi failed, aq_err=%d\n", -				 vsi->back->hw.aq.asq_last_status); +				 "add vsi failed, err %s aq_err %s\n", +				 i40e_stat_str(&pf->hw, ret), +				 i40e_aq_str(&pf->hw, +					     pf->hw.aq.asq_last_status));  			ret = -ENOENT;  			goto err;  		} @@ -8484,8 +8714,9 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)  	ret = i40e_vsi_get_bw_info(vsi);  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "couldn't get vsi bw info, err %d, aq_err %d\n", -			 ret, pf->hw.aq.asq_last_status); +			 "couldn't get vsi bw info, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		/* VSI is already added so not tearing that up */  		ret = 0;  	} @@ -8615,6 +8846,11 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi)  		goto vector_setup_out;  	} +	/* In Legacy mode, we do not have to get any other vector since we +	 * piggyback on the misc/ICR0 for queue interrupts. +	*/ +	if (!(pf->flags & I40E_FLAG_MSIX_ENABLED)) +		return ret;  	if (vsi->num_q_vectors)  		vsi->base_vector = i40e_get_lump(pf, pf->irq_pile,  						 vsi->num_q_vectors, vsi->idx); @@ -8658,7 +8894,7 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi)  	ret = i40e_get_lump(pf, pf->qp_pile, vsi->alloc_queue_pairs, vsi->idx);  	if (ret < 0) {  		dev_info(&pf->pdev->dev, -			 "failed to get tracking for %d queues for VSI %d err=%d\n", +			 "failed to get tracking for %d queues for VSI %d err %d\n",  			 vsi->alloc_queue_pairs, vsi->seid, ret);  		goto err_vsi;  	} @@ -8857,6 +9093,10 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,  		break;  	} +	if ((pf->flags & I40E_FLAG_RSS_AQ_CAPABLE) && +	    (vsi->type == I40E_VSI_VMDQ2)) { +		ret = i40e_vsi_config_rss(vsi); +	}  	return vsi;  err_rings: @@ -8896,8 +9136,9 @@ static int i40e_veb_get_bw_info(struct i40e_veb *veb)  						  &bw_data, NULL);  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "query veb bw config failed, aq_err=%d\n", -			 hw->aq.asq_last_status); +			 "query veb bw config failed, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, hw->aq.asq_last_status));  		goto out;  	} @@ -8905,8 +9146,9 @@ static int i40e_veb_get_bw_info(struct i40e_veb *veb)  						   &ets_data, NULL);  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "query veb bw ets config failed, aq_err=%d\n", -			 hw->aq.asq_last_status); +			 "query veb bw ets config failed, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, hw->aq.asq_last_status));  		goto out;  	} @@ -9090,36 +9332,40 @@ void i40e_veb_release(struct i40e_veb *veb)   **/  static int i40e_add_veb(struct i40e_veb *veb, struct i40e_vsi *vsi)  { -	bool is_default = false; +	struct i40e_pf *pf = veb->pf; +	bool is_default = veb->pf->cur_promisc;  	bool is_cloud = false;  	int ret;  	/* get a VEB from the hardware */ -	ret = i40e_aq_add_veb(&veb->pf->hw, veb->uplink_seid, vsi->seid, +	ret = i40e_aq_add_veb(&pf->hw, veb->uplink_seid, vsi->seid,  			      veb->enabled_tc, is_default,  			      is_cloud, &veb->seid, NULL);  	if (ret) { -		dev_info(&veb->pf->pdev->dev, -			 "couldn't add VEB, err %d, aq_err %d\n", -			 ret, veb->pf->hw.aq.asq_last_status); +		dev_info(&pf->pdev->dev, +			 "couldn't add VEB, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		return -EPERM;  	}  	/* get statistics counter */ -	ret = i40e_aq_get_veb_parameters(&veb->pf->hw, veb->seid, NULL, NULL, +	ret = i40e_aq_get_veb_parameters(&pf->hw, veb->seid, NULL, NULL,  					 &veb->stats_idx, NULL, NULL, NULL);  	if (ret) { -		dev_info(&veb->pf->pdev->dev, -			 "couldn't get VEB statistics idx, err %d, aq_err %d\n", -			 ret, veb->pf->hw.aq.asq_last_status); +		dev_info(&pf->pdev->dev, +			 "couldn't get VEB statistics idx, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		return -EPERM;  	}  	ret = i40e_veb_get_bw_info(veb);  	if (ret) { -		dev_info(&veb->pf->pdev->dev, -			 "couldn't get VEB bw info, err %d, aq_err %d\n", -			 ret, veb->pf->hw.aq.asq_last_status); -		i40e_aq_delete_element(&veb->pf->hw, veb->seid, NULL); +		dev_info(&pf->pdev->dev, +			 "couldn't get VEB bw info, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); +		i40e_aq_delete_element(&pf->hw, veb->seid, NULL);  		return -ENOENT;  	} @@ -9325,8 +9571,10 @@ int i40e_fetch_switch_configuration(struct i40e_pf *pf, bool printconfig)  						&next_seid, NULL);  		if (ret) {  			dev_info(&pf->pdev->dev, -				 "get switch config failed %d aq_err=%x\n", -				 ret, pf->hw.aq.asq_last_status); +				 "get switch config failed err %s aq_err %s\n", +				 i40e_stat_str(&pf->hw, ret), +				 i40e_aq_str(&pf->hw, +					     pf->hw.aq.asq_last_status));  			kfree(aq_buf);  			return -ENOENT;  		} @@ -9367,8 +9615,9 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)  	ret = i40e_fetch_switch_configuration(pf, false);  	if (ret) {  		dev_info(&pf->pdev->dev, -			 "couldn't fetch switch config, err %d, aq_err %d\n", -			 ret, pf->hw.aq.asq_last_status); +			 "couldn't fetch switch config, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, ret), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  		return ret;  	}  	i40e_pf_reset_stats(pf); @@ -9743,7 +9992,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)  	err = i40e_init_shared_code(hw);  	if (err) { -		dev_info(&pdev->dev, "init_shared_code failed: %d\n", err); +		dev_warn(&pdev->dev, "unidentified MAC or BLANK NVM: %d\n", +			 err);  		goto err_pf_reset;  	} @@ -9910,15 +10160,19 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)  				       I40E_AQ_EVENT_LINK_UPDOWN |  				       I40E_AQ_EVENT_MODULE_QUAL_FAIL, NULL);  	if (err) -		dev_info(&pf->pdev->dev, "set phy mask fail, aq_err %d\n", err); +		dev_info(&pf->pdev->dev, "set phy mask fail, err %s aq_err %s\n", +			 i40e_stat_str(&pf->hw, err), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  	if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||  	    (pf->hw.aq.fw_maj_ver < 4)) {  		msleep(75);  		err = i40e_aq_set_link_restart_an(&pf->hw, true, NULL);  		if (err) -			dev_info(&pf->pdev->dev, "link restart failed, aq_err=%d\n", -				 pf->hw.aq.asq_last_status); +			dev_info(&pf->pdev->dev, "link restart failed, err %s aq_err %s\n", +				 i40e_stat_str(&pf->hw, err), +				 i40e_aq_str(&pf->hw, +					     pf->hw.aq.asq_last_status));  	}  	/* The main driver is (mostly) up and happy. We need to set this state  	 * before setting up the misc vector or we get a race and the vector @@ -10006,8 +10260,10 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)  	/* get the requested speeds from the fw */  	err = i40e_aq_get_phy_capabilities(hw, false, false, &abilities, NULL);  	if (err) -		dev_info(&pf->pdev->dev, "get phy abilities failed, aq_err %d, advertised speed settings may not be correct\n", -			 err); +		dev_info(&pf->pdev->dev, +			 "get phy capabilities failed, err %s aq_err %s, advertised speed settings may not be correct\n", +			 i40e_stat_str(&pf->hw, err), +			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));  	pf->hw.phy.link_info.requested_speeds = abilities.link_speed;  	/* print a string summarizing features */ @@ -10247,6 +10503,19 @@ static void i40e_shutdown(struct pci_dev *pdev)  	wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0));  	wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); +	del_timer_sync(&pf->service_timer); +	cancel_work_sync(&pf->service_task); +	i40e_fdir_teardown(pf); + +	rtnl_lock(); +	i40e_prep_for_reset(pf); +	rtnl_unlock(); + +	wr32(hw, I40E_PFPM_APM, +	     (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); +	wr32(hw, I40E_PFPM_WUFC, +	     (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); +  	i40e_clear_interrupt_scheme(pf);  	if (system_state == SYSTEM_POWER_OFF) { @@ -10267,9 +10536,6 @@ static int i40e_suspend(struct pci_dev *pdev, pm_message_t state)  	set_bit(__I40E_SUSPENDED, &pf->state);  	set_bit(__I40E_DOWN, &pf->state); -	del_timer_sync(&pf->service_timer); -	cancel_work_sync(&pf->service_task); -	i40e_fdir_teardown(pf);  	rtnl_lock();  	i40e_prep_for_reset(pf);  |