i40e/i40evf updates
Subsystems (2)
cover i40e/i40evf updates
Alexander Duyck adds code to be much more verbose about what we can and cannot offload.
Jacob Keller removes unnecessary label from i40e_vc_config_promiscuous_mode_msg, removes second check of VLAN_N_VID in i40e_vlan_rx_add_vid, adds code to avoid duplicate private flags definitions & fixes trivial typo in naming of i40e_sync_filters_subtask.
Matt Jared adds code to fix compile error due to type conflict.
Michal Kosiarz adds Clause22 implementation.
Piotr Raczynski adds protocols over MCTP to i40e_aq_discover_capabilities.
drivers/net/ethernet/intel/i40e/i40e_common.c | 188 ++++++++++++++++----- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 42 ++--- drivers/net/ethernet/intel/i40e/i40e_main.c | 60 +++++-- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 12 +- drivers/net/ethernet/intel/i40e/i40e_type.h | 23 ++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 +- drivers/net/ethernet/intel/i40evf/i40e_type.h | 4 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 59 +++++++ 8 files changed, 303 insertions(+), 92 deletions(-)
Signature · 1 line
2.4.11
PATCH 1/9 i40e: Be much more verbose about what we can and cannot offload
From: Alexander Duyck <[email protected]>
This change makes it so that we are much more robust about defining what we can and cannot offload. Previously we were just checking for the L4 tunnel header length, however there are other fields we should be verifying as there are multiple scenarios in which we cannot perform hardware offloads.
In addition the device only supports GSO as long as the MSS is 64 or greater. We were not checking this so an MSS less than that was resulting in Tx hangs.
---
Testing Hints:
This is half of the fix needed to address MSS less than 64. This is the fix for upstream and kernels after 3.18.4, but we will need to come up with a separate fix for out-of-tree that can be stripped on kernels prior to 3.18.4.
An easy test for this patch is to just set the MTU for an interface to a value 102. Without this patch we should see Tx hangs with netperf and with we should be able to pass traffic without triggering Tx hangs.
drivers/net/ethernet/intel/i40e/i40e_main.c | 52 ++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +44 -8
@@ -9114,10 +9114,6 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, nlflags, 0, 0, filter_mask, NULL); } -/* Hardware supports L4 tunnel length of 128B (=2^7) which includes -* inner mac plus all inner ethertypes. -*/ -#define I40E_MAX_TUNNEL_HDR_LEN 128/** * i40e_features_check - Validate encapsulated packet conforms to limits * @skb: skb buff
@@ -9128,12 +9124,52 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb,struct net_device *dev, netdev_features_t features) { -if (skb->encapsulation && - ((skb_inner_network_header (skb) -skb_transport_header (skb)) > -I40E_MAX_TUNNEL_HDR_LEN )) -return features & ~(NETIF_F_CSUM_MASK |NETIF_F_GSO_MASK ); + size_t len; + +/* No point in doing any of this if neither checksum nor GSO are +* being requested for this frame. We can rule out both by just +* checking for CHECKSUM_PARTIAL +*/ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) +return features; + +/* We cannot support GSO if the MSS is going to be less than +* 64 bytes. If it is then we need to drop support for GSO. +*/ +if (skb_is_gso (skb) && (skb_shinfo (skb)->gso_size <64 )) + features &= ~NETIF_F_GSO_MASK ; + +/* MACLEN can support@most 63 words */ + len =skb_network_header (skb) - skb->data; +if (len & ~(63 *2 )) + goto out_err; + +/* IPLEN and EIPLEN can support at most 127 dwords */ + len =skb_transport_header (skb) -skb_network_header (skb); +if (len & ~(127 *4 )) + goto out_err; + +if (skb->encapsulation) { +/* L4TUNLEN can support 127 words */ + len =skb_inner_network_header (skb) -skb_transport_header (skb); +if (len & ~(127 *2 )) + goto out_err; + +/* IPLEN can support at most 127 dwords */ + len =skb_inner_transport_header (skb) - +skb_inner_network_header (skb); +if (len & ~(127 *4 )) + goto out_err; + } + +/* No need to validate L4LEN as TCP is the only protocol with a +* a flexible value and we support all possible values supported +* by TCP, which is at most 15 dwords +*/ return features; +out_err: +return features & ~(NETIF_F_CSUM_MASK |NETIF_F_GSO_MASK ); } static const struct net_device_ops i40e_netdev_ops = {
Signature · 1 line
2.4.11
PATCH 2/9 i40evf: Be much more verbose about what we can and cannot offload
In reply to Bimmy PujariFrom: Alexander Duyck <[email protected]>
This change makes it so that we are much more robust about defining what we can and cannot offload. Previously we were performing no checks. This should bring us up to parity with the i40e PF driver.
In addition the device only supports GSO as long as the MSS is 64 or greater. We were not checking this so an MSS less than that was resulting in Tx hangs.
---
Testing Hints:
This is half of the fix needed to address MSS less than 64. This is the fix for upstream and kernels after 3.18.4, but we will need to come up with a separate fix for out-of-tree that can be stripped on kernels prior to 3.18.4.
An easy test for this patch is to just set the MTU for an interface to a value 102. Without this patch we should see Tx hangs with netperf and with we should be able to pass traffic without triggering Tx hangs.
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 59 +++++++++++++++++++++++++ 1 file changed, 59 insertions(+)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +59 -0
@@ -2178,6 +2178,64 @@ static int i40evf_change_mtu(struct net_device *netdev, int new_mtu)return 0 ; } +/** +* i40evf_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 i40evf_features_check (struct sk_buff *skb, +struct net_device *dev, +netdev_features_t features) +{ +size_t len; + +/* No point in doing any of this if neither checksum nor GSO are +* being requested for this frame. We can rule out both by just +* checking for CHECKSUM_PARTIAL +*/ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) +return features; + +/* We cannot support GSO if the MSS is going to be less than +* 64 bytes. If it is then we need to drop support for GSO. +*/ +if (skb_is_gso (skb) && (skb_shinfo (skb)->gso_size <64 )) + features &= ~NETIF_F_GSO_MASK ; + +/* MACLEN can support@most 63 words */ + len =skb_network_header (skb) - skb->data; +if (len & ~(63 *2 )) + goto out_err; + +/* IPLEN and EIPLEN can support at most 127 dwords */ + len =skb_transport_header (skb) -skb_network_header (skb); +if (len & ~(127 *4 )) + goto out_err; + +if (skb->encapsulation) { +/* L4TUNLEN can support 127 words */ + len =skb_inner_network_header (skb) -skb_transport_header (skb); +if (len & ~(127 *2 )) + goto out_err; + +/* IPLEN can support at most 127 dwords */ + len =skb_inner_transport_header (skb) - +skb_inner_network_header (skb); +if (len & ~(127 *4 )) + goto out_err; + } + +/* No need to validate L4LEN as TCP is the only protocol with a +* a flexible value and we support all possible values supported +* by TCP, which is at most 15 dwords +*/ + +return features; +out_err: +return features & ~(NETIF_F_CSUM_MASK |NETIF_F_GSO_MASK ); +} +#define I40EVF_VLAN_FEATURES (NETIF_F_HW_VLAN_CTAG_TX |\ NETIF_F_HW_VLAN_CTAG_RX |\ NETIF_F_HW_VLAN_CTAG_FILTER)
@@ -2212,6 +2270,7 @@ static const struct net_device_ops i40evf_netdev_ops = { .ndo_tx_timeout = i40evf_tx_timeout, .ndo_vlan_rx_add_vid = i40evf_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = i40evf_vlan_rx_kill_vid, + .ndo_features_check = i40evf_features_check, .ndo_fix_features = i40evf_fix_features, #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = i40evf_netpoll,
Signature · 1 line
2.4.11
PATCH 3/9 i40e: remove error_param_int label from i40e_vc_config_promiscuous_mode_msg
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
This label is unnecessary, as are jumping to a block that checks aq_ret and then immediately skipping it and returning. So just jump straight to the error_param and remove this unnecessary label.
Also use goto error_param even in the last check for style consistency.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +4 -3
@@ -1543,7 +1543,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, vf->vf_id,i40e_stat_str (&pf->hw, aq_ret), i40e_aq_str(&pf->hw, aq_err)); - goto error_param_int; + goto error_param; } }
@@ -1588,15 +1588,16 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, allmulti,NULL , true); aq_err = pf->hw.aq.asq_last_status; -if (aq_ret) +if (aq_ret) {dev_err (&pf->pdev->dev,"VF %d failed to set unicast promiscuous mode %8.8x err %s aq_err %s\n" , vf->vf_id, info->flags,i40e_stat_str (&pf->hw, aq_ret),i40e_aq_str (&pf->hw, aq_err)); + goto error_param; + } } -error_param_int:if (!aq_ret) { dev_info(&pf->pdev->dev, "VF %d successfully set unicast promiscuous mode\n",
Signature · 1 line
2.4.11
PATCH 4/9 i40e: remove second check of VLAN_N_VID in i40e_vlan_rx_add_vid
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
Replace a check of magic number 4095 with VLAN_N_VID. This makes it obvious that a later check against VLAN_N_VID is always true and can be removed
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -2
@@ -2591,7 +2591,7 @@ static int i40e_vlan_rx_add_vid(struct net_device *netdev,struct i40e_vsi *vsi = np->vsi;int ret =0 ; -if (vid >4095 ) +if (vid >=VLAN_N_VID )return -EINVAL ;/* If the network stack called us with vid = 0 then
@@ -2603,7 +2603,7 @@ static int i40e_vlan_rx_add_vid(struct net_device *netdev,if (vid) ret =i40e_vsi_add_vlan (vsi, vid); -if (!ret && (vid <VLAN_N_VID )) +if (!ret)set_bit (vid, vsi->active_vlans);return ret;
Signature · 1 line
2.4.11
PATCH 5/9 i40e: avoid duplicate private flags definitions
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
Separate the global private flags and the regular private flags per interface into two arrays. Future additions of private flags will not need to be duplicated which may lead to buggy code. Also rename "i40e_priv_flags_strings_gl" to "i40e_gl_priv_flags_strings" for clarity, as it reads more naturally.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 42 +++++++++++--------------- 1 file changed, 17 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +17 -25
@@ -228,26 +228,22 @@ static const char i40e_gstrings_test[][ETH_GSTRING_LEN] = {#define I40E_TEST_LEN (sizeof(i40e_gstrings_test) / ETH_GSTRING_LEN) -static const char i40e_priv_flags_strings_gl[][ETH_GSTRING_LEN ] = { +static const char i40e_priv_flags_strings[][ETH_GSTRING_LEN ] = {"MFP" ,"LinkPolling" ,"flow-director-atr" ,"veb-stats" ,"hw-atr-eviction" , -"vf-true-promisc-support" , }; -#define I40E_PRIV_FLAGS_GL_STR_LEN ARRAY_SIZE(i40e_priv_flags_strings_gl) +#define I40E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_priv_flags_strings) -static const char i40e_priv_flags_strings[][ETH_GSTRING_LEN ] = { -"NPAR" , -"LinkPolling" , -"flow-director-atr" , -"veb-stats" , -"hw-atr-eviction" , +/* Private flags with a global effect, restricted to PF 0 */ +static const char i40e_gl_priv_flags_strings[][ETH_GSTRING_LEN ] = { +"vf-true-promisc-support" , }; -#define I40E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_priv_flags_strings) +#define I40E_GL_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_gl_priv_flags_strings)/** * i40e_partition_setting_complaint - generic complaint for MFP restriction
@@ -1198,10 +1194,9 @@ static void i40e_get_drvinfo(struct net_device *netdev, sizeof(drvinfo->fw_version));strlcpy (drvinfo->bus_info,pci_name (pf->pdev),sizeof (drvinfo->bus_info)); + drvinfo->n_priv_flags =I40E_PRIV_FLAGS_STR_LEN ;if (pf->hw.pf_id ==0 ) - drvinfo->n_priv_flags =I40E_PRIV_FLAGS_GL_STR_LEN ; -else - drvinfo->n_priv_flags =I40E_PRIV_FLAGS_STR_LEN ; + drvinfo->n_priv_flags +=I40E_GL_PRIV_FLAGS_STR_LEN ; } static void i40e_get_ringparam(struct net_device *netdev,
@@ -1429,10 +1424,8 @@ static int i40e_get_sset_count(struct net_device *netdev, int sset)return I40E_VSI_STATS_LEN (netdev); }case ETH_SS_PRIV_FLAGS : -if (pf->hw.pf_id ==0 ) -return I40E_PRIV_FLAGS_GL_STR_LEN ; -else -return I40E_PRIV_FLAGS_STR_LEN ; +return I40E_PRIV_FLAGS_STR_LEN + + (pf->hw.pf_id ==0 ?I40E_GL_PRIV_FLAGS_STR_LEN :0 );default :return -EOPNOTSUPP ; }
@@ -1630,15 +1623,14 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset,/* BUG_ON(p - data != I40E_STATS_LEN * ETH_GSTRING_LEN); */ break ;case ETH_SS_PRIV_FLAGS : +for (i =0 ; i <I40E_PRIV_FLAGS_STR_LEN ; i++) { +memcpy (data, i40e_priv_flags_strings[i], +ETH_GSTRING_LEN ); + data +=ETH_GSTRING_LEN ; + }if (pf->hw.pf_id ==0 ) { -for (i =0 ; i <I40E_PRIV_FLAGS_GL_STR_LEN ; i++) { -memcpy (data, i40e_priv_flags_strings_gl[i], -ETH_GSTRING_LEN ); - data +=ETH_GSTRING_LEN ; - } - }else { -for (i =0 ; i <I40E_PRIV_FLAGS_STR_LEN ; i++) { -memcpy (data, i40e_priv_flags_strings[i], +for (i =0 ; i <I40E_GL_PRIV_FLAGS_STR_LEN ; i++) { +memcpy (data, i40e_gl_priv_flags_strings[i],ETH_GSTRING_LEN ); data +=ETH_GSTRING_LEN ; }
Signature · 1 line
2.4.11
PATCH 6/9 i40e: Add Clause22 implementation
In reply to Bimmy PujariFrom: Michal Kosiarz <[email protected]>
Some external PHYs require Clause22 method for accessing registers. This patch also adds some defines to support blink led on devices using 10CBaseT PHY.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 180 +++++++++++++++++------ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 12 +- drivers/net/ethernet/intel/i40e/i40e_type.h | 19 ++- 3 files changed, 159 insertions(+), 52 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +137 -43
@@ -4430,7 +4430,99 @@ i40e_status i40e_aq_configure_partition_bw(struct i40e_hw *hw, }/** -* i40e_read_phy_register +* i40e_read_phy_register_clause22 +* @hw: pointer to the HW structure +* @reg: register address in the page +* @phy_adr: PHY address on MDIO interface +* @value: PHY register value +* +* Reads specified PHY register value +**/ +i40e_status i40e_read_phy_register_clause22 (struct i40e_hw *hw, +u16 reg,u8 phy_addr,u16 *value) +{ +i40e_status status =I40E_ERR_TIMEOUT ; +u8 port_num = hw->func_caps.mdio_port_num; +u32 command =0 ; +u16 retry =1000 ; + + command = (reg <<I40E_GLGEN_MSCA_DEVADD_SHIFT ) | + (phy_addr <<I40E_GLGEN_MSCA_PHYADD_SHIFT ) | + (I40E_MDIO_CLAUSE22_OPCODE_READ_MASK ) | + (I40E_MDIO_CLAUSE22_STCODE_MASK ) | + (I40E_GLGEN_MSCA_MDICMD_MASK ); +wr32 (hw,I40E_GLGEN_MSCA (port_num), command); +do { + command =rd32 (hw,I40E_GLGEN_MSCA (port_num)); +if (!(command &I40E_GLGEN_MSCA_MDICMD_MASK )) { + status =0 ; +break ; + } +udelay (10 ); + retry--; + }while (retry); + +if (status) { +i40e_debug (hw,I40E_DEBUG_PHY , +"PHY: Can't write command to external PHY.\n" ); + goto phy_read_end; + } + +if (!status) { + command =rd32 (hw,I40E_GLGEN_MSRWD (port_num)); + *value = (command &I40E_GLGEN_MSRWD_MDIRDDATA_MASK ) >> +I40E_GLGEN_MSRWD_MDIRDDATA_SHIFT ; + }else { +i40e_debug (hw,I40E_DEBUG_PHY , +"PHY: Can't read register value from external PHY.\n" ); + } + +phy_read_end: +return status; +} + +/** +* i40e_write_phy_register_clause22 +* @hw: pointer to the HW structure +* @reg: register address in the page +* @phy_adr: PHY address on MDIO interface +* @value: PHY register value +* +* Writes specified PHY register value +**/ +i40e_status i40e_write_phy_register_clause22 (struct i40e_hw *hw, +u16 reg,u8 phy_addr,u16 value) +{ +i40e_status status =I40E_ERR_TIMEOUT ; +u32 command =0 ; +u16 retry =1000 ; +u8 port_num = hw->func_caps.mdio_port_num; + + command = value <<I40E_GLGEN_MSRWD_MDIWRDATA_SHIFT ; +wr32 (hw,I40E_GLGEN_MSRWD (port_num), command); + + command = (reg <<I40E_GLGEN_MSCA_DEVADD_SHIFT ) | + (phy_addr <<I40E_GLGEN_MSCA_PHYADD_SHIFT ) | + (I40E_MDIO_CLAUSE22_OPCODE_WRITE_MASK ) | + (I40E_MDIO_CLAUSE22_STCODE_MASK ) | + (I40E_GLGEN_MSCA_MDICMD_MASK ); + +wr32 (hw,I40E_GLGEN_MSCA (port_num), command); +do { + command =rd32 (hw,I40E_GLGEN_MSCA (port_num)); +if (!(command &I40E_GLGEN_MSCA_MDICMD_MASK )) { + status =0 ; +break ; + } +udelay (10 ); + retry--; + }while (retry); + +return status; +} + +/** +* i40e_read_phy_register_clause45 * @hw: pointer to the HW structure * @page: registers page number * @reg: register address in the page
@@ -4439,9 +4531,8 @@ i40e_status i40e_aq_configure_partition_bw(struct i40e_hw *hw,* * Reads specified PHY register value **/ -i40e_status i40e_read_phy_register (struct i40e_hw *hw, -u8 page,u16 reg,u8 phy_addr, -u16 *value) +i40e_status i40e_read_phy_register_clause45 (struct i40e_hw *hw, +u8 page,u16 reg,u8 phy_addr,u16 *value) {i40e_status status =I40E_ERR_TIMEOUT ;u32 command =0 ;
@@ -4451,8 +4542,8 @@ i40e_status i40e_read_phy_register(struct i40e_hw *hw, command = (reg <<I40E_GLGEN_MSCA_MDIADD_SHIFT ) | (page <<I40E_GLGEN_MSCA_DEVADD_SHIFT ) | (phy_addr <<I40E_GLGEN_MSCA_PHYADD_SHIFT ) | - (I40E_MDIO_OPCODE_ADDRESS ) | - (I40E_MDIO_STCODE ) | + (I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK ) | + (I40E_MDIO_CLAUSE45_STCODE_MASK ) | (I40E_GLGEN_MSCA_MDICMD_MASK ) | (I40E_GLGEN_MSCA_MDIINPROGEN_MASK );wr32 (hw,I40E_GLGEN_MSCA (port_num), command);
@@ -4474,8 +4565,8 @@ i40e_status i40e_read_phy_register(struct i40e_hw *hw, command = (page <<I40E_GLGEN_MSCA_DEVADD_SHIFT ) | (phy_addr <<I40E_GLGEN_MSCA_PHYADD_SHIFT ) | - (I40E_MDIO_OPCODE_READ ) | - (I40E_MDIO_STCODE ) | + (I40E_MDIO_CLAUSE45_OPCODE_READ_MASK ) | + (I40E_MDIO_CLAUSE45_STCODE_MASK ) | (I40E_GLGEN_MSCA_MDICMD_MASK ) | (I40E_GLGEN_MSCA_MDIINPROGEN_MASK ); status =I40E_ERR_TIMEOUT ;
@@ -4505,7 +4596,7 @@ i40e_status i40e_read_phy_register(struct i40e_hw *hw, }/** -* i40e_write_phy_register +* i40e_write_phy_register_clause45 * @hw: pointer to the HW structure * @page: registers page number * @reg: register address in the page
@@ -4514,9 +4605,8 @@ i40e_status i40e_read_phy_register(struct i40e_hw *hw,* * Writes value to specified PHY register **/ -i40e_status i40e_write_phy_register (struct i40e_hw *hw, -u8 page,u16 reg,u8 phy_addr, -u16 value) +i40e_status i40e_write_phy_register_clause45 (struct i40e_hw *hw, +u8 page,u16 reg,u8 phy_addr,u16 value) {i40e_status status =I40E_ERR_TIMEOUT ;u32 command =0 ;
@@ -4526,8 +4616,8 @@ i40e_status i40e_write_phy_register(struct i40e_hw *hw, command = (reg <<I40E_GLGEN_MSCA_MDIADD_SHIFT ) | (page <<I40E_GLGEN_MSCA_DEVADD_SHIFT ) | (phy_addr <<I40E_GLGEN_MSCA_PHYADD_SHIFT ) | - (I40E_MDIO_OPCODE_ADDRESS ) | - (I40E_MDIO_STCODE ) | + (I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK ) | + (I40E_MDIO_CLAUSE45_STCODE_MASK ) | (I40E_GLGEN_MSCA_MDICMD_MASK ) | (I40E_GLGEN_MSCA_MDIINPROGEN_MASK );wr32 (hw,I40E_GLGEN_MSCA (port_num), command);
@@ -4551,8 +4641,8 @@ i40e_status i40e_write_phy_register(struct i40e_hw *hw, command = (page <<I40E_GLGEN_MSCA_DEVADD_SHIFT ) | (phy_addr <<I40E_GLGEN_MSCA_PHYADD_SHIFT ) | - (I40E_MDIO_OPCODE_WRITE ) | - (I40E_MDIO_STCODE ) | + (I40E_MDIO_CLAUSE45_OPCODE_WRITE_MASK ) | + (I40E_MDIO_CLAUSE45_STCODE_MASK ) | (I40E_GLGEN_MSCA_MDICMD_MASK ) | (I40E_GLGEN_MSCA_MDIINPROGEN_MASK ); status =I40E_ERR_TIMEOUT ;
@@ -4614,14 +4704,16 @@ i40e_status i40e_blink_phy_link_led(struct i40e_hw *hw,for (gpio_led_port =0 ; gpio_led_port <3 ; gpio_led_port++, led_addr++) { - status =i40e_read_phy_register (hw,I40E_PHY_COM_REG_PAGE , - led_addr, phy_addr, &led_reg); + status =i40e_read_phy_register_clause45 (hw, +I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, + &led_reg);if (status) goto phy_blinking_end; led_ctl = led_reg;if (led_reg &I40E_PHY_LED_LINK_MODE_MASK ) { led_reg =0 ; - status =i40e_write_phy_register (hw, + status =i40e_write_phy_register_clause45 (hw,I40E_PHY_COM_REG_PAGE , led_addr, phy_addr, led_reg);
@@ -4633,20 +4725,18 @@ i40e_status i40e_blink_phy_link_led(struct i40e_hw *hw,if (time >0 && interval >0 ) {for (i =0 ; i < time *1000 ; i += interval) { - status =i40e_read_phy_register (hw, -I40E_PHY_COM_REG_PAGE , - led_addr, phy_addr, - &led_reg); + status =i40e_read_phy_register_clause45 (hw, +I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, &led_reg);if (status) goto restore_config;if (led_reg &I40E_PHY_LED_MANUAL_ON ) led_reg =0 ;else led_reg =I40E_PHY_LED_MANUAL_ON ; - status =i40e_write_phy_register (hw, -I40E_PHY_COM_REG_PAGE , - led_addr, phy_addr, - led_reg); + status =i40e_write_phy_register_clause45 (hw, +I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, led_reg);if (status) goto restore_config;msleep (interval);
@@ -4654,8 +4744,9 @@ i40e_status i40e_blink_phy_link_led(struct i40e_hw *hw, } restore_config: - status =i40e_write_phy_register (hw,I40E_PHY_COM_REG_PAGE , led_addr, - phy_addr, led_ctl); + status =i40e_write_phy_register_clause45 (hw, +I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, led_ctl); phy_blinking_end:return status;
@@ -4686,8 +4777,10 @@ i40e_status i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,for (gpio_led_port =0 ; gpio_led_port <3 ; gpio_led_port++, temp_addr++) { - status =i40e_read_phy_register (hw,I40E_PHY_COM_REG_PAGE , - temp_addr, phy_addr, ®_val); + status =i40e_read_phy_register_clause45 (hw, +I40E_PHY_COM_REG_PAGE , + temp_addr, phy_addr, + ®_val);if (status)return status; *val = reg_val;
@@ -4720,41 +4813,42 @@ i40e_status i40e_led_set_phy(struct i40e_hw *hw, bool on, i =rd32 (hw,I40E_PFGEN_PORTNUM ); port_num = (u8)(i &I40E_PFGEN_PORTNUM_PORT_NUM_MASK ); phy_addr =i40e_get_phy_address (hw, port_num); - - status =i40e_read_phy_register (hw,I40E_PHY_COM_REG_PAGE , led_addr, - phy_addr, &led_reg); + status =i40e_read_phy_register_clause45 (hw,I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, &led_reg);if (status)return status; led_ctl = led_reg;if (led_reg &I40E_PHY_LED_LINK_MODE_MASK ) { led_reg =0 ; - status =i40e_write_phy_register (hw,I40E_PHY_COM_REG_PAGE , - led_addr, phy_addr, led_reg); + status =i40e_write_phy_register_clause45 (hw, +I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, + led_reg);if (status)return status; } - status =i40e_read_phy_register (hw,I40E_PHY_COM_REG_PAGE , - led_addr, phy_addr, &led_reg); + status =i40e_read_phy_register_clause45 (hw,I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, &led_reg);if (status) goto restore_config;if (on) led_reg =I40E_PHY_LED_MANUAL_ON ;else led_reg =0 ; - status =i40e_write_phy_register (hw,I40E_PHY_COM_REG_PAGE , - led_addr, phy_addr, led_reg); + status =i40e_write_phy_register_clause45 (hw,I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, led_reg);if (status) goto restore_config;if (mode &I40E_PHY_LED_MODE_ORIG ) { led_ctl = (mode &I40E_PHY_LED_MODE_MASK ); - status =i40e_write_phy_register (hw, + status =i40e_write_phy_register_clause45 (hw,I40E_PHY_COM_REG_PAGE , led_addr, phy_addr, led_ctl); }return status; restore_config: - status =i40e_write_phy_register (hw,I40E_PHY_COM_REG_PAGE , led_addr, - phy_addr, led_ctl); + status =i40e_write_phy_register_clause45 (hw,I40E_PHY_COM_REG_PAGE , + led_addr, phy_addr, led_ctl);return status; }
drivers/net/ethernet/intel/i40e/i40e_prototype.h +8 -4
@@ -365,10 +365,14 @@ i40e_status i40e_aq_rx_ctl_write_register(struct i40e_hw *hw, u32 reg_addr, u32 reg_val, struct i40e_asq_cmd_details *cmd_details);void i40e_write_rx_ctl (struct i40e_hw *hw,u32 reg_addr,u32 reg_val); -i40e_status i40e_read_phy_register (struct i40e_hw *hw,u8 page, -u16 reg,u8 phy_addr,u16 *value); -i40e_status i40e_write_phy_register (struct i40e_hw *hw,u8 page, -u16 reg,u8 phy_addr,u16 value); +i40e_status i40e_read_phy_register_clause22 (struct i40e_hw *hw, +u16 reg,u8 phy_addr,u16 *value); +i40e_status i40e_write_phy_register_clause22 (struct i40e_hw *hw, +u16 reg,u8 phy_addr,u16 value); +i40e_status i40e_read_phy_register_clause45 (struct i40e_hw *hw, +u8 page,u16 reg,u8 phy_addr,u16 *value); +i40e_status i40e_write_phy_register_clause45 (struct i40e_hw *hw, +u8 page,u16 reg,u8 phy_addr,u16 value);u8 i40e_get_phy_address (struct i40e_hw *hw,u8 dev_num);i40e_status i40e_blink_phy_link_led (struct i40e_hw *hw,u32 time,u32 interval);
drivers/net/ethernet/intel/i40e/i40e_type.h +14 -5
@@ -90,14 +90,23 @@ enum i40e_debug_mask { I40E_DEBUG_ALL = 0xFFFFFFFF }; -#define I40E_MDIO_STCODE 0 -#define I40E_MDIO_OPCODE_ADDRESS 0 -#define I40E_MDIO_OPCODE_WRITE I40E_MASK(1, \ +#define I40E_MDIO_CLAUSE22_STCODE_MASK I40E_MASK(1, \ + I40E_GLGEN_MSCA_STCODE_SHIFT) +#define I40E_MDIO_CLAUSE22_OPCODE_WRITE_MASK I40E_MASK(1, \ I40E_GLGEN_MSCA_OPCODE_SHIFT) -#define I40E_MDIO_OPCODE_READ_INC_ADDR I40E_MASK(2, \ +#define I40E_MDIO_CLAUSE22_OPCODE_READ_MASK I40E_MASK(2, \ I40E_GLGEN_MSCA_OPCODE_SHIFT) -#define I40E_MDIO_OPCODE_READ I40E_MASK(3, \ + +#define I40E_MDIO_CLAUSE45_STCODE_MASK I40E_MASK(0, \ + I40E_GLGEN_MSCA_STCODE_SHIFT) +#define I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK I40E_MASK(0, \ + I40E_GLGEN_MSCA_OPCODE_SHIFT) +#define I40E_MDIO_CLAUSE45_OPCODE_WRITE_MASK I40E_MASK(1, \ I40E_GLGEN_MSCA_OPCODE_SHIFT) +#define I40E_MDIO_CLAUSE45_OPCODE_READ_INC_ADDR_MASK I40E_MASK(2, \ + I40E_GLGEN_MSCA_OPCODE_SHIFT) +#define I40E_MDIO_CLAUSE45_OPCODE_READ_MASK I40E_MASK(3, \ + I40E_GLGEN_MSCA_OPCODE_SHIFT)#define I40E_PHY_COM_REG_PAGE 0x1E#define I40E_PHY_LED_LINK_MODE_MASK 0xF0
Signature · 1 line
2.4.11
PATCH 7/9 i40e: fix compile error due to type conflict
In reply to Bimmy PujariFrom: Matt Jared <[email protected]>
For the clause 22 and 45 phy register read funcions, cast u32 variables to u8, resolving compiler error due to data being truncated when placing it in u8 variable.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +2 -2
@@ -4442,7 +4442,7 @@ i40e_status i40e_read_phy_register_clause22(struct i40e_hw *hw, u16 reg, u8 phy_addr, u16 *value) { i40e_status status = I40E_ERR_TIMEOUT; -u8 port_num = hw->func_caps.mdio_port_num; +u8 port_num = (u8 )hw->func_caps.mdio_port_num;u32 command =0 ;u16 retry =1000 ;
@@ -4494,9 +4494,9 @@ i40e_status i40e_write_phy_register_clause22(struct i40e_hw *hw, u16 reg, u8 phy_addr, u16 value) { i40e_status status = I40E_ERR_TIMEOUT; +u8 port_num = (u8 )hw->func_caps.mdio_port_num;u32 command =0 ;u16 retry =1000 ; -u8 port_num = hw->func_caps.mdio_port_num; command = value <<I40E_GLGEN_MSRWD_MDIWRDATA_SHIFT ;wr32 (hw,I40E_GLGEN_MSRWD (port_num), command);
Signature · 1 line
2.4.11
PATCH 8/9 i40e: fix trivial typo in naming of i40e_sync_filters_subtask
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
A comment incorrectly referred to i40e_vsi_sync_filters_subtask which does not actually exist. Reference the correct function instead.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -2
@@ -1211,12 +1211,12 @@ bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi)* i40e_add_filter. * * 2) the only place where filters are actually removed is in -* i40e_vsi_sync_filters_subtask. +* i40e_sync_filters_subtask. * * Thus, we can simply use a boolean value, has_vlan_filters which we * will set to true when we add a vlan filter in i40e_add_filter. Then * we have to perform the full search after deleting filters in -* i40e_vsi_sync_filters_subtask, but we already have to search +* i40e_sync_filters_subtask, but we already have to search * filters here and can perform the check at the same time. This * results in avoiding embedding a loop for vlan mode inside another * loop over all the filters, and should maintain correctness as noted
Signature · 1 line
2.4.11
PATCH 9/9 i40e: Add protocols over MCTP to i40e_aq_discover_capabilities
In reply to Bimmy PujariFrom: Piotr Raczynski <[email protected]>
Add logical_id to I40E_AQ_CAP_ID_MNG_MODE capability starting from major version 2.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 8 ++++++++ drivers/net/ethernet/intel/i40e/i40e_type.h | 4 ++++ drivers/net/ethernet/intel/i40evf/i40e_type.h | 4 ++++ 3 files changed, 16 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_common.c +8 -0
@@ -3181,6 +3181,14 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,break ;case I40E_AQ_CAP_ID_MNG_MODE : p->management_mode = number; +if (major_rev >1 ) { + p->mng_protocols_over_mctp = logical_id; +i40e_debug (hw,I40E_DEBUG_INIT , +"HW Capability: Protocols over MCTP = %d\n" , + p->mng_protocols_over_mctp); + }else { + p->mng_protocols_over_mctp =0 ; + }break ;case I40E_AQ_CAP_ID_NPAR_ACTIVE : p->npar_enable = number;
drivers/net/ethernet/intel/i40e/i40e_type.h +4 -0
@@ -263,6 +263,10 @@ struct i40e_hw_capabilities {#define I40E_NVM_IMAGE_TYPE_UDP_CLOUD 0x3u32 management_mode; +u32 mng_protocols_over_mctp; +#define I40E_MNG_PROTOCOL_PLDM 0x2 +#define I40E_MNG_PROTOCOL_OEM_COMMANDS 0x4 +#define I40E_MNG_PROTOCOL_NCSI 0x8u32 npar_enable;u32 os2bmc;u32 valid_functions;
drivers/net/ethernet/intel/i40evf/i40e_type.h +4 -0
@@ -237,6 +237,10 @@ struct i40e_hw_capabilities {#define I40E_NVM_IMAGE_TYPE_UDP_CLOUD 0x3u32 management_mode; +u32 mng_protocols_over_mctp; +#define I40E_MNG_PROTOCOL_PLDM 0x2 +#define I40E_MNG_PROTOCOL_OEM_COMMANDS 0x4 +#define I40E_MNG_PROTOCOL_NCSI 0x8u32 npar_enable;u32 os2bmc;u32 valid_functions;
Signature · 1 line
2.4.11