Commit 1c43f75a authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2015-10-08

This series contains updates to i40e and i40evf only (again).

Jesse fixes an issue where the driver was issuing a WARN_ON during ring
size changes because the code was cloning the rx_ring struct but not
zeroing out the pointers before allocating new memory, so simply zero
out the pointers.  Also reduced the function call overhead by moving
the interrupt enable function by moving it to the header file, which it
in turn allows us to inline it.  Also does a thorough job of code
cleanup to fix spaces after declarations, remove unnecessary braces
and breaks, remove another __func__ use and general code tidiness.

Mitch adds mover verbose error messages when the number of supported VFs
is reported in driver init and it different from the number reported in
config space.  Updated the VF driver to now detect a reset with the
VF_ARQLEN register since the enable bit is cleared when the VF is reset
and it stays cleared until the VF driver processes the reset and
re-enables the admin queue which is more reliable than using the
VFGEN_RSTAT as previously.

Neerav adds parsing for CEE DCBx TLVs from the LLDP MIB since there is
a need to get the CEE DesiredCfg Tx by firmware and DCB configuration
Rx from peer for debug and other application purposes.

Carolyn fixes a problem where the PF's Flow Director filter table would
have an entry that the hardware was unable to add, when this occurs an
invalid entry gets replayed and a valid one is lost.

Matt fixes an issue where multiple link up messages can be logged
resulting from admin queue link status timing when link properties are
changed.

Shannon adds the ability to control the period link polling through
ethtool to be able to switch it off and on for debugging link issues.

Serey explicitly assigns the enum index for each VSI type so that the PF
and VF always reference to the same VSI type event if the enum lists
are different.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents df718423 ce6fcb3f
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
/* Ethtool Private Flags */ /* Ethtool Private Flags */
#define I40E_PRIV_FLAGS_NPAR_FLAG BIT(0) #define I40E_PRIV_FLAGS_NPAR_FLAG BIT(0)
#define I40E_PRIV_FLAGS_LINKPOLL_FLAG BIT(1)
#define I40E_NVM_VERSION_LO_SHIFT 0 #define I40E_NVM_VERSION_LO_SHIFT 0
#define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT) #define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT)
...@@ -327,6 +328,7 @@ struct i40e_pf { ...@@ -327,6 +328,7 @@ struct i40e_pf {
#define I40E_FLAG_WB_ON_ITR_CAPABLE BIT_ULL(35) #define I40E_FLAG_WB_ON_ITR_CAPABLE BIT_ULL(35)
#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(37) #define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(37)
#define I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT_ULL(38) #define I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT_ULL(38)
#define I40E_FLAG_LINK_POLLING_ENABLED BIT_ULL(39)
#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(40) #define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(40)
/* tracks features that get auto disabled by errors */ /* tracks features that get auto disabled by errors */
...@@ -410,6 +412,7 @@ struct i40e_pf { ...@@ -410,6 +412,7 @@ struct i40e_pf {
u32 npar_min_bw; u32 npar_min_bw;
u32 ioremap_len; u32 ioremap_len;
u32 fd_inv;
}; };
struct i40e_mac_filter { struct i40e_mac_filter {
...@@ -536,6 +539,7 @@ struct i40e_vsi { ...@@ -536,6 +539,7 @@ struct i40e_vsi {
u16 idx; /* index in pf->vsi[] */ u16 idx; /* index in pf->vsi[] */
u16 veb_idx; /* index of VEB parent */ u16 veb_idx; /* index of VEB parent */
struct kobject *kobj; /* sysfs object */ struct kobject *kobj; /* sysfs object */
bool current_isup; /* Sync 'link up' logging */
/* VSI specific handlers */ /* VSI specific handlers */
irqreturn_t (*irq_handler)(int irq, void *data); irqreturn_t (*irq_handler)(int irq, void *data);
...@@ -702,7 +706,24 @@ static inline void i40e_dbg_pf_exit(struct i40e_pf *pf) {} ...@@ -702,7 +706,24 @@ static inline void i40e_dbg_pf_exit(struct i40e_pf *pf) {}
static inline void i40e_dbg_init(void) {} static inline void i40e_dbg_init(void) {}
static inline void i40e_dbg_exit(void) {} static inline void i40e_dbg_exit(void) {}
#endif /* CONFIG_DEBUG_FS*/ #endif /* CONFIG_DEBUG_FS*/
void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector); /**
* i40e_irq_dynamic_enable - Enable default interrupt generation settings
* @vsi: pointer to a vsi
* @vector: enable a particular Hw Interrupt vector, without base_vector
**/
static inline void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector)
{
struct i40e_pf *pf = vsi->back;
struct i40e_hw *hw = &pf->hw;
u32 val;
val = I40E_PFINT_DYN_CTLN_INTENA_MASK |
I40E_PFINT_DYN_CTLN_CLEARPBA_MASK |
(I40E_ITR_NONE << I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT);
wr32(hw, I40E_PFINT_DYN_CTLN(vector + vsi->base_vector - 1), val);
/* skip the flush */
}
void i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector); void i40e_irq_dynamic_disable(struct i40e_vsi *vsi, int vector);
void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf); void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf);
void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf); void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf);
...@@ -773,4 +794,5 @@ int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi); ...@@ -773,4 +794,5 @@ int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi);
i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf); i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);
i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf); i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf);
i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf); i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf);
void i40e_print_link_message(struct i40e_vsi *vsi, bool isup);
#endif /* _I40E_H_ */ #endif /* _I40E_H_ */
...@@ -683,8 +683,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw) ...@@ -683,8 +683,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
details = I40E_ADMINQ_DETAILS(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc);
while (rd32(hw, hw->aq.asq.head) != ntc) { while (rd32(hw, hw->aq.asq.head) != ntc) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"%s: ntc %d head %d.\n", __func__, ntc, "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
rd32(hw, hw->aq.asq.head));
if (details->callback) { if (details->callback) {
I40E_ADMINQ_CALLBACK cb_func = I40E_ADMINQ_CALLBACK cb_func =
......
...@@ -1035,7 +1035,7 @@ i40e_status i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr) ...@@ -1035,7 +1035,7 @@ i40e_status i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr)
status = i40e_aq_mac_address_read(hw, &flags, &addrs, NULL); status = i40e_aq_mac_address_read(hw, &flags, &addrs, NULL);
if (flags & I40E_AQC_LAN_ADDR_VALID) if (flags & I40E_AQC_LAN_ADDR_VALID)
memcpy(mac_addr, &addrs.pf_lan_mac, sizeof(addrs.pf_lan_mac)); ether_addr_copy(mac_addr, addrs.pf_lan_mac);
return status; return status;
} }
...@@ -1058,7 +1058,7 @@ i40e_status i40e_get_port_mac_addr(struct i40e_hw *hw, u8 *mac_addr) ...@@ -1058,7 +1058,7 @@ i40e_status i40e_get_port_mac_addr(struct i40e_hw *hw, u8 *mac_addr)
return status; return status;
if (flags & I40E_AQC_PORT_ADDR_VALID) if (flags & I40E_AQC_PORT_ADDR_VALID)
memcpy(mac_addr, &addrs.port_mac, sizeof(addrs.port_mac)); ether_addr_copy(mac_addr, addrs.port_mac);
else else
status = I40E_ERR_INVALID_MAC_ADDR; status = I40E_ERR_INVALID_MAC_ADDR;
...@@ -1116,7 +1116,7 @@ i40e_status i40e_get_san_mac_addr(struct i40e_hw *hw, u8 *mac_addr) ...@@ -1116,7 +1116,7 @@ i40e_status i40e_get_san_mac_addr(struct i40e_hw *hw, u8 *mac_addr)
return status; return status;
if (flags & I40E_AQC_SAN_ADDR_VALID) if (flags & I40E_AQC_SAN_ADDR_VALID)
memcpy(mac_addr, &addrs.pf_san_mac, sizeof(addrs.pf_san_mac)); ether_addr_copy(mac_addr, addrs.pf_san_mac);
else else
status = I40E_ERR_INVALID_MAC_ADDR; status = I40E_ERR_INVALID_MAC_ADDR;
...@@ -2363,6 +2363,7 @@ i40e_status i40e_aq_get_veb_parameters(struct i40e_hw *hw, ...@@ -2363,6 +2363,7 @@ i40e_status i40e_aq_get_veb_parameters(struct i40e_hw *hw,
*vebs_free = le16_to_cpu(cmd_resp->vebs_free); *vebs_free = le16_to_cpu(cmd_resp->vebs_free);
if (floating) { if (floating) {
u16 flags = le16_to_cpu(cmd_resp->veb_flags); u16 flags = le16_to_cpu(cmd_resp->veb_flags);
if (flags & I40E_AQC_ADD_VEB_FLOATING) if (flags & I40E_AQC_ADD_VEB_FLOATING)
*floating = true; *floating = true;
else else
...@@ -3777,7 +3778,7 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw, ...@@ -3777,7 +3778,7 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw,
} }
if (mac_addr) if (mac_addr)
memcpy(cmd->mac, mac_addr, ETH_ALEN); ether_addr_copy(cmd->mac, mac_addr);
cmd->etype = cpu_to_le16(ethtype); cmd->etype = cpu_to_le16(ethtype);
cmd->flags = cpu_to_le16(flags); cmd->flags = cpu_to_le16(flags);
......
...@@ -291,6 +291,182 @@ static void i40e_parse_ieee_tlv(struct i40e_lldp_org_tlv *tlv, ...@@ -291,6 +291,182 @@ static void i40e_parse_ieee_tlv(struct i40e_lldp_org_tlv *tlv,
} }
} }
/**
* i40e_parse_cee_pgcfg_tlv
* @tlv: CEE DCBX PG CFG TLV
* @dcbcfg: Local store to update ETS CFG data
*
* Parses CEE DCBX PG CFG TLV
**/
static void i40e_parse_cee_pgcfg_tlv(struct i40e_cee_feat_tlv *tlv,
struct i40e_dcbx_config *dcbcfg)
{
struct i40e_dcb_ets_config *etscfg;
u8 *buf = tlv->tlvinfo;
u16 offset = 0;
u8 priority;
int i;
etscfg = &dcbcfg->etscfg;
if (tlv->en_will_err & I40E_CEE_FEAT_TLV_WILLING_MASK)
etscfg->willing = 1;
etscfg->cbs = 0;
/* Priority Group Table (4 octets)
* Octets:| 1 | 2 | 3 | 4 |
* -----------------------------------------
* |pri0|pri1|pri2|pri3|pri4|pri5|pri6|pri7|
* -----------------------------------------
* Bits:|7 4|3 0|7 4|3 0|7 4|3 0|7 4|3 0|
* -----------------------------------------
*/
for (i = 0; i < 4; i++) {
priority = (u8)((buf[offset] & I40E_CEE_PGID_PRIO_1_MASK) >>
I40E_CEE_PGID_PRIO_1_SHIFT);
etscfg->prioritytable[i * 2] = priority;
priority = (u8)((buf[offset] & I40E_CEE_PGID_PRIO_0_MASK) >>
I40E_CEE_PGID_PRIO_0_SHIFT);
etscfg->prioritytable[i * 2 + 1] = priority;
offset++;
}
/* PG Percentage Table (8 octets)
* Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
* ---------------------------------
* |pg0|pg1|pg2|pg3|pg4|pg5|pg6|pg7|
* ---------------------------------
*/
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
etscfg->tcbwtable[i] = buf[offset++];
/* Number of TCs supported (1 octet) */
etscfg->maxtcs = buf[offset];
}
/**
* i40e_parse_cee_pfccfg_tlv
* @tlv: CEE DCBX PFC CFG TLV
* @dcbcfg: Local store to update PFC CFG data
*
* Parses CEE DCBX PFC CFG TLV
**/
static void i40e_parse_cee_pfccfg_tlv(struct i40e_cee_feat_tlv *tlv,
struct i40e_dcbx_config *dcbcfg)
{
u8 *buf = tlv->tlvinfo;
if (tlv->en_will_err & I40E_CEE_FEAT_TLV_WILLING_MASK)
dcbcfg->pfc.willing = 1;
/* ------------------------
* | PFC Enable | PFC TCs |
* ------------------------
* | 1 octet | 1 octet |
*/
dcbcfg->pfc.pfcenable = buf[0];
dcbcfg->pfc.pfccap = buf[1];
}
/**
* i40e_parse_cee_app_tlv
* @tlv: CEE DCBX APP TLV
* @dcbcfg: Local store to update APP PRIO data
*
* Parses CEE DCBX APP PRIO TLV
**/
static void i40e_parse_cee_app_tlv(struct i40e_cee_feat_tlv *tlv,
struct i40e_dcbx_config *dcbcfg)
{
u16 length, typelength, offset = 0;
struct i40e_cee_app_prio *app;
u8 i, up;
typelength = ntohs(tlv->hdr.typelen);
length = (u16)((typelength & I40E_LLDP_TLV_LEN_MASK) >>
I40E_LLDP_TLV_LEN_SHIFT);
dcbcfg->numapps = length / sizeof(*app);
if (!dcbcfg->numapps)
return;
for (i = 0; i < dcbcfg->numapps; i++) {
app = (struct i40e_cee_app_prio *)(tlv->tlvinfo + offset);
for (up = 0; up < I40E_MAX_USER_PRIORITY; up++) {
if (app->prio_map & (1 << up))
break;
}
dcbcfg->app[i].priority = up;
/* Get Selector from lower 2 bits */
dcbcfg->app[i].selector = (app->upper_oui_sel &
I40E_CEE_APP_SELECTOR_MASK);
dcbcfg->app[i].protocolid = ntohs(app->protocol);
/* Move to next app */
offset += sizeof(*app);
}
}
/**
* i40e_parse_cee_tlv
* @tlv: CEE DCBX TLV
* @dcbcfg: Local store to update DCBX config data
*
* Get the TLV subtype and send it to parsing function
* based on the subtype value
**/
static void i40e_parse_cee_tlv(struct i40e_lldp_org_tlv *tlv,
struct i40e_dcbx_config *dcbcfg)
{
u16 len, tlvlen, sublen, typelength;
struct i40e_cee_feat_tlv *sub_tlv;
u8 subtype, feat_tlv_count = 0;
u32 ouisubtype;
ouisubtype = ntohl(tlv->ouisubtype);
subtype = (u8)((ouisubtype & I40E_LLDP_TLV_SUBTYPE_MASK) >>
I40E_LLDP_TLV_SUBTYPE_SHIFT);
/* Return if not CEE DCBX */
if (subtype != I40E_CEE_DCBX_TYPE)
return;
typelength = ntohs(tlv->typelength);
tlvlen = (u16)((typelength & I40E_LLDP_TLV_LEN_MASK) >>
I40E_LLDP_TLV_LEN_SHIFT);
len = sizeof(tlv->typelength) + sizeof(ouisubtype) +
sizeof(struct i40e_cee_ctrl_tlv);
/* Return if no CEE DCBX Feature TLVs */
if (tlvlen <= len)
return;
sub_tlv = (struct i40e_cee_feat_tlv *)((char *)tlv + len);
while (feat_tlv_count < I40E_CEE_MAX_FEAT_TYPE) {
typelength = ntohs(sub_tlv->hdr.typelen);
sublen = (u16)((typelength &
I40E_LLDP_TLV_LEN_MASK) >>
I40E_LLDP_TLV_LEN_SHIFT);
subtype = (u8)((typelength & I40E_LLDP_TLV_TYPE_MASK) >>
I40E_LLDP_TLV_TYPE_SHIFT);
switch (subtype) {
case I40E_CEE_SUBTYPE_PG_CFG:
i40e_parse_cee_pgcfg_tlv(sub_tlv, dcbcfg);
break;
case I40E_CEE_SUBTYPE_PFC_CFG:
i40e_parse_cee_pfccfg_tlv(sub_tlv, dcbcfg);
break;
case I40E_CEE_SUBTYPE_APP_PRI:
i40e_parse_cee_app_tlv(sub_tlv, dcbcfg);
break;
default:
return; /* Invalid Sub-type return */
}
feat_tlv_count++;
/* Move to next sub TLV */
sub_tlv = (struct i40e_cee_feat_tlv *)((char *)sub_tlv +
sizeof(sub_tlv->hdr.typelen) +
sublen);
}
}
/** /**
* i40e_parse_org_tlv * i40e_parse_org_tlv
* @tlv: Organization specific TLV * @tlv: Organization specific TLV
...@@ -312,6 +488,9 @@ static void i40e_parse_org_tlv(struct i40e_lldp_org_tlv *tlv, ...@@ -312,6 +488,9 @@ static void i40e_parse_org_tlv(struct i40e_lldp_org_tlv *tlv,
case I40E_IEEE_8021QAZ_OUI: case I40E_IEEE_8021QAZ_OUI:
i40e_parse_ieee_tlv(tlv, dcbcfg); i40e_parse_ieee_tlv(tlv, dcbcfg);
break; break;
case I40E_CEE_DCBX_OUI:
i40e_parse_cee_tlv(tlv, dcbcfg);
break;
default: default:
break; break;
} }
...@@ -502,15 +681,18 @@ static void i40e_cee_to_dcb_config( ...@@ -502,15 +681,18 @@ static void i40e_cee_to_dcb_config(
/* CEE PG data to ETS config */ /* CEE PG data to ETS config */
dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc;
/* Note that the FW creates the oper_prio_tc nibbles reversed
* from those in the CEE Priority Group sub-TLV.
*/
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
tc = (u8)((cee_cfg->oper_prio_tc[i] &
I40E_CEE_PGID_PRIO_1_MASK) >>
I40E_CEE_PGID_PRIO_1_SHIFT);
dcbcfg->etscfg.prioritytable[i*2] = tc;
tc = (u8)((cee_cfg->oper_prio_tc[i] & tc = (u8)((cee_cfg->oper_prio_tc[i] &
I40E_CEE_PGID_PRIO_0_MASK) >> I40E_CEE_PGID_PRIO_0_MASK) >>
I40E_CEE_PGID_PRIO_0_SHIFT); I40E_CEE_PGID_PRIO_0_SHIFT);
dcbcfg->etscfg.prioritytable[i*2 + 1] = tc; dcbcfg->etscfg.prioritytable[i * 2] = tc;
tc = (u8)((cee_cfg->oper_prio_tc[i] &
I40E_CEE_PGID_PRIO_1_MASK) >>
I40E_CEE_PGID_PRIO_1_SHIFT);
dcbcfg->etscfg.prioritytable[i * 2 + 1] = tc;
} }
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
...@@ -582,6 +764,36 @@ static void i40e_cee_to_dcb_config( ...@@ -582,6 +764,36 @@ static void i40e_cee_to_dcb_config(
dcbcfg->numapps = i; dcbcfg->numapps = i;
} }
/**
* i40e_get_ieee_dcb_config
* @hw: pointer to the hw struct
*
* Get IEEE mode DCB configuration from the Firmware
**/
static i40e_status i40e_get_ieee_dcb_config(struct i40e_hw *hw)
{
i40e_status ret = 0;
/* IEEE mode */
hw->local_dcbx_config.dcbx_mode = I40E_DCBX_MODE_IEEE;
/* Get Local DCB Config */
ret = i40e_aq_get_dcb_config(hw, I40E_AQ_LLDP_MIB_LOCAL, 0,
&hw->local_dcbx_config);
if (ret)
goto out;
/* Get Remote DCB Config */
ret = i40e_aq_get_dcb_config(hw, I40E_AQ_LLDP_MIB_REMOTE,
I40E_AQ_LLDP_BRIDGE_TYPE_NEAREST_BRIDGE,
&hw->remote_dcbx_config);
/* Don't treat ENOENT as an error for Remote MIBs */
if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT)
ret = 0;
out:
return ret;
}
/** /**
* i40e_get_dcb_config * i40e_get_dcb_config
* @hw: pointer to the hw struct * @hw: pointer to the hw struct
...@@ -597,7 +809,7 @@ i40e_status i40e_get_dcb_config(struct i40e_hw *hw) ...@@ -597,7 +809,7 @@ i40e_status i40e_get_dcb_config(struct i40e_hw *hw)
/* If Firmware version < v4.33 IEEE only */ /* If Firmware version < v4.33 IEEE only */
if (((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver < 33)) || if (((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver < 33)) ||
(hw->aq.fw_maj_ver < 4)) (hw->aq.fw_maj_ver < 4))
goto ieee; return i40e_get_ieee_dcb_config(hw);
/* If Firmware version == v4.33 use old CEE struct */ /* If Firmware version == v4.33 use old CEE struct */
if ((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver == 33)) { if ((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver == 33)) {
...@@ -626,16 +838,14 @@ i40e_status i40e_get_dcb_config(struct i40e_hw *hw) ...@@ -626,16 +838,14 @@ i40e_status i40e_get_dcb_config(struct i40e_hw *hw)
/* CEE mode not enabled try querying IEEE data */ /* CEE mode not enabled try querying IEEE data */
if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT)
goto ieee; return i40e_get_ieee_dcb_config(hw);
else
if (ret)
goto out; goto out;
ieee: /* Get CEE DCB Desired Config */
/* IEEE mode */
hw->local_dcbx_config.dcbx_mode = I40E_DCBX_MODE_IEEE;
/* Get Local DCB Config */
ret = i40e_aq_get_dcb_config(hw, I40E_AQ_LLDP_MIB_LOCAL, 0, ret = i40e_aq_get_dcb_config(hw, I40E_AQ_LLDP_MIB_LOCAL, 0,
&hw->local_dcbx_config); &hw->desired_dcbx_config);
if (ret) if (ret)
goto out; goto out;
......
...@@ -44,6 +44,15 @@ ...@@ -44,6 +44,15 @@
#define I40E_IEEE_SUBTYPE_PFC_CFG 11 #define I40E_IEEE_SUBTYPE_PFC_CFG 11
#define I40E_IEEE_SUBTYPE_APP_PRI 12 #define I40E_IEEE_SUBTYPE_APP_PRI 12
#define I40E_CEE_DCBX_OUI 0x001b21
#define I40E_CEE_DCBX_TYPE 2
#define I40E_CEE_SUBTYPE_CTRL 1
#define I40E_CEE_SUBTYPE_PG_CFG 2
#define I40E_CEE_SUBTYPE_PFC_CFG 3
#define I40E_CEE_SUBTYPE_APP_PRI 4
#define I40E_CEE_MAX_FEAT_TYPE 3
/* Defines for LLDP TLV header */ /* Defines for LLDP TLV header */
#define I40E_LLDP_TLV_LEN_SHIFT 0 #define I40E_LLDP_TLV_LEN_SHIFT 0
#define I40E_LLDP_TLV_LEN_MASK (0x01FF << I40E_LLDP_TLV_LEN_SHIFT) #define I40E_LLDP_TLV_LEN_MASK (0x01FF << I40E_LLDP_TLV_LEN_SHIFT)
...@@ -98,6 +107,36 @@ struct i40e_lldp_org_tlv { ...@@ -98,6 +107,36 @@ struct i40e_lldp_org_tlv {
__be32 ouisubtype; __be32 ouisubtype;
u8 tlvinfo[1]; u8 tlvinfo[1];
}; };
struct i40e_cee_tlv_hdr {
__be16 typelen;
u8 operver;
u8 maxver;
};
struct i40e_cee_ctrl_tlv {
struct i40e_cee_tlv_hdr hdr;
__be32 seqno;
__be32 ackno;
};
struct i40e_cee_feat_tlv {
struct i40e_cee_tlv_hdr hdr;
u8 en_will_err; /* Bits: |En|Will|Err|Reserved(5)| */
#define I40E_CEE_FEAT_TLV_ENABLE_MASK 0x80
#define I40E_CEE_FEAT_TLV_WILLING_MASK 0x40
#define I40E_CEE_FEAT_TLV_ERR_MASK 0x20
u8 subtype;
u8 tlvinfo[1];
};
struct i40e_cee_app_prio {
__be16 protocol;
u8 upper_oui_sel; /* Bits: |Upper OUI(6)|Selector(2)| */
#define I40E_CEE_APP_SELECTOR_MASK 0x03
__be16 lower_oui;
u8 prio_map;
};
#pragma pack() #pragma pack()
i40e_status i40e_get_dcbx_status(struct i40e_hw *hw, i40e_status i40e_get_dcbx_status(struct i40e_hw *hw,
......
...@@ -236,6 +236,7 @@ static void i40e_dcbnl_del_app(struct i40e_pf *pf, ...@@ -236,6 +236,7 @@ static void i40e_dcbnl_del_app(struct i40e_pf *pf,
struct i40e_dcb_app_priority_table *app) struct i40e_dcb_app_priority_table *app)
{ {
int v, err; int v, err;
for (v = 0; v < pf->num_alloc_vsi; v++) { for (v = 0; v < pf->num_alloc_vsi; v++) {
if (pf->vsi[v] && pf->vsi[v]->netdev) { if (pf->vsi[v] && pf->vsi[v]->netdev) {
err = i40e_dcbnl_vsi_del_app(pf->vsi[v], app); err = i40e_dcbnl_vsi_del_app(pf->vsi[v], app);
......
...@@ -230,10 +230,10 @@ static const char i40e_gstrings_test[][ETH_GSTRING_LEN] = { ...@@ -230,10 +230,10 @@ static const char i40e_gstrings_test[][ETH_GSTRING_LEN] = {
static const char i40e_priv_flags_strings[][ETH_GSTRING_LEN] = { static const char i40e_priv_flags_strings[][ETH_GSTRING_LEN] = {
"NPAR", "NPAR",
"LinkPolling",
}; };
#define I40E_PRIV_FLAGS_STR_LEN \ #define I40E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_priv_flags_strings)
(sizeof(i40e_priv_flags_strings) / ETH_GSTRING_LEN)
/** /**
* i40e_partition_setting_complaint - generic complaint for MFP restriction * i40e_partition_setting_complaint - generic complaint for MFP restriction
...@@ -690,7 +690,7 @@ static int i40e_set_settings(struct net_device *netdev, ...@@ -690,7 +690,7 @@ static int i40e_set_settings(struct net_device *netdev,
/* Tell the OS link is going down, the link will go /* Tell the OS link is going down, the link will go
* back up when fw says it is ready asynchronously * back up when fw says it is ready asynchronously
*/ */
netdev_info(netdev, "PHY settings change requested, NIC Link is going down.\n"); i40e_print_link_message(vsi, false);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev); netif_tx_stop_all_queues(netdev);
} }
...@@ -834,7 +834,7 @@ static int i40e_set_pauseparam(struct net_device *netdev, ...@@ -834,7 +834,7 @@ static int i40e_set_pauseparam(struct net_device *netdev,
/* Tell the OS link is going down, the link will go back up when fw /* Tell the OS link is going down, the link will go back up when fw
* says it is ready asynchronously * says it is ready asynchronously
*/ */
netdev_info(netdev, "Flow control settings change requested, NIC Link is going down.\n"); i40e_print_link_message(vsi, false);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev); netif_tx_stop_all_queues(netdev);
...@@ -1176,6 +1176,11 @@ static int i40e_set_ringparam(struct net_device *netdev, ...@@ -1176,6 +1176,11 @@ static int i40e_set_ringparam(struct net_device *netdev,
/* clone ring and setup updated count */ /* clone ring and setup updated count */
tx_rings[i] = *vsi->tx_rings[i]; tx_rings[i] = *vsi->tx_rings[i];
tx_rings[i].count = new_tx_count; tx_rings[i].count = new_tx_count;
/* the desc and bi pointers will be reallocated in the
* setup call
*/
tx_rings[i].desc = NULL;
tx_rings[i].rx_bi = NULL;
err = i40e_setup_tx_descriptors(&tx_rings[i]); err = i40e_setup_tx_descriptors(&tx_rings[i]);
if (err) { if (err) {
while (i) { while (i) {
...@@ -1206,6 +1211,11 @@ static int i40e_set_ringparam(struct net_device *netdev, ...@@ -1206,6 +1211,11 @@ static int i40e_set_ringparam(struct net_device *netdev,
/* clone ring and setup updated count */ /* clone ring and setup updated count */
rx_rings[i] = *vsi->rx_rings[i]; rx_rings[i] = *vsi->rx_rings[i];
rx_rings[i].count = new_rx_count; rx_rings[i].count = new_rx_count;
/* the desc and bi pointers will be reallocated in the
* setup call
*/
rx_rings[i].desc = NULL;
rx_rings[i].rx_bi = NULL;
err = i40e_setup_rx_descriptors(&rx_rings[i]); err = i40e_setup_rx_descriptors(&rx_rings[i]);
if (err) { if (err) {
while (i) { while (i) {
...@@ -1350,6 +1360,7 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, ...@@ -1350,6 +1360,7 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
if ((pf->lan_veb != I40E_NO_VEB) && if ((pf->lan_veb != I40E_NO_VEB) &&
(pf->flags & I40E_FLAG_VEB_STATS_ENABLED)) { (pf->flags & I40E_FLAG_VEB_STATS_ENABLED)) {
struct i40e_veb *veb = pf->veb[pf->lan_veb]; struct i40e_veb *veb = pf->veb[pf->lan_veb];
for (j = 0; j < I40E_VEB_STATS_LEN; j++) { for (j = 0; j < I40E_VEB_STATS_LEN; j++) {
p = (char *)veb; p = (char *)veb;
p += i40e_gstrings_veb_stats[j].stat_offset; p += i40e_gstrings_veb_stats[j].stat_offset;
...@@ -1597,7 +1608,7 @@ static inline bool i40e_active_vfs(struct i40e_pf *pf) ...@@ -1597,7 +1608,7 @@ static inline bool i40e_active_vfs(struct i40e_pf *pf)
int i; int i;
for (i = 0; i < pf->num_alloc_vfs; i++) for (i = 0; i < pf->num_alloc_vfs; i++)
if (vfs[i].vf_states & I40E_VF_STAT_ACTIVE) if (test_bit(I40E_VF_STAT_ACTIVE, &vfs[i].vf_states))
return true; return true;
return false; return false;
} }
...@@ -2626,10 +2637,31 @@ static u32 i40e_get_priv_flags(struct net_device *dev) ...@@ -2626,10 +2637,31 @@ static u32 i40e_get_priv_flags(struct net_device *dev)
ret_flags |= pf->hw.func_caps.npar_enable ? ret_flags |= pf->hw.func_caps.npar_enable ?
I40E_PRIV_FLAGS_NPAR_FLAG : 0; I40E_PRIV_FLAGS_NPAR_FLAG : 0;
ret_flags |= pf->flags & I40E_FLAG_LINK_POLLING_ENABLED ?
I40E_PRIV_FLAGS_LINKPOLL_FLAG : 0;
return ret_flags; return ret_flags;
} }
/**
* i40e_set_priv_flags - set private flags
* @dev: network interface device structure
* @flags: bit flags to be set
**/
static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
{
struct i40e_netdev_priv *np = netdev_priv(dev);
struct i40e_vsi *vsi = np->vsi;
struct i40e_pf *pf = vsi->back;
if (flags & I40E_PRIV_FLAGS_LINKPOLL_FLAG)
pf->flags |= I40E_FLAG_LINK_POLLING_ENABLED;
else
pf->flags &= ~I40E_FLAG_LINK_POLLING_ENABLED;
return 0;
}
static const struct ethtool_ops i40e_ethtool_ops = { static const struct ethtool_ops i40e_ethtool_ops = {
.get_settings = i40e_get_settings, .get_settings = i40e_get_settings,
.set_settings = i40e_set_settings, .set_settings = i40e_set_settings,
...@@ -2666,6 +2698,7 @@ static const struct ethtool_ops i40e_ethtool_ops = { ...@@ -2666,6 +2698,7 @@ static const struct ethtool_ops i40e_ethtool_ops = {
.set_channels = i40e_set_channels, .set_channels = i40e_set_channels,
.get_ts_info = i40e_get_ts_info, .get_ts_info = i40e_get_ts_info,
.get_priv_flags = i40e_get_priv_flags, .get_priv_flags = i40e_get_priv_flags,
.set_priv_flags = i40e_set_priv_flags,
}; };
void i40e_set_ethtool_ops(struct net_device *netdev) void i40e_set_ethtool_ops(struct net_device *netdev)
......
...@@ -324,7 +324,6 @@ void i40e_init_pf_fcoe(struct i40e_pf *pf) ...@@ -324,7 +324,6 @@ void i40e_init_pf_fcoe(struct i40e_pf *pf)
wr32(hw, I40E_GLFCOE_RCTL, val); wr32(hw, I40E_GLFCOE_RCTL, val);
dev_info(&pf->pdev->dev, "FCoE is supported.\n"); dev_info(&pf->pdev->dev, "FCoE is supported.\n");
return;
} }
/** /**
......
...@@ -431,9 +431,8 @@ static i40e_status i40e_create_lan_hmc_object(struct i40e_hw *hw, ...@@ -431,9 +431,8 @@ static i40e_status i40e_create_lan_hmc_object(struct i40e_hw *hw,
pd_idx1 = max(pd_idx, pd_idx1 = max(pd_idx,
((j - 1) * I40E_HMC_MAX_BP_COUNT)); ((j - 1) * I40E_HMC_MAX_BP_COUNT));
pd_lmt1 = min(pd_lmt, (j * I40E_HMC_MAX_BP_COUNT)); pd_lmt1 = min(pd_lmt, (j * I40E_HMC_MAX_BP_COUNT));
for (i = pd_idx1; i < pd_lmt1; i++) { for (i = pd_idx1; i < pd_lmt1; i++)
i40e_remove_pd_bp(hw, info->hmc_info, i); i40e_remove_pd_bp(hw, info->hmc_info, i);
}
i40e_remove_pd_page(hw, info->hmc_info, (j - 1)); i40e_remove_pd_page(hw, info->hmc_info, (j - 1));
break; break;
case I40E_SD_TYPE_DIRECT: case I40E_SD_TYPE_DIRECT:
......
This diff is collapsed.
...@@ -618,9 +618,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf) ...@@ -618,9 +618,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf)
/* Attempt to register the clock before enabling the hardware. */ /* Attempt to register the clock before enabling the hardware. */
pf->ptp_clock = ptp_clock_register(&pf->ptp_caps, &pf->pdev->dev); pf->ptp_clock = ptp_clock_register(&pf->ptp_caps, &pf->pdev->dev);
if (IS_ERR(pf->ptp_clock)) { if (IS_ERR(pf->ptp_clock))
return PTR_ERR(pf->ptp_clock); return PTR_ERR(pf->ptp_clock);
}
/* clear the hwtstamp settings here during clock create, instead of /* clear the hwtstamp settings here during clock create, instead of
* during regular init, so that we can maintain settings across a * during regular init, so that we can maintain settings across a
......
...@@ -465,10 +465,11 @@ static void i40e_fd_handle_status(struct i40e_ring *rx_ring, ...@@ -465,10 +465,11 @@ static void i40e_fd_handle_status(struct i40e_ring *rx_ring,
I40E_RX_PROG_STATUS_DESC_QW1_ERROR_SHIFT; I40E_RX_PROG_STATUS_DESC_QW1_ERROR_SHIFT;
if (error == BIT(I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT)) { if (error == BIT(I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT)) {
pf->fd_inv = le32_to_cpu(rx_desc->wb.qword0.hi_dword.fd_id);
if ((rx_desc->wb.qword0.hi_dword.fd_id != 0) || if ((rx_desc->wb.qword0.hi_dword.fd_id != 0) ||
(I40E_DEBUG_FD & pf->hw.debug_mask)) (I40E_DEBUG_FD & pf->hw.debug_mask))
dev_warn(&pdev->dev, "ntuple filter loc = %d, could not be added\n", dev_warn(&pdev->dev, "ntuple filter loc = %d, could not be added\n",
rx_desc->wb.qword0.hi_dword.fd_id); pf->fd_inv);
/* Check if the programming error is for ATR. /* Check if the programming error is for ATR.
* If so, auto disable ATR and set a state for * If so, auto disable ATR and set a state for
...@@ -1521,6 +1522,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget) ...@@ -1521,6 +1522,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
cleaned_count++; cleaned_count++;
if (rx_hbo || rx_sph) { if (rx_hbo || rx_sph) {
int len; int len;
if (rx_hbo) if (rx_hbo)
len = I40E_RX_HDR_SIZE; len = I40E_RX_HDR_SIZE;
else else
...@@ -1706,9 +1708,6 @@ static int i40e_clean_rx_irq_1buf(struct i40e_ring *rx_ring, int budget) ...@@ -1706,9 +1708,6 @@ static int i40e_clean_rx_irq_1buf(struct i40e_ring *rx_ring, int budget)
/* ERR_MASK will only have valid bits if EOP set */ /* ERR_MASK will only have valid bits if EOP set */
if (unlikely(rx_error & BIT(I40E_RX_DESC_ERROR_RXE_SHIFT))) { if (unlikely(rx_error & BIT(I40E_RX_DESC_ERROR_RXE_SHIFT))) {
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
/* TODO: shouldn't we increment a counter indicating the
* drop?
*/
continue; continue;
} }
...@@ -2080,6 +2079,7 @@ static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb, ...@@ -2080,6 +2079,7 @@ static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
/* else if it is a SW VLAN, check the next protocol and store the tag */ /* else if it is a SW VLAN, check the next protocol and store the tag */
} else if (protocol == htons(ETH_P_8021Q)) { } else if (protocol == htons(ETH_P_8021Q)) {
struct vlan_hdr *vhdr, _vhdr; struct vlan_hdr *vhdr, _vhdr;
vhdr = skb_header_pointer(skb, ETH_HLEN, sizeof(_vhdr), &_vhdr); vhdr = skb_header_pointer(skb, ETH_HLEN, sizeof(_vhdr), &_vhdr);
if (!vhdr) if (!vhdr)
return -EINVAL; return -EINVAL;
...@@ -2739,6 +2739,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, ...@@ -2739,6 +2739,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
u8 hdr_len = 0; u8 hdr_len = 0;
int tsyn; int tsyn;
int tso; int tso;
if (0 == i40e_xmit_descriptor_count(skb, tx_ring)) if (0 == i40e_xmit_descriptor_count(skb, tx_ring))
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
......
...@@ -165,6 +165,7 @@ struct i40e_tx_buffer { ...@@ -165,6 +165,7 @@ struct i40e_tx_buffer {
}; };
unsigned int bytecount; unsigned int bytecount;
unsigned short gso_segs; unsigned short gso_segs;
DEFINE_DMA_UNMAP_ADDR(dma); DEFINE_DMA_UNMAP_ADDR(dma);
DEFINE_DMA_UNMAP_LEN(len); DEFINE_DMA_UNMAP_LEN(len);
u32 tx_flags; u32 tx_flags;
......
...@@ -160,14 +160,14 @@ enum i40e_set_fc_aq_failures { ...@@ -160,14 +160,14 @@ enum i40e_set_fc_aq_failures {
}; };
enum i40e_vsi_type { enum i40e_vsi_type {
I40E_VSI_MAIN = 0, I40E_VSI_MAIN = 0,
I40E_VSI_VMDQ1, I40E_VSI_VMDQ1 = 1,
I40E_VSI_VMDQ2, I40E_VSI_VMDQ2 = 2,
I40E_VSI_CTRL, I40E_VSI_CTRL = 3,
I40E_VSI_FCOE, I40E_VSI_FCOE = 4,
I40E_VSI_MIRROR, I40E_VSI_MIRROR = 5,
I40E_VSI_SRIOV, I40E_VSI_SRIOV = 6,
I40E_VSI_FDIR, I40E_VSI_FDIR = 7,
I40E_VSI_TYPE_UNKNOWN I40E_VSI_TYPE_UNKNOWN
}; };
...@@ -510,8 +510,9 @@ struct i40e_hw { ...@@ -510,8 +510,9 @@ struct i40e_hw {
u16 dcbx_status; u16 dcbx_status;
/* DCBX info */ /* DCBX info */
struct i40e_dcbx_config local_dcbx_config; struct i40e_dcbx_config local_dcbx_config; /* Oper/Local Cfg */
struct i40e_dcbx_config remote_dcbx_config; struct i40e_dcbx_config remote_dcbx_config; /* Peer Cfg */
struct i40e_dcbx_config desired_dcbx_config; /* CEE Desired Cfg */
/* debug mask */ /* debug mask */
u32 debug_mask; u32 debug_mask;
......
...@@ -536,6 +536,7 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type) ...@@ -536,6 +536,7 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
} }
if (type == I40E_VSI_SRIOV) { if (type == I40E_VSI_SRIOV) {
u8 brdcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 brdcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
vf->lan_vsi_idx = vsi->idx; vf->lan_vsi_idx = vsi->idx;
vf->lan_vsi_id = vsi->id; vf->lan_vsi_id = vsi->id;
/* If the port VLAN has been configured and then the /* If the port VLAN has been configured and then the
...@@ -605,6 +606,7 @@ static void i40e_enable_vf_mappings(struct i40e_vf *vf) ...@@ -605,6 +606,7 @@ static void i40e_enable_vf_mappings(struct i40e_vf *vf)
/* map PF queues to VF queues */ /* map PF queues to VF queues */
for (j = 0; j < pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; j++) { for (j = 0; j < pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; j++) {
u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, j); u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, j);
reg = (qid & I40E_VPLAN_QTABLE_QINDEX_MASK); reg = (qid & I40E_VPLAN_QTABLE_QINDEX_MASK);
wr32(hw, I40E_VPLAN_QTABLE(total_queue_pairs, vf->vf_id), reg); wr32(hw, I40E_VPLAN_QTABLE(total_queue_pairs, vf->vf_id), reg);
total_queue_pairs++; total_queue_pairs++;
...@@ -991,24 +993,26 @@ static int i40e_pci_sriov_enable(struct pci_dev *pdev, int num_vfs) ...@@ -991,24 +993,26 @@ static int i40e_pci_sriov_enable(struct pci_dev *pdev, int num_vfs)
int pre_existing_vfs = pci_num_vf(pdev); int pre_existing_vfs = pci_num_vf(pdev);
int err = 0; int err = 0;
if (pf->state & __I40E_TESTING) { if (test_bit(__I40E_TESTING, &pf->state)) {
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"Cannot enable SR-IOV virtual functions while the device is undergoing diagnostic testing\n"); "Cannot enable SR-IOV virtual functions while the device is undergoing diagnostic testing\n");
err = -EPERM; err = -EPERM;
goto err_out; goto err_out;
} }
dev_info(&pdev->dev, "Allocating %d VFs.\n", num_vfs);
if (pre_existing_vfs && pre_existing_vfs != num_vfs) if (pre_existing_vfs && pre_existing_vfs != num_vfs)
i40e_free_vfs(pf); i40e_free_vfs(pf);
else if (pre_existing_vfs && pre_existing_vfs == num_vfs) else if (pre_existing_vfs && pre_existing_vfs == num_vfs)
goto out; goto out;
if (num_vfs > pf->num_req_vfs) { if (num_vfs > pf->num_req_vfs) {
dev_warn(&pdev->dev, "Unable to enable %d VFs. Limited to %d VFs due to device resource constraints.\n",
num_vfs, pf->num_req_vfs);
err = -EPERM; err = -EPERM;
goto err_out; goto err_out;
} }
dev_info(&pdev->dev, "Allocating %d VFs.\n", num_vfs);
err = i40e_alloc_vfs(pf, num_vfs); err = i40e_alloc_vfs(pf, num_vfs);
if (err) { if (err) {
dev_warn(&pdev->dev, "Failed to enable SR-IOV: %d\n", err); dev_warn(&pdev->dev, "Failed to enable SR-IOV: %d\n", err);
...@@ -1206,10 +1210,12 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) ...@@ -1206,10 +1210,12 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
if (vf->lan_vsi_idx) { if (vf->lan_vsi_idx) {
vfres->vsi_res[i].vsi_id = vf->lan_vsi_id; vfres->vsi_res[i].vsi_id = vf->lan_vsi_id;
vfres->vsi_res[i].vsi_type = I40E_VSI_SRIOV; vfres->vsi_res[i].vsi_type = I40E_VSI_SRIOV;
vfres->vsi_res[i].num_queue_pairs = vfres->vsi_res[i].num_queue_pairs = vsi->alloc_queue_pairs;
pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; /* VFs only use TC 0 */
memcpy(vfres->vsi_res[i].default_mac_addr, vfres->vsi_res[i].qset_handle
vf->default_lan_addr.addr, ETH_ALEN); = le16_to_cpu(vsi->info.qs_handle[0]);
ether_addr_copy(vfres->vsi_res[i].default_mac_addr,
vf->default_lan_addr.addr);
i++; i++;
} }
set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states); set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
...@@ -1713,6 +1719,7 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) ...@@ -1713,6 +1719,7 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
for (i = 0; i < vfl->num_elements; i++) { for (i = 0; i < vfl->num_elements; i++) {
/* add new VLAN filter */ /* add new VLAN filter */
int ret = i40e_vsi_add_vlan(vsi, vfl->vlan_id[i]); int ret = i40e_vsi_add_vlan(vsi, vfl->vlan_id[i]);
if (ret) if (ret)
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
"Unable to add VF vlan filter %d, error %d\n", "Unable to add VF vlan filter %d, error %d\n",
...@@ -1764,6 +1771,7 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) ...@@ -1764,6 +1771,7 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
for (i = 0; i < vfl->num_elements; i++) { for (i = 0; i < vfl->num_elements; i++) {
int ret = i40e_vsi_kill_vlan(vsi, vfl->vlan_id[i]); int ret = i40e_vsi_kill_vlan(vsi, vfl->vlan_id[i]);
if (ret) if (ret)
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
"Unable to delete VF vlan filter %d, error %d\n", "Unable to delete VF vlan filter %d, error %d\n",
...@@ -1875,7 +1883,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, ...@@ -1875,7 +1883,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,
case I40E_VIRTCHNL_OP_UNKNOWN: case I40E_VIRTCHNL_OP_UNKNOWN:
default: default:
return -EPERM; return -EPERM;
break;
} }
/* few more checks */ /* few more checks */
if ((valid_len != msglen) || (err_msg_format)) { if ((valid_len != msglen) || (err_msg_format)) {
...@@ -2314,7 +2321,7 @@ int i40e_ndo_get_vf_config(struct net_device *netdev, ...@@ -2314,7 +2321,7 @@ int i40e_ndo_get_vf_config(struct net_device *netdev,
ivi->vf = vf_id; ivi->vf = vf_id;
memcpy(&ivi->mac, vf->default_lan_addr.addr, ETH_ALEN); ether_addr_copy(ivi->mac, vf->default_lan_addr.addr);
ivi->max_tx_rate = vf->tx_rate; ivi->max_tx_rate = vf->tx_rate;
ivi->min_tx_rate = 0; ivi->min_tx_rate = 0;
......
...@@ -622,8 +622,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw) ...@@ -622,8 +622,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
details = I40E_ADMINQ_DETAILS(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc);
while (rd32(hw, hw->aq.asq.head) != ntc) { while (rd32(hw, hw->aq.asq.head) != ntc) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"%s: ntc %d head %d.\n", __func__, ntc, "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
rd32(hw, hw->aq.asq.head));
if (details->callback) { if (details->callback) {
I40E_ADMINQ_CALLBACK cb_func = I40E_ADMINQ_CALLBACK cb_func =
......
...@@ -992,10 +992,10 @@ void i40e_vf_parse_hw_config(struct i40e_hw *hw, ...@@ -992,10 +992,10 @@ void i40e_vf_parse_hw_config(struct i40e_hw *hw,
I40E_VIRTCHNL_VF_OFFLOAD_FCOE) ? 1 : 0; I40E_VIRTCHNL_VF_OFFLOAD_FCOE) ? 1 : 0;
for (i = 0; i < msg->num_vsis; i++) { for (i = 0; i < msg->num_vsis; i++) {
if (vsi_res->vsi_type == I40E_VSI_SRIOV) { if (vsi_res->vsi_type == I40E_VSI_SRIOV) {
memcpy(hw->mac.perm_addr, vsi_res->default_mac_addr, ether_addr_copy(hw->mac.perm_addr,
ETH_ALEN); vsi_res->default_mac_addr);
memcpy(hw->mac.addr, vsi_res->default_mac_addr, ether_addr_copy(hw->mac.addr,
ETH_ALEN); vsi_res->default_mac_addr);
} }
vsi_res++; vsi_res++;
} }
......
...@@ -987,6 +987,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget) ...@@ -987,6 +987,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
cleaned_count++; cleaned_count++;
if (rx_hbo || rx_sph) { if (rx_hbo || rx_sph) {
int len; int len;
if (rx_hbo) if (rx_hbo)
len = I40E_RX_HDR_SIZE; len = I40E_RX_HDR_SIZE;
else else
...@@ -1160,9 +1161,6 @@ static int i40e_clean_rx_irq_1buf(struct i40e_ring *rx_ring, int budget) ...@@ -1160,9 +1161,6 @@ static int i40e_clean_rx_irq_1buf(struct i40e_ring *rx_ring, int budget)
/* ERR_MASK will only have valid bits if EOP set */ /* ERR_MASK will only have valid bits if EOP set */
if (unlikely(rx_error & BIT(I40E_RX_DESC_ERROR_RXE_SHIFT))) { if (unlikely(rx_error & BIT(I40E_RX_DESC_ERROR_RXE_SHIFT))) {
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
/* TODO: shouldn't we increment a counter indicating the
* drop?
*/
continue; continue;
} }
...@@ -1358,6 +1356,7 @@ static inline int i40evf_tx_prepare_vlan_flags(struct sk_buff *skb, ...@@ -1358,6 +1356,7 @@ static inline int i40evf_tx_prepare_vlan_flags(struct sk_buff *skb,
/* else if it is a SW VLAN, check the next protocol and store the tag */ /* else if it is a SW VLAN, check the next protocol and store the tag */
} else if (protocol == htons(ETH_P_8021Q)) { } else if (protocol == htons(ETH_P_8021Q)) {
struct vlan_hdr *vhdr, _vhdr; struct vlan_hdr *vhdr, _vhdr;
vhdr = skb_header_pointer(skb, ETH_HLEN, sizeof(_vhdr), &_vhdr); vhdr = skb_header_pointer(skb, ETH_HLEN, sizeof(_vhdr), &_vhdr);
if (!vhdr) if (!vhdr)
return -EINVAL; return -EINVAL;
...@@ -1900,6 +1899,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, ...@@ -1900,6 +1899,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
u32 td_cmd = 0; u32 td_cmd = 0;
u8 hdr_len = 0; u8 hdr_len = 0;
int tso; int tso;
if (0 == i40evf_xmit_descriptor_count(skb, tx_ring)) if (0 == i40evf_xmit_descriptor_count(skb, tx_ring))
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
......
...@@ -164,6 +164,7 @@ struct i40e_tx_buffer { ...@@ -164,6 +164,7 @@ struct i40e_tx_buffer {
}; };
unsigned int bytecount; unsigned int bytecount;
unsigned short gso_segs; unsigned short gso_segs;
DEFINE_DMA_UNMAP_ADDR(dma); DEFINE_DMA_UNMAP_ADDR(dma);
DEFINE_DMA_UNMAP_LEN(len); DEFINE_DMA_UNMAP_LEN(len);
u32 tx_flags; u32 tx_flags;
......
...@@ -160,14 +160,14 @@ enum i40e_set_fc_aq_failures { ...@@ -160,14 +160,14 @@ enum i40e_set_fc_aq_failures {
}; };
enum i40e_vsi_type { enum i40e_vsi_type {
I40E_VSI_MAIN = 0, I40E_VSI_MAIN = 0,
I40E_VSI_VMDQ1, I40E_VSI_VMDQ1 = 1,
I40E_VSI_VMDQ2, I40E_VSI_VMDQ2 = 2,
I40E_VSI_CTRL, I40E_VSI_CTRL = 3,
I40E_VSI_FCOE, I40E_VSI_FCOE = 4,
I40E_VSI_MIRROR, I40E_VSI_MIRROR = 5,
I40E_VSI_SRIOV, I40E_VSI_SRIOV = 6,
I40E_VSI_FDIR, I40E_VSI_FDIR = 7,
I40E_VSI_TYPE_UNKNOWN I40E_VSI_TYPE_UNKNOWN
}; };
...@@ -504,8 +504,9 @@ struct i40e_hw { ...@@ -504,8 +504,9 @@ struct i40e_hw {
u16 dcbx_status; u16 dcbx_status;
/* DCBX info */ /* DCBX info */
struct i40e_dcbx_config local_dcbx_config; struct i40e_dcbx_config local_dcbx_config; /* Oper/Local Cfg */
struct i40e_dcbx_config remote_dcbx_config; struct i40e_dcbx_config remote_dcbx_config; /* Peer Cfg */
struct i40e_dcbx_config desired_dcbx_config; /* CEE Desired Cfg */
/* debug mask */ /* debug mask */
u32 debug_mask; u32 debug_mask;
......
...@@ -48,10 +48,6 @@ ...@@ -48,10 +48,6 @@
#define DEFAULT_DEBUG_LEVEL_SHIFT 3 #define DEFAULT_DEBUG_LEVEL_SHIFT 3
#define PFX "i40evf: " #define PFX "i40evf: "
#define DPRINTK(nlevel, klevel, fmt, args...) \
((void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
__func__ , ## args)))
/* dummy struct to make common code less painful */ /* dummy struct to make common code less painful */
struct i40e_vsi { struct i40e_vsi {
...@@ -70,6 +66,7 @@ struct i40e_vsi { ...@@ -70,6 +66,7 @@ struct i40e_vsi {
*/ */
u16 rx_itr_setting; u16 rx_itr_setting;
u16 tx_itr_setting; u16 tx_itr_setting;
u16 qs_handle;
}; };
/* How many Rx Buffers do we bundle into one write to the hardware ? */ /* How many Rx Buffers do we bundle into one write to the hardware ? */
......
...@@ -730,6 +730,8 @@ static int i40evf_vlan_rx_add_vid(struct net_device *netdev, ...@@ -730,6 +730,8 @@ static int i40evf_vlan_rx_add_vid(struct net_device *netdev,
{ {
struct i40evf_adapter *adapter = netdev_priv(netdev); struct i40evf_adapter *adapter = netdev_priv(netdev);
if (!VLAN_ALLOWED(adapter))
return -EIO;
if (i40evf_add_vlan(adapter, vid) == NULL) if (i40evf_add_vlan(adapter, vid) == NULL)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
...@@ -745,8 +747,11 @@ static int i40evf_vlan_rx_kill_vid(struct net_device *netdev, ...@@ -745,8 +747,11 @@ static int i40evf_vlan_rx_kill_vid(struct net_device *netdev,
{ {
struct i40evf_adapter *adapter = netdev_priv(netdev); struct i40evf_adapter *adapter = netdev_priv(netdev);
i40evf_del_vlan(adapter, vid); if (VLAN_ALLOWED(adapter)) {
return 0; i40evf_del_vlan(adapter, vid);
return 0;
}
return -EIO;
} }
/** /**
...@@ -1419,16 +1424,16 @@ static void i40evf_watchdog_task(struct work_struct *work) ...@@ -1419,16 +1424,16 @@ static void i40evf_watchdog_task(struct work_struct *work)
struct i40evf_adapter, struct i40evf_adapter,
watchdog_task); watchdog_task);
struct i40e_hw *hw = &adapter->hw; struct i40e_hw *hw = &adapter->hw;
uint32_t rstat_val; u32 reg_val;
if (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section)) if (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section))
goto restart_watchdog; goto restart_watchdog;
if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) { if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) {
rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & reg_val = rd32(hw, I40E_VFGEN_RSTAT) &
I40E_VFGEN_RSTAT_VFR_STATE_MASK; I40E_VFGEN_RSTAT_VFR_STATE_MASK;
if ((rstat_val == I40E_VFR_VFACTIVE) || if ((reg_val == I40E_VFR_VFACTIVE) ||
(rstat_val == I40E_VFR_COMPLETED)) { (reg_val == I40E_VFR_COMPLETED)) {
/* A chance for redemption! */ /* A chance for redemption! */
dev_err(&adapter->pdev->dev, "Hardware came out of reset. Attempting reinit.\n"); dev_err(&adapter->pdev->dev, "Hardware came out of reset. Attempting reinit.\n");
adapter->state = __I40EVF_STARTUP; adapter->state = __I40EVF_STARTUP;
...@@ -1453,11 +1458,8 @@ static void i40evf_watchdog_task(struct work_struct *work) ...@@ -1453,11 +1458,8 @@ static void i40evf_watchdog_task(struct work_struct *work)
goto watchdog_done; goto watchdog_done;
/* check for reset */ /* check for reset */
rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & reg_val = rd32(hw, I40E_VF_ARQLEN1) & I40E_VF_ARQLEN1_ARQENABLE_MASK;
I40E_VFGEN_RSTAT_VFR_STATE_MASK; if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING) && !reg_val) {
if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING) &&
(rstat_val != I40E_VFR_VFACTIVE) &&
(rstat_val != I40E_VFR_COMPLETED)) {
adapter->state = __I40EVF_RESETTING; adapter->state = __I40EVF_RESETTING;
adapter->flags |= I40EVF_FLAG_RESET_PENDING; adapter->flags |= I40EVF_FLAG_RESET_PENDING;
dev_err(&adapter->pdev->dev, "Hardware reset detected\n"); dev_err(&adapter->pdev->dev, "Hardware reset detected\n");
...@@ -1572,7 +1574,7 @@ static void i40evf_reset_task(struct work_struct *work) ...@@ -1572,7 +1574,7 @@ static void i40evf_reset_task(struct work_struct *work)
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct i40e_hw *hw = &adapter->hw; struct i40e_hw *hw = &adapter->hw;
struct i40evf_mac_filter *f; struct i40evf_mac_filter *f;
uint32_t rstat_val; u32 reg_val;
int i = 0, err; int i = 0, err;
while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,
...@@ -1593,12 +1595,11 @@ static void i40evf_reset_task(struct work_struct *work) ...@@ -1593,12 +1595,11 @@ static void i40evf_reset_task(struct work_struct *work)
/* poll until we see the reset actually happen */ /* poll until we see the reset actually happen */
for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & reg_val = rd32(hw, I40E_VF_ARQLEN1) &
I40E_VFGEN_RSTAT_VFR_STATE_MASK; I40E_VF_ARQLEN1_ARQENABLE_MASK;
if ((rstat_val != I40E_VFR_VFACTIVE) && if (!reg_val)
(rstat_val != I40E_VFR_COMPLETED))
break; break;
usleep_range(500, 1000); usleep_range(5000, 10000);
} }
if (i == I40EVF_RESET_WAIT_COUNT) { if (i == I40EVF_RESET_WAIT_COUNT) {
dev_info(&adapter->pdev->dev, "Never saw reset\n"); dev_info(&adapter->pdev->dev, "Never saw reset\n");
...@@ -1607,9 +1608,9 @@ static void i40evf_reset_task(struct work_struct *work) ...@@ -1607,9 +1608,9 @@ static void i40evf_reset_task(struct work_struct *work)
/* wait until the reset is complete and the PF is responding to us */ /* wait until the reset is complete and the PF is responding to us */
for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) { for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
rstat_val = rd32(hw, I40E_VFGEN_RSTAT) & reg_val = rd32(hw, I40E_VFGEN_RSTAT) &
I40E_VFGEN_RSTAT_VFR_STATE_MASK; I40E_VFGEN_RSTAT_VFR_STATE_MASK;
if (rstat_val == I40E_VFR_VFACTIVE) if (reg_val == I40E_VFR_VFACTIVE)
break; break;
msleep(I40EVF_RESET_WAIT_MS); msleep(I40EVF_RESET_WAIT_MS);
} }
...@@ -1621,7 +1622,7 @@ static void i40evf_reset_task(struct work_struct *work) ...@@ -1621,7 +1622,7 @@ static void i40evf_reset_task(struct work_struct *work)
/* reset never finished */ /* reset never finished */
dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n", dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n",
rstat_val); reg_val);
adapter->flags |= I40EVF_FLAG_PF_COMMS_FAILED; adapter->flags |= I40EVF_FLAG_PF_COMMS_FAILED;
if (netif_running(adapter->netdev)) { if (netif_running(adapter->netdev)) {
...@@ -2114,6 +2115,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter) ...@@ -2114,6 +2115,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
adapter->vsi.tx_itr_setting = (I40E_ITR_DYNAMIC | adapter->vsi.tx_itr_setting = (I40E_ITR_DYNAMIC |
ITR_REG_TO_USEC(I40E_ITR_TX_DEF)); ITR_REG_TO_USEC(I40E_ITR_TX_DEF));
adapter->vsi.netdev = adapter->netdev; adapter->vsi.netdev = adapter->netdev;
adapter->vsi.qs_handle = adapter->vsi_res->qset_handle;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment