i40e/i40evf: fix some minor type mismatches
Subsystems (2)
PATCH 1/10 i40e/i40evf: fix some minor type mismatches
From: Jesse Brandeburg <[email protected]>
This patch fixes two trivial type mismatches, one where we were returning an enum type, but pretending it was an int, and the other where we were using a void* for offset math, but it is communicated more clearly and correctly to use a u8*, which we then cast to void* for prefetch to use.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 ++-- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -2
@@ -1524,7 +1524,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,* * Returns a hash type to be used by skb_set_hash **/ -static inline int i40e_ptype_to_htype (u8 ptype) +static inline enum pkt_hash_types i40e_ptype_to_htype (u8 ptype) {struct i40e_rx_ptype_decoded decoded =decode_rx_desc_ptype (ptype);
@@ -1828,7 +1828,7 @@ static struct sk_buff *i40e_construct_skb(struct i40e_ring *rx_ring,/* prefetch first cache line of first page */ prefetch (xdp->data);#if L1_CACHE_BYTES <128 -prefetch (xdp->data +L1_CACHE_BYTES ); +prefetch ((void *)(xdp->data +L1_CACHE_BYTES ));#endif /* allocate a skb to store the frags */
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +3 -3
@@ -858,7 +858,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,* * Returns a hash type to be used by skb_set_hash **/ -static inline int i40e_ptype_to_htype (u8 ptype) +static inline enum pkt_hash_types i40e_ptype_to_htype (u8 ptype) {struct i40e_rx_ptype_decoded decoded =decode_rx_desc_ptype (ptype);
@@ -1122,7 +1122,7 @@ static struct sk_buff *i40e_construct_skb(struct i40e_ring *rx_ring, struct i40e_rx_buffer *rx_buffer, unsigned int size) { - void *va = page_address(rx_buffer->page) + rx_buffer->page_offset; +u8 *va =page_address (rx_buffer->page) + rx_buffer->page_offset;#if (PAGE_SIZE <8192 )unsigned int truesize =i40e_rx_pg_size (rx_ring) /2 ;#else
@@ -1134,7 +1134,7 @@ static struct sk_buff *i40e_construct_skb(struct i40e_ring *rx_ring,/* prefetch first cache line of first page */ prefetch (va);#if L1_CACHE_BYTES <128 -prefetch (va +L1_CACHE_BYTES ); +prefetch ((void *)(va +L1_CACHE_BYTES ));#endif /* allocate a skb to store the frags */
Signature · 1 line
2.9.3
PATCH 2/10 i40e/i40evf: adjust packet size to account for double VLANs
From: Mitch Williams <[email protected]>
Now that the kernel supports double VLAN tags, we should at least play nice. Adjust the max packet size to account for two VLAN tags, not just one.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++-- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_txrx.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -2
@@ -2434,6 +2434,7 @@ static int i40e_max_xdp_frame_size(struct i40e_vsi *vsi)static int i40e_change_mtu (struct net_device *netdev,int new_mtu) {struct i40e_netdev_priv *np =netdev_priv (netdev); +int max_frame = new_mtu +I40E_PACKET_HDR_PAD ;struct i40e_vsi *vsi = np->vsi;struct i40e_pf *pf = vsi->back;
@@ -9768,8 +9769,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)/* MTU range: 68 - 9706 */ netdev->min_mtu =ETH_MIN_MTU ; - netdev->max_mtu =I40E_MAX_RXBUFFER - - (ETH_HLEN +ETH_FCS_LEN +VLAN_HLEN ); + netdev->max_mtu =I40E_MAX_RXBUFFER -I40E_PACKET_HDR_PAD ;return 0 ; }
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -0
@@ -130,6 +130,7 @@ enum i40e_dyn_idx_t {* i.e. RXBUFFER_512 --> 1216 byte skb (size-2048 slab) */ #define I40E_RX_HDR_SIZE I40E_RXBUFFER_256 +#define I40E_PACKET_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))#define i40e_rx_desc i40e_32byte_rx_desc#define I40E_RX_DMA_ATTR \
drivers/net/ethernet/intel/i40evf/i40e_txrx.h +1 -0
@@ -117,6 +117,7 @@ enum i40e_dyn_idx_t {* i.e. RXBUFFER_512 --> 1216 byte skb (size-2048 slab) */ #define I40E_RX_HDR_SIZE I40E_RXBUFFER_256 +#define I40E_PACKET_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))#define i40e_rx_desc i40e_32byte_rx_desc#define I40E_RX_DMA_ATTR \
drivers/net/ethernet/intel/i40evf/i40evf_main.c +2 -1
@@ -2269,6 +2269,7 @@ static int i40evf_close(struct net_device *netdev)static int i40evf_change_mtu (struct net_device *netdev,int new_mtu) {struct i40evf_adapter *adapter =netdev_priv (netdev); +int max_frame = new_mtu +I40E_PACKET_HDR_PAD ; netdev->mtu = new_mtu;if (CLIENT_ENABLED (adapter)) {
@@ -2625,7 +2626,7 @@ static void i40evf_init_task(struct work_struct *work)/* MTU range: 68 - 9710 */ netdev->min_mtu =ETH_MIN_MTU ; - netdev->max_mtu =I40E_MAX_RXBUFFER - (ETH_HLEN +ETH_FCS_LEN ); + netdev->max_mtu =I40E_MAX_RXBUFFER -I40E_PACKET_HDR_PAD ;if (!is_valid_ether_addr (adapter->hw.mac.addr)) { dev_info(&pdev->dev, "Invalid MAC address %pM, using random\n",
Signature · 1 line
2.9.3
Bowers
PATCH 2/10 i40e/i40evf: adjust packet size to account for double VLANs
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 02/10] i40e/i40evf: adjust packet size to account for double VLANsFrom: Mitch Williams <[email protected]>
Now that the kernel supports double VLAN tags, we should at least play nice. Adjust the max packet size to account for two VLAN tags, not just one.
Quoted 7 lines
Signed-off-by Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++-- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_txrx.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-)
PATCH 3/10 i40evf: prevent VF close returning before state tranistions to DOWN
In reply to Alice MichaelFrom: Sudheer Mogilappagari <[email protected]>
Currently i40evf_close() can return before state transitions to __I40EVF_DOWN because of the latency involved in processing and receiving response from PF driver and scheduling of VF watchdog_task. Due to this inconsistency an immediate call to i40evf_open() fails because state is still DOWN_PENDING.
When a VF interface is in up state and we try to add it as slave, The bonding driver calls dev_close() and dev_open() in short duration resulting in dev_open returning error. The ifenslave command needs to be run again for dev_open to succeed.
This fix ensures that watchdog timer is scheduled immediately after admin queue operations are scheduled in i40evf_down(). In addition a wait condition is added at the end of i40evf_close so that function wont return when state is still DOWN_PENDING. The timeout value is chosen after some profiling and includes some buffer.
--- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 ++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 19 +++++++++++++++++++ drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 4 +++- 3 files changed, 24 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +2 -0
@@ -43,6 +43,7 @@#include <linux/bitops.h> #include <linux/timer.h> #include <linux/workqueue.h> +#include <linux/wait.h> #include <linux/delay.h> #include <linux/gfp.h> #include <linux/skbuff.h>
@@ -194,6 +195,7 @@ struct i40evf_adapter {struct work_struct adminq_task;struct delayed_work client_task;struct delayed_work init_task; +wait_queue_head_t down_waitqueue;struct i40e_q_vector *q_vectors;struct list_head vlan_filter_list;char misc_vector_name[IFNAMSIZ +9 ];
drivers/net/ethernet/intel/i40evf/i40evf_main.c +19 -0
@@ -1143,6 +1143,7 @@ void i40evf_down(struct i40evf_adapter *adapter) }clear_bit (__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); +mod_timer_pending (&adapter->watchdog_timer, jiffies +1 ); }/**
@@ -1794,6 +1795,7 @@ static void i40evf_disable_vf(struct i40evf_adapter *adapter)clear_bit (__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); adapter->flags &= ~I40EVF_FLAG_RESET_PENDING ; adapter->state = __I40EVF_DOWN; +wake_up (&adapter->down_waitqueue);dev_info (&adapter->pdev->dev,"Reset task did not complete, VF disabled\n" ); }
@@ -1939,6 +1941,7 @@ static void i40evf_reset_task(struct work_struct *work)i40evf_irq_enable (adapter, true); }else { adapter->state = __I40EVF_DOWN; +wake_up (&adapter->down_waitqueue); }return ;
@@ -2238,6 +2241,7 @@ static int i40evf_open(struct net_device *netdev)static int i40evf_close (struct net_device *netdev) {struct i40evf_adapter *adapter =netdev_priv (netdev); +int status;if (adapter->state <= __I40EVF_DOWN_PENDING)return 0 ;
@@ -2255,7 +2259,18 @@ static int i40evf_close(struct net_device *netdev)* still active and can DMA into memory. Resources are cleared in * i40evf_virtchnl_completion() after we get confirmation from the PF * driver that the rings have been stopped. +* +* Also, we wait for state to transition to __I40EVF_DOWN before +* returning. State change occurs in i40evf_virtchnl_completion() after +* VF resources are released (which occurs after PF driver processes and +* responds to admin queue commands). */ + + status =wait_event_timeout (adapter->down_waitqueue, + adapter->state == __I40EVF_DOWN, +msecs_to_jiffies (200 )); +if (!status) +netdev_warn (netdev,"Device resources not yet released\n" );return 0 ; }
@@ -2684,6 +2699,7 @@ static void i40evf_init_task(struct work_struct *work) adapter->state = __I40EVF_DOWN;set_bit (__I40E_VSI_DOWN, adapter->vsi.state);i40evf_misc_irq_enable (adapter); +wake_up (&adapter->down_waitqueue); adapter->rss_key =kzalloc (adapter->rss_key_size,GFP_KERNEL ); adapter->rss_lut =kzalloc (adapter->rss_lut_size,GFP_KERNEL );
@@ -2845,6 +2861,9 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)schedule_delayed_work (&adapter->init_task,msecs_to_jiffies (5 * (pdev->devfn &0x07 ))); +/* Setup the wait queue for indicating transition to down status */ +init_waitqueue_head (&adapter->down_waitqueue); +return 0 ; err_ioremap:
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +3 -1
@@ -991,8 +991,10 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,case VIRTCHNL_OP_DISABLE_QUEUES :i40evf_free_all_tx_resources (adapter);i40evf_free_all_rx_resources (adapter); -if (adapter->state == __I40EVF_DOWN_PENDING) +if (adapter->state == __I40EVF_DOWN_PENDING) { adapter->state = __I40EVF_DOWN; +wake_up (&adapter->down_waitqueue); + }break ;case VIRTCHNL_OP_VERSION :case VIRTCHNL_OP_CONFIG_IRQ_MAP :
Signature · 1 line
2.9.3
Mogilappagari
PATCH 3/10 i40evf: prevent VF close returning before state tranistions to DOWN
ACK
-----Original Message-----
From: Michael, Alice
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Mogilappagari, Sudheer <[email protected]>
Subject: [next PATCH S74-V2 03/10] i40evf: prevent VF close returning before state tranistions to DOWN
From: Sudheer Mogilappagari <[email protected]>
Currently i40evf_close() can return before state transitions to __I40EVF_DOWN because of the latency involved in processing and receiving response from PF driver and scheduling of VF watchdog_task. Due to this inconsistency an immediate call to i40evf_open() fails because state is still DOWN_PENDING.
When a VF interface is in up state and we try to add it as slave, The bonding driver calls dev_close() and dev_open() in short duration resulting in dev_open returning error. The ifenslave command needs to be run again for dev_open to succeed.
This fix ensures that watchdog timer is scheduled immediately after admin queue operations are scheduled in i40evf_down(). In addition a wait condition is added at the end of i40evf_close so that function wont return when state is still DOWN_PENDING. The timeout value is chosen after some profiling and includes some buffer.
--- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 ++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 19 +++++++++++++++++++ drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 4 +++- 3 files changed, 24 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +2 -0
@@ -43,6 +43,7 @@#include <linux/bitops.h> #include <linux/timer.h> #include <linux/workqueue.h> +#include <linux/wait.h> #include <linux/delay.h> #include <linux/gfp.h> #include <linux/skbuff.h>
@@ -194,6 +195,7 @@ struct i40evf_adapter {struct work_struct adminq_task;struct delayed_work client_task;struct delayed_work init_task; +wait_queue_head_t down_waitqueue;struct i40e_q_vector *q_vectors;struct list_head vlan_filter_list;char misc_vector_name[IFNAMSIZ +9 ];
drivers/net/ethernet/intel/i40evf/i40evf_main.c +16 -0
@@ -1143,6 +1143,7 @@ void i40evf_down(struct i40evf_adapter *adapter) }clear_bit (__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); +mod_timer_pending (&adapter->watchdog_timer, jiffies +1 ); }/**
@@ -1794,6 +1795,7 @@ static void i40evf_disable_vf(struct i40evf_adapter *adapter)clear_bit (__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); adapter->flags &= ~I40EVF_FLAG_RESET_PENDING ; adapter->state = __I40EVF_DOWN; +wake_up (&adapter->down_waitqueue);dev_info (&adapter->pdev->dev,"Reset task did not complete, VF disabled\n" ); }
@@ -1939,6 +1941,7 @@ static void i40evf_reset_task(struct work_struct *work)i40evf_irq_enable (adapter, true); }else { adapter->state = __I40EVF_DOWN; +wake_up (&adapter->down_waitqueue); }return ;
@@ -2238,6 +2241,7 @@ static int i40evf_open(struct net_device *netdev) static int i40evf_close(struct net_device *netdev) {struct i40evf_adapter *adapter =netdev_priv (netdev); +int status;if (adapter->state <= __I40EVF_DOWN_PENDING)return 0 ;
@@ -2255,7 +2259,18 @@ static int i40evf_close(struct net_device *netdev)* still active and can DMA into memory. Resources are cleared in * i40evf_virtchnl_completion() after we get confirmation from the PF * driver that the rings have been stopped. +* +* Also, we wait for state to transition to __I40EVF_DOWN before +* returning. State change occurs in i40evf_virtchnl_completion() after +* VF resources are released (which occurs after PF driver processes and +* responds to admin queue commands). */ + + status =wait_event_timeout (adapter->down_waitqueue, + adapter->state == __I40EVF_DOWN, +msecs_to_jiffies (200 )); +if (!status) +netdev_warn (netdev,"Device resources not yet released\n" );return 0 ; }
@@ -2684,6 +2699,7 @@ static void i40evf_init_task(struct work_struct *work) adapter->state = __I40EVF_DOWN;set_bit (__I40E_VSI_DOWN, adapter->vsi.state);i40evf_misc_irq_enable (adapter); +wake_up (&adapter->down_waitqueue); adapter->rss_key =kzalloc (adapter->rss_key_size,GFP_KERNEL ); adapter->rss_lut = kzalloc(adapter->rss_lut_size, GFP_KERNEL); @@ -2845,6 +2861,9 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
schedule_delayed_work(&adapter->init_task,
msecs_to_jiffies(5 * (pdev->devfn & 0x07)));
+ /* Setup the wait queue for indicating transition to down status */
+ init_waitqueue_head(&adapter->down_waitqueue);
+
return 0;
err_ioremap:
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +3 -1
@@ -991,8 +991,10 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,case VIRTCHNL_OP_DISABLE_QUEUES :i40evf_free_all_tx_resources (adapter);i40evf_free_all_rx_resources (adapter); -if (adapter->state == __I40EVF_DOWN_PENDING) +if (adapter->state == __I40EVF_DOWN_PENDING) { adapter->state = __I40EVF_DOWN; +wake_up (&adapter->down_waitqueue); + }break ;case VIRTCHNL_OP_VERSION :case VIRTCHNL_OP_CONFIG_IRQ_MAP :
--
2.9.3
Bowers
PATCH 3/10 i40evf: prevent VF close returning before state tranistions to DOWN
In reply to Alice MichaelQuoted 29 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Mogilappagari, Sudheer <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S74-V2 03/10] i40evf: prevent VF close returning before state tranistions to DOWNFrom: Sudheer Mogilappagari <[email protected]>
Currently
i40evf_close()can return before state transitions to__I40EVF_DOWNbecause of the latency involved in processing and receiving response from PF driver and scheduling of VFwatchdog_task. Due to this inconsistency an immediate call toi40evf_open()fails because state is stillDOWN_PENDING.When a VF interface is in up state and we try to add it as slave, The bonding driver calls
dev_close()anddev_open()in short duration resulting indev_openreturning error. The ifenslave command needs to be run again fordev_opento succeed.This fix ensures that watchdog timer is scheduled immediately after admin queue operations are scheduled in
i40evf_down(). In addition a wait condition is added at the end ofi40evf_closeso that function wont return when state is stillDOWN_PENDING. The timeout value is chosen after some profiling and includes some buffer.
Quoted 7 lines
Signed-off-by Sudheer Mogilappagari <[email protected]>--- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 ++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 19 +++++++++++++++++++ drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 4 +++- 3 files changed, 24 insertions(+), 1 deletion(-)
PATCH 4/10 i40e: Fix a bug with VMDq RSS queue allocation
In reply to Alice MichaelThe X722 pf flag setup should happen before the VMDq RSS queue count is initialized for VMDq VSI to get the right number of queues for RSS in case of X722 devices.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +23 -23
@@ -9000,6 +9000,29 @@ static int i40e_sw_init(struct i40e_pf *pf) pf->hw.func_caps.fd_filters_best_effort; } +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 + |I40E_FLAG_NO_PCI_LINK_CHECK + |I40E_FLAG_USE_SET_LLDP_MIB + |I40E_FLAG_GENEVE_OFFLOAD_CAPABLE + |I40E_FLAG_PTP_L4_CAPABLE + |I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE ; + }else if ((pf->hw.aq.api_maj_ver >1 ) || + ((pf->hw.aq.api_maj_ver ==1 ) && + (pf->hw.aq.api_min_ver >4 ))) { +/* Supported in FW API version higher than 1.4 */ + pf->flags |=I40E_FLAG_GENEVE_OFFLOAD_CAPABLE ; + } + +/* Enable HW ATR eviction if possible */ +if (pf->flags &I40E_FLAG_HW_ATR_EVICT_CAPABLE ) + pf->flags |=I40E_FLAG_HW_ATR_EVICT_ENABLED ; +if ((pf->hw.mac.type ==I40E_MAC_XL710 ) && (((pf->hw.aq.fw_maj_ver ==4 ) && (pf->hw.aq.fw_min_ver <33 )) || (pf->hw.aq.fw_maj_ver <4 ))) {
@@ -9041,29 +9064,6 @@ 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 - |I40E_FLAG_NO_PCI_LINK_CHECK - |I40E_FLAG_USE_SET_LLDP_MIB - |I40E_FLAG_GENEVE_OFFLOAD_CAPABLE - |I40E_FLAG_PTP_L4_CAPABLE - |I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE ; - }else if ((pf->hw.aq.api_maj_ver >1 ) || - ((pf->hw.aq.api_maj_ver ==1 ) && - (pf->hw.aq.api_min_ver >4 ))) { -/* Supported in FW API version higher than 1.4 */ - pf->flags |=I40E_FLAG_GENEVE_OFFLOAD_CAPABLE ; - } - -/* Enable HW ATR eviction if possible */ -if (pf->flags &I40E_FLAG_HW_ATR_EVICT_CAPABLE ) - pf->flags |=I40E_FLAG_HW_ATR_EVICT_ENABLED ; - pf->eeprom_version =0xDEAD ; pf->lan_veb =I40E_NO_VEB ; pf->lan_vsi =I40E_NO_VSI ;
Signature · 1 line
2.9.3
Bowers
PATCH 4/10 i40e: Fix a bug with VMDq RSS queue allocation
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 04/10] i40e: Fix a bug with VMDq RSS queue allocationThe X722 pf flag setup should happen before the VMDq RSS queue count is initialized for VMDq VSI to get the right number of queues for RSS in case of X722 devices.
Quoted 6 lines
Signed-off-by Anjali Singhai Jain <[email protected]>Signed-off-by Alice Michael <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 46 ++++++++++++++---------- ----- 1 file changed, 23 insertions(+), 23 deletions(-)
PATCH 5/10 i40e: separate hw_features from runtime changing flags
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
The number of flags found in pf->flags has grown quite large, and there are a lot of different types of flags. Most of the flags are simply hardware features which are enabled on some firmware or some MAC types. Other flags are dynamic run-time flags which enable or disable certain features of the driver.
Separate these two types of flags into pf->hw_features and pf->flags. The hw_features list will contain a set of features which are enabled at init time. This will not contain toggles or otherwise dynamically changing features. These flags should not need atomic protections, as they will be set once during init and then be essentially read only.
Everything else will remain in the flags variable. These flags may be modified at any time during run time. A future patch may wish to convert these flags into set_bit/clear_bit/test_bit or similar approach to ensure atomic correctness.
The I40E_FLAG_MFP_ENABLED flag may be a good fit for hw_features but currently is used by ethtool in the private flags settings, and thus has been left as part of flags.
Additionally, I40E_FLAG_DCB_CAPABLE may be a good fit for the hw_features but this patch has not tried to untangle it yet.
--- drivers/net/ethernet/intel/i40e/i40e.h | 43 +++++++------ drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 34 +++++----- drivers/net/ethernet/intel/i40e/i40e_main.c | 72 +++++++++++----------- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 6 +- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 8 +-- drivers/net/ethernet/intel/i40evf/i40e_txrx.h | 4 -- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 - drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +- 9 files changed, 85 insertions(+), 88 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +23 -20
@@ -75,11 +75,11 @@#define I40E_MIN_VSI_ALLOC 83/* LAN, ATR, FCOE, 64 VF */ /* max 16 qps */ #define i40e_default_queues_per_vmdq (pf) \ - (((pf)->flags & I40E_FLAG_RSS_AQ_CAPABLE) ? 4 : 1) + (((pf)->hw_features & I40E_HW_RSS_AQ_CAPABLE) ? 4 : 1)#define I40E_DEFAULT_QUEUES_PER_VF 4#define I40E_DEFAULT_QUEUES_PER_TC 1/* should be a power of 2 */ #define i40e_pf_get_max_q_per_tc (pf) \ - (((pf)->flags & I40E_FLAG_128_QP_RSS_CAPABLE) ? 128 : 64) + (((pf)->hw_features & I40E_HW_128_QP_RSS_CAPABLE) ? 128 : 64)#define I40E_FDIR_RING 0#define I40E_FDIR_RING_COUNT 32#define I40E_MAX_AQ_BUF_SIZE 4096
@@ -401,6 +401,27 @@ struct i40e_pf {struct timer_list service_timer;struct work_struct service_task; +u64 hw_features; +#define I40E_HW_RSS_AQ_CAPABLE BIT_ULL(0) +#define I40E_HW_128_QP_RSS_CAPABLE BIT_ULL(1) +#define I40E_HW_ATR_EVICT_CAPABLE BIT_ULL(2) +#define I40E_HW_WB_ON_ITR_CAPABLE BIT_ULL(3) +#define I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT_ULL(4) +#define I40E_HW_NO_PCI_LINK_CHECK BIT_ULL(5) +#define I40E_HW_100M_SGMII_CAPABLE BIT_ULL(6) +#define I40E_HW_NO_DCB_SUPPORT BIT_ULL(7) +#define I40E_HW_USE_SET_LLDP_MIB BIT_ULL(8) +#define I40E_HW_GENEVE_OFFLOAD_CAPABLE BIT_ULL(9) +#define I40E_HW_PTP_L4_CAPABLE BIT_ULL(10) +#define I40E_HW_WOL_MC_MAGIC_PKT_WAKE BIT_ULL(11) +#define I40E_HW_MPLS_HDR_OFFLOAD_CAPABLE BIT_ULL(12) +#define I40E_HW_HAVE_CRT_RETIMER BIT_ULL(13) +#define I40E_HW_OUTER_UDP_CSUM_CAPABLE BIT_ULL(14) +#define I40E_HW_PHY_CONTROLS_LEDS BIT_ULL(15) +#define I40E_HW_STOP_FW_LLDP BIT_ULL(16) +#define I40E_HW_PORT_ID_VALID BIT_ULL(17) +#define I40E_HW_RESTART_AUTONEG BIT_ULL(18) +u64 flags;#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1)#define I40E_FLAG_MSI_ENABLED BIT_ULL(2)
@@ -420,33 +441,15 @@ struct i40e_pf {#define I40E_FLAG_PTP BIT_ULL(25)#define I40E_FLAG_MFP_ENABLED BIT_ULL(26)#define I40E_FLAG_UDP_FILTER_SYNC BIT_ULL(27) -#define I40E_FLAG_PORT_ID_VALID BIT_ULL(28)#define I40E_FLAG_DCB_CAPABLE BIT_ULL(29) -#define I40E_FLAG_RSS_AQ_CAPABLE BIT_ULL(31) -#define I40E_FLAG_HW_ATR_EVICT_CAPABLE BIT_ULL(32) -#define I40E_FLAG_OUTER_UDP_CSUM_CAPABLE BIT_ULL(33) -#define I40E_FLAG_128_QP_RSS_CAPABLE BIT_ULL(34) -#define I40E_FLAG_WB_ON_ITR_CAPABLE BIT_ULL(35)#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(37) -#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_GENEVE_OFFLOAD_CAPABLE BIT_ULL(41) -#define I40E_FLAG_NO_PCI_LINK_CHECK BIT_ULL(42) -#define I40E_FLAG_100M_SGMII_CAPABLE BIT_ULL(43) -#define I40E_FLAG_RESTART_AUTONEG BIT_ULL(44) -#define I40E_FLAG_NO_DCB_SUPPORT BIT_ULL(45) -#define I40E_FLAG_USE_SET_LLDP_MIB BIT_ULL(46) -#define I40E_FLAG_STOP_FW_LLDP BIT_ULL(47) -#define I40E_FLAG_PHY_CONTROLS_LEDS BIT_ULL(48)#define I40E_FLAG_PF_MAC BIT_ULL(50)#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(51) -#define I40E_FLAG_HAVE_CRT_RETIMER BIT_ULL(52) -#define I40E_FLAG_PTP_L4_CAPABLE BIT_ULL(53)#define I40E_FLAG_CLIENT_RESET BIT_ULL(54)#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(55)#define I40E_FLAG_CLIENT_L2_CHANGE BIT_ULL(56) -#define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE BIT_ULL(57)#define I40E_FLAG_LEGACY_RX BIT_ULL(58)struct i40e_client_instance *cinst;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +17 -17
@@ -271,7 +271,7 @@ static void i40e_phy_type_to_ethtool(struct i40e_pf *pf, u32 *supported, *advertising |= ADVERTISED_Autoneg;if (hw_link_info->requested_speeds &I40E_LINK_SPEED_1GB ) *advertising |= ADVERTISED_1000baseT_Full; -if (pf->flags &I40E_FLAG_100M_SGMII_CAPABLE ) { +if (pf->hw_features &I40E_HW_100M_SGMII_CAPABLE ) { *supported |= SUPPORTED_100baseT_Full; *advertising |= ADVERTISED_100baseT_Full; }
@@ -340,12 +340,12 @@ static void i40e_phy_type_to_ethtool(struct i40e_pf *pf, u32 *supported, *advertising |= ADVERTISED_20000baseKR2_Full; }if (phy_types &I40E_CAP_PHY_TYPE_10GBASE_KR ) { -if (!(pf->flags &I40E_FLAG_HAVE_CRT_RETIMER )) +if (!(pf->hw_features &I40E_HW_HAVE_CRT_RETIMER )) *supported |= SUPPORTED_10000baseKR_Full | SUPPORTED_Autoneg; *advertising |= ADVERTISED_Autoneg;if (hw_link_info->requested_speeds &I40E_LINK_SPEED_10GB ) -if (!(pf->flags &I40E_FLAG_HAVE_CRT_RETIMER )) +if (!(pf->hw_features &I40E_HW_HAVE_CRT_RETIMER )) *advertising |= ADVERTISED_10000baseKR_Full; }if (phy_types &I40E_CAP_PHY_TYPE_10GBASE_KX4 ) {
@@ -356,12 +356,12 @@ static void i40e_phy_type_to_ethtool(struct i40e_pf *pf, u32 *supported, *advertising |= ADVERTISED_10000baseKX4_Full; }if (phy_types &I40E_CAP_PHY_TYPE_1000BASE_KX ) { -if (!(pf->flags &I40E_FLAG_HAVE_CRT_RETIMER )) +if (!(pf->hw_features &I40E_HW_HAVE_CRT_RETIMER )) *supported |= SUPPORTED_1000baseKX_Full | SUPPORTED_Autoneg; *advertising |= ADVERTISED_Autoneg;if (hw_link_info->requested_speeds &I40E_LINK_SPEED_1GB ) -if (!(pf->flags &I40E_FLAG_HAVE_CRT_RETIMER )) +if (!(pf->hw_features &I40E_HW_HAVE_CRT_RETIMER )) *advertising |= ADVERTISED_1000baseKX_Full; } if (phy_types & I40E_CAP_PHY_TYPE_25GBASE_KR ||
@@ -474,7 +474,7 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw, SUPPORTED_1000baseT_Full;if (hw_link_info->requested_speeds &I40E_LINK_SPEED_1GB ) advertising |= ADVERTISED_1000baseT_Full; -if (pf->flags &I40E_FLAG_100M_SGMII_CAPABLE ) { +if (pf->hw_features &I40E_HW_100M_SGMII_CAPABLE ) { supported |= SUPPORTED_100baseT_Full;if (hw_link_info->requested_speeds &I40E_LINK_SPEED_100MB )
@@ -1765,7 +1765,7 @@ static int i40e_get_ts_info(struct net_device *dev,BIT (HWTSTAMP_FILTER_PTP_V2_L2_SYNC ) |BIT (HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ ); -if (pf->flags &I40E_FLAG_PTP_L4_CAPABLE ) +if (pf->hw_features &I40E_HW_PTP_L4_CAPABLE ) info->rx_filters |=BIT (HWTSTAMP_FILTER_PTP_V1_L4_SYNC ) |BIT (HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ ) | BIT(HWTSTAMP_FILTER_PTP_V2_EVENT) |
@@ -2005,7 +2005,7 @@ static int i40e_set_phys_id(struct net_device *netdev,switch (state) {case ETHTOOL_ID_ACTIVE : -if (!(pf->flags &I40E_FLAG_PHY_CONTROLS_LEDS )) { +if (!(pf->hw_features &I40E_HW_PHY_CONTROLS_LEDS )) { pf->led_status =i40e_led_get (hw); }else {i40e_aq_set_phy_debug (hw,I40E_PHY_DEBUG_ALL ,NULL );
@@ -2015,19 +2015,19 @@ static int i40e_set_phys_id(struct net_device *netdev, }return blink_freq;case ETHTOOL_ID_ON : -if (!(pf->flags &I40E_FLAG_PHY_CONTROLS_LEDS )) +if (!(pf->hw_features &I40E_HW_PHY_CONTROLS_LEDS ))i40e_led_set (hw,0xf , false);else ret =i40e_led_set_phy (hw, true, pf->led_status,0 );break ;case ETHTOOL_ID_OFF : -if (!(pf->flags &I40E_FLAG_PHY_CONTROLS_LEDS )) +if (!(pf->hw_features &I40E_HW_PHY_CONTROLS_LEDS ))i40e_led_set (hw,0x0 , false);else ret =i40e_led_set_phy (hw, false, pf->led_status,0 );break ;case ETHTOOL_ID_INACTIVE : -if (!(pf->flags &I40E_FLAG_PHY_CONTROLS_LEDS )) { +if (!(pf->hw_features &I40E_HW_PHY_CONTROLS_LEDS )) {i40e_led_set (hw, pf->led_status, false); }else { ret = i40e_led_set_phy(hw, false, pf->led_status,
@@ -2727,22 +2727,22 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)switch (nfc->flow_type) {case TCP_V4_FLOW : flow_pctype =I40E_FILTER_PCTYPE_NONF_IPV4_TCP ; -if (pf->flags &I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE ) +if (pf->hw_features &I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE ) hena |=BIT_ULL (I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK );break ;case TCP_V6_FLOW : flow_pctype =I40E_FILTER_PCTYPE_NONF_IPV6_TCP ; -if (pf->flags &I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE ) +if (pf->hw_features &I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE ) hena |=BIT_ULL (I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK ); -if (pf->flags &I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE ) +if (pf->hw_features &I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE ) hena |=BIT_ULL (I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK );break ;case UDP_V4_FLOW : flow_pctype =I40E_FILTER_PCTYPE_NONF_IPV4_UDP ; -if (pf->flags &I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE ) +if (pf->hw_features &I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE ) hena |=BIT_ULL (I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP ) |BIT_ULL (I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP );
@@ -2751,7 +2751,7 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)break ;case UDP_V6_FLOW : flow_pctype =I40E_FILTER_PCTYPE_NONF_IPV6_UDP ; -if (pf->flags &I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE ) +if (pf->hw_features &I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE ) hena |=BIT_ULL (I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP ) |BIT_ULL (I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP );
@@ -4122,7 +4122,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags) }/* Only allow ATR evict on hardware that is capable of handling it */ -if (pf->flags &I40E_FLAG_HW_ATR_EVICT_CAPABLE ) +if (!(pf->hw_features &I40E_HW_ATR_EVICT_CAPABLE )) pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_ENABLED ;if (changed_flags &I40E_FLAG_TRUE_PROMISC_SUPPORT ) {
drivers/net/ethernet/intel/i40e/i40e_main.c +36 -36
211 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_ptp.c +3 -3
@@ -569,7 +569,7 @@ static int i40e_ptp_set_timestamp_mode(struct i40e_pf *pf,case HWTSTAMP_FILTER_PTP_V1_L4_SYNC :case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ :case HWTSTAMP_FILTER_PTP_V1_L4_EVENT : -if (!(pf->flags &I40E_FLAG_PTP_L4_CAPABLE )) +if (!(pf->hw_features &I40E_HW_PTP_L4_CAPABLE ))return -ERANGE ; pf->ptp_rx = true; tsyntype = I40E_PRTTSYN_CTL1_V1MESSTYPE0_MASK |
@@ -583,7 +583,7 @@ static int i40e_ptp_set_timestamp_mode(struct i40e_pf *pf,case HWTSTAMP_FILTER_PTP_V2_L4_SYNC :case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ :case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ : -if (!(pf->flags &I40E_FLAG_PTP_L4_CAPABLE )) +if (!(pf->hw_features &I40E_HW_PTP_L4_CAPABLE ))return -ERANGE ;/* fall through */ case HWTSTAMP_FILTER_PTP_V2_L2_EVENT :
@@ -592,7 +592,7 @@ static int i40e_ptp_set_timestamp_mode(struct i40e_pf *pf, pf->ptp_rx = true; tsyntype =I40E_PRTTSYN_CTL1_V2MESSTYPE0_MASK |I40E_PRTTSYN_CTL1_TSYNTYPE_V2 ; -if (pf->flags &I40E_FLAG_PTP_L4_CAPABLE ) { +if (pf->hw_features &I40E_HW_PTP_L4_CAPABLE ) { tsyntype |=I40E_PRTTSYN_CTL1_UDP_ENA_MASK ; config->rx_filter =HWTSTAMP_FILTER_PTP_V2_EVENT ; }else {
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -1
@@ -112,7 +112,7 @@ enum i40e_dyn_idx_t { BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP))#define i40e_pf_get_default_rss_hena (pf) \ - (((pf)->flags & I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE) ? \ + (((pf)->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) ? \ I40E_DEFAULT_RSS_HENA_EXPANDED : I40E_DEFAULT_RSS_HENA)/* Supported Rx Buffer Sizes (a multiple of 128) */
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +4 -4
@@ -1542,14 +1542,14 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)if (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_RSS_PF ) { vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_RSS_PF ; }else { -if ((pf->flags &I40E_FLAG_RSS_AQ_CAPABLE ) && +if ((pf->hw_features &I40E_HW_RSS_AQ_CAPABLE ) && (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_RSS_AQ )) vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_RSS_AQ ;else vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_RSS_REG ; } -if (pf->flags &I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE ) { +if (pf->hw_features &I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE ) {if (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 ) vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 ;
@@ -1558,7 +1558,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)if (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_ENCAP ) vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_ENCAP ; -if ((pf->flags &I40E_FLAG_OUTER_UDP_CSUM_CAPABLE ) && +if ((pf->hw_features &I40E_HW_OUTER_UDP_CSUM_CAPABLE ) && (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM )) vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM ;
@@ -1573,7 +1573,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_RX_POLLING ; } -if (pf->flags &I40E_FLAG_WB_ON_ITR_CAPABLE ) { +if (pf->hw_features &I40E_HW_WB_ON_ITR_CAPABLE ) {if (vf->driver_caps &VIRTCHNL_VF_OFFLOAD_WB_ON_ITR ) vfres->vf_offload_flags |=VIRTCHNL_VF_OFFLOAD_WB_ON_ITR ;
drivers/net/ethernet/intel/i40evf/i40e_txrx.h +0 -4
@@ -98,10 +98,6 @@ enum i40e_dyn_idx_t { BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \ BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP)) -#define i40e_pf_get_default_rss_hena (pf) \ - (((pf)->flags & I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE) ? \ - I40E_DEFAULT_RSS_HENA_EXPANDED : I40E_DEFAULT_RSS_HENA) -/* Supported Rx Buffer Sizes (a multiple of 128) */ #define I40E_RXBUFFER_256 256#define I40E_RXBUFFER_1536 1536/* 128B aligned standard Ethernet frame */
drivers/net/ethernet/intel/i40evf/i40evf.h +0 -2
@@ -238,8 +238,6 @@ struct i40evf_adapter {/* duplicates for common code */ #define I40E_FLAG_DCB_ENABLED 0#define I40E_FLAG_RX_CSUM_ENABLED I40EVF_FLAG_RX_CSUM_ENABLED -#define I40E_FLAG_WB_ON_ITR_CAPABLE I40EVF_FLAG_WB_ON_ITR_CAPABLE -#define I40E_FLAG_OUTER_UDP_CSUM_CAPABLE I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE#define I40E_FLAG_LEGACY_RX I40EVF_FLAG_LEGACY_RX/* flags for admin queue service task */ u32 aq_required;
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -1
@@ -1242,7 +1242,7 @@ static int i40evf_alloc_queues(struct i40evf_adapter *adapter) tx_ring->dev = &adapter->pdev->dev; tx_ring->count = adapter->tx_desc_count; tx_ring->tx_itr_setting = (I40E_ITR_DYNAMIC |I40E_ITR_TX_DEF ); -if (adapter->flags &I40E_FLAG_WB_ON_ITR_CAPABLE ) +if (adapter->flags &I40EVF_FLAG_WB_ON_ITR_CAPABLE ) tx_ring->flags |=I40E_TXR_FLAGS_WB_ON_ITR ; rx_ring = &adapter->rx_rings[i];
Signature · 1 line
2.9.3
PATCH 5/10 i40e: separate hw_features from runtime changing flags
Quoted 9 lines · Alice Michael
From: Jacob Keller <[email protected]>
The number of flags found in
pf->flagshas grown quite large, and there are a lot of different types of flags. Most of the flags are simply hardware features which are enabled on some firmware or some MAC types. Other flags are dynamic run-time flags which enable or disable certain features of the driver.Separate these two types of flags into
pf->hw_featuresandpf->flags.
In general this looks fine and really has long been needed. My only concern is that the name chosen clashes with netdev->hw_features. This is a small nit, but I think a slightly different name would be better in the long run. Even simply "features" would be good.
sln
Keller
PATCH 5/10 i40e: separate hw_features from runtime changing flags
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Shannon Nelson
Sent: Friday, June 23, 2017 10:20 AM
To: intel-wired-lan at osuosl.org
Subject: Re: [Intel-wired-lan] [next PATCH S74-V2 05/10] i40e: separatehw_featuresfrom runtime changing flagsQuoted 8 lines · Alice Michael
From: Jacob Keller <[email protected]>
The number of flags found in
pf->flagshas grown quite large, and there are a lot of different types of flags. Most of the flags are simply hardware features which are enabled on some firmware or some MAC types. Other flags are dynamic run-time flags which enable or disable certain features of the driver.
Quoted 8 lines
Quoted 1 line
Separate these two types of flags into
pf->hw_featuresandpf->flags.In general this looks fine and really has long been needed. My only concern is that the name chosen clashes with
netdev->hw_features. This is a small nit, but I think a slightly different name would be better in the long run. Even simply "features" would be good.sln
I don't mind changing the name if we need, though it will cause a lot of thrash on our end. Personally I don't find it that confusing. Anyone else want to weigh in?
Thanks,
Jake
Quoted 4 lines
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH 5/10 i40e: separate hw_features from runtime changing flags
Quoted 19 lines · Jacob E
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Shannon Nelson
Sent: Friday, June 23, 2017 10:20 AM
To: intel-wired-lan at osuosl.org
Subject: Re: [Intel-wired-lan] [next PATCH S74-V2 05/10] i40e: separatehw_featuresfrom runtime changing flagsQuoted 9 lines · Alice Michael
From: Jacob Keller <[email protected]>
The number of flags found in
pf->flagshas grown quite large, and there are a lot of different types of flags. Most of the flags are simply hardware features which are enabled on some firmware or some MAC types. Other flags are dynamic run-time flags which enable or disable certain features of the driver.Separate these two types of flags into
pf->hw_featuresandpf->flags.
Quoted 9 lines
Quoted 6 lines
In general this looks fine and really has long been needed. My only concern is that the name chosen clashes with
netdev->hw_features. This is a small nit, but I think a slightly different name would be better in the long run. Even simply "features" would be good.sln
I don't mind changing the name if we need, though it will cause a lot of thrash on our end. Personally I don't find it that confusing. Anyone else want to weigh in?
Like I said - an annoying nit, not necessarily a big deal. sln
Bowers
PATCH 5/10 i40e: separate hw_features from runtime changing flags
In reply to Alice MichaelQuoted 36 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 05/10] i40e: separatehw_featuresfrom runtime changing flagsFrom: Jacob Keller <[email protected]>
The number of flags found in
pf->flagshas grown quite large, and there are a lot of different types of flags. Most of the flags are simply hardware features which are enabled on some firmware or some MAC types.
Other flags are dynamic run-time flags which enable or disable certain features of the driver.Separate these two types of flags into
pf->hw_featuresandpf->flags. Thehw_featureslist will contain a set of features which are enabled at init time. This will not contain toggles or otherwise dynamically changing features. These flags should not need atomic protections, as they will be set once during init and then be essentially read only.Everything else will remain in the flags variable. These flags may be modified at any time during run time. A future patch may wish to convert these flags into set_bit/clear_bit/test_bit or similar approach to ensure atomic correctness.
The
I40E_FLAG_MFP_ENABLEDflag may be a good fit forhw_featuresbut currently is used by ethtool in the private flags settings, and thus has been left as part of flags.Additionally,
I40E_FLAG_DCB_CAPABLEmay be a good fit for thehw_featuresbut this patch has not tried to untangle it yet.Signed-off-by Jacob Keller <[email protected]>
Quoted 11 lines
--- drivers/net/ethernet/intel/i40e/i40e.h | 43 +++++++------ drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 34 +++++----- drivers/net/ethernet/intel/i40e/i40e_main.c | 72 +++++++++++----------- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 6 +- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 8 +-- drivers/net/ethernet/intel/i40evf/i40e_txrx.h | 4 -- drivers/net/ethernet/intel/i40evf/i40evf.h | 2 - drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +- 9 files changed, 85 insertions(+), 88 deletions(-)
PATCH 6/10 i40e: remove workaround for Open Firmware MAC address
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
Since commit b499ffb0a22c ("i40e: Look up MAC address in Open Firmware or IDPROM"), we've had support for obtaining the MAC address form Open Firmware or IDPROM.
This code relied on sending the Open Firmware address directly to the device firmware instead of relying on our MAC/VLAN filter list. Thus, a work around was introduced in commit b1b15df59232 ("i40e: Explicitly write platform-specific mac address after PF reset")
We refactored the Open Firmware address enablement code in the ill-named commit 41c4c2b50d52 ("i40e: allow look-up of MAC address from Open Firmware or IDPROM")
Since this refactor, we no longer even set I40E_FLAG_PF_MAC. Further, we don't need this work around, because we actually store the MAC address as part of the MAC/VLAN filter hash. Thus, we will restore the address correctly upon reset.
The refactor above failed to revert the workaround, so do that now.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 - drivers/net/ethernet/intel/i40e/i40e_main.c | 60 ----------------------------- 2 files changed, 61 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -1
@@ -445,7 +445,6 @@ struct i40e_pf {#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(37)#define I40E_FLAG_LINK_POLLING_ENABLED BIT_ULL(39)#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(40) -#define I40E_FLAG_PF_MAC BIT_ULL(50)#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(51)#define I40E_FLAG_CLIENT_RESET BIT_ULL(54)#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(55)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -60
80 lines not on this page · raw message
Signature · 1 line
2.9.3
Bowers
PATCH 6/10 i40e: remove workaround for Open Firmware MAC address
Quoted 30 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: tushar.n.dave at oracle.com
Subject: [Intel-wired-lan] [next PATCH S74-V2 06/10] i40e: remove workaround for Open Firmware MAC addressFrom: Jacob Keller <[email protected]>
Since commit
b499ffb0a22c("i40e: Look up MAC address in Open Firmware or IDPROM"), we've had support for obtaining the MAC address form Open Firmware or IDPROM.This code relied on sending the Open Firmware address directly to the device firmware instead of relying on our MAC/VLAN filter list. Thus, a work around was introduced in commit
b1b15df59232("i40e: Explicitly write platform- specific mac address after PF reset")We refactored the Open Firmware address enablement code in the ill- named commit
41c4c2b50d52("i40e: allow look-up of MAC address from Open Firmware or IDPROM")Since this refactor, we no longer even set
I40E_FLAG_PF_MAC. Further, we don't need this work around, because we actually store the MAC address as part of the MAC/VLAN filter hash. Thus, we will restore the address correctly upon reset.
Quoted 7 lines
The refactor above failed to revert the workaround, so do that now.
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 1 - drivers/net/ethernet/intel/i40e/i40e_main.c | 60 ----------------------------- 2 files changed, 61 deletions(-)
PATCH 7/10 i40e: Detect ATR HW Evict NVM issue and disable the feature
In reply to Alice MichaelThis patch fixes a problem with the HW ATR eviction feature where the NVM setting was incorrect. This patch detects the issue on X720 adapters and disables the feature if the NVM setting is incorrect.
Without this patch, HW ATR Evict feature does not work on broken NVMs and is not detected either. If the HW ATR Evict feature is disabled the SW Eviction feature will take effect.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +8 -0
@@ -8963,6 +8963,14 @@ static int i40e_sw_init(struct i40e_pf *pf)I40E_HW_PTP_L4_CAPABLE |I40E_HW_WOL_MC_MAGIC_PKT_WAKE | I40E_HW_OUTER_UDP_CSUM_CAPABLE); + +#define I40E_FDEVICT_PCTYPE_DEFAULT 0xc03 +if (rd32 (&pf->hw,I40E_GLQF_FDEVICTENA (1 )) != +I40E_FDEVICT_PCTYPE_DEFAULT ) { +dev_warn (&pf->pdev->dev, +"FD EVICT PCTYPES are not right, disable FD HW EVICT\n" ); + pf->hw_features &= ~I40E_HW_ATR_EVICT_CAPABLE ; + } }else if ((pf->hw.aq.api_maj_ver >1 ) || ((pf->hw.aq.api_maj_ver ==1 ) && (pf->hw.aq.api_min_ver >4 ))) {
Signature · 1 line
2.9.3
Wyborny
PATCH 7/10 i40e: Detect ATR HW Evict NVM issue and disable the feature
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 07/10] i40e: Detect ATR HW Evict NVM issue and disable the featureThis patch fixes a problem with the HW ATR eviction feature where the NVM setting was incorrect. This patch detects the issue on X720
[..]
Change X720 to X722
Thanks,
Carolyn
Michael
PATCH 7/10 i40e: Detect ATR HW Evict NVM issue and disable the feature
I already sent this up, Jeff can you do that?
Thanks,
Alice
-----Original Message-----
From: Wyborny, Carolyn
Sent: Friday, June 23, 2017 9:33 AM
To: Michael, Alice <[email protected]>; Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Subject: RE: [Intel-wired-lan] [next PATCH S74-V2 07/10] i40e: Detect ATR HW Evict NVM issue and disable the feature
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 07/10] i40e: Detect ATR HW Evict NVM issue and disable the featureThis patch fixes a problem with the HW ATR eviction feature where the NVM setting was incorrect. This patch detects the issue on X720
[..]
Change X720 to X722
Thanks,
Carolyn
Bowers
PATCH 7/10 i40e: Detect ATR HW Evict NVM issue and disable the feature
In reply to Alice MichaelQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 07/10] i40e: Detect ATR HW Evict NVM issue and disable the featureThis patch fixes a problem with the HW ATR eviction feature where the NVM setting was incorrect. This patch detects the issue on X720 adapters and disables the feature if the NVM setting is incorrect.
Without this patch, HW ATR Evict feature does not work on broken NVMs and is not detected either. If the HW ATR Evict feature is disabled the SW Eviction feature will take effect.
Quoted 5 lines
Signed-off-by Anjali Singhai Jain <[email protected]>Signed-off-by Alice Michael <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
PATCH 8/10 i40e/i40evf: organize and re-number feature flags
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
Now that we've reduced the number of flags, organize similar flags together and re-number them accordingly.
Also ensure that the flags variable is actually a u64 to guarantee 64bits of space on all architectures.
One alternative approach considered, but not implemented here, was to use an enumeration for the flag variables, and create a macro I40E_FLAG() which used string concatenation to generate BIT_ULL values. This has the advantage of making the actual bit values compile-time dynamic so that we do not need to worry about matching the order to the bit value. However, this does produce a high level of code churn, and makes it more difficult to read a dumped flags value when debugging.
--- drivers/net/ethernet/intel/i40e/i40e.h | 57 +++++++++++++++--------------- drivers/net/ethernet/intel/i40evf/i40evf.h | 30 ++++++++-------- 2 files changed, 44 insertions(+), 43 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +29 -28
@@ -423,33 +423,34 @@ struct i40e_pf {#define I40E_HW_RESTART_AUTONEG BIT_ULL(18)u64 flags; -#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1) -#define I40E_FLAG_MSI_ENABLED BIT_ULL(2) -#define I40E_FLAG_MSIX_ENABLED BIT_ULL(3) -#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(4) -#define I40E_FLAG_RSS_ENABLED BIT_ULL(6) -#define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7) -#define I40E_FLAG_IWARP_ENABLED BIT_ULL(10) -#define I40E_FLAG_FILTER_SYNC BIT_ULL(15) -#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT_ULL(16) -#define I40E_FLAG_SRIOV_ENABLED BIT_ULL(19) -#define I40E_FLAG_DCB_ENABLED BIT_ULL(20) -#define I40E_FLAG_FD_SB_ENABLED BIT_ULL(21) -#define I40E_FLAG_FD_ATR_ENABLED BIT_ULL(22) -#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT_ULL(23) -#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT_ULL(24) -#define I40E_FLAG_PTP BIT_ULL(25) -#define I40E_FLAG_MFP_ENABLED BIT_ULL(26) -#define I40E_FLAG_UDP_FILTER_SYNC BIT_ULL(27) -#define I40E_FLAG_DCB_CAPABLE BIT_ULL(29) -#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(37) -#define I40E_FLAG_LINK_POLLING_ENABLED BIT_ULL(39) -#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(40) -#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(51) -#define I40E_FLAG_CLIENT_RESET BIT_ULL(54) -#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(55) -#define I40E_FLAG_CLIENT_L2_CHANGE BIT_ULL(56) -#define I40E_FLAG_LEGACY_RX BIT_ULL(58) +#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(0) +#define I40E_FLAG_MSI_ENABLED BIT_ULL(1) +#define I40E_FLAG_MSIX_ENABLED BIT_ULL(2) +#define I40E_FLAG_RSS_ENABLED BIT_ULL(3) +#define I40E_FLAG_VMDQ_ENABLED BIT_ULL(4) +#define I40E_FLAG_FILTER_SYNC BIT_ULL(5) +#define I40E_FLAG_SRIOV_ENABLED BIT_ULL(6) +#define I40E_FLAG_DCB_CAPABLE BIT_ULL(7) +#define I40E_FLAG_DCB_ENABLED BIT_ULL(8) +#define I40E_FLAG_FD_SB_ENABLED BIT_ULL(9) +#define I40E_FLAG_FD_ATR_ENABLED BIT_ULL(10) +#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT_ULL(11) +#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT_ULL(12) +#define I40E_FLAG_MFP_ENABLED BIT_ULL(13) +#define I40E_FLAG_UDP_FILTER_SYNC BIT_ULL(14) +#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(15) +#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(16) +#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(17) +#define I40E_FLAG_LINK_POLLING_ENABLED BIT_ULL(18) +#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(19) +#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(20) +#define I40E_FLAG_LEGACY_RX BIT_ULL(21) +#define I40E_FLAG_PTP BIT_ULL(22) +#define I40E_FLAG_IWARP_ENABLED BIT_ULL(23) +#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT_ULL(24) +#define I40E_FLAG_CLIENT_L2_CHANGE BIT_ULL(25) +#define I40E_FLAG_CLIENT_RESET BIT_ULL(26) +#define I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED BIT_ULL(27)struct i40e_client_instance *cinst;bool stat_offsets_loaded;
@@ -613,7 +614,7 @@ struct i40e_vsi {DECLARE_BITMAP (state, __I40E_VSI_STATE_SIZE__);#define I40E_VSI_FLAG_FILTER_CHANGED BIT(0)#define I40E_VSI_FLAG_VEB_OWNER BIT(1) -unsigned long flags; +u64 flags;/* Per VSI lock to protect elements/hash (MAC filter) */ spinlock_t mac_filter_hash_lock;
drivers/net/ethernet/intel/i40evf/i40evf.h +15 -15
@@ -220,21 +220,21 @@ struct i40evf_adapter {u32 flags;#define I40EVF_FLAG_RX_CSUM_ENABLED BIT(0) -#define I40EVF_FLAG_IMIR_ENABLED BIT(5) -#define I40EVF_FLAG_MQ_CAPABLE BIT(6) -#define I40EVF_FLAG_PF_COMMS_FAILED BIT(8) -#define I40EVF_FLAG_RESET_PENDING BIT(9) -#define I40EVF_FLAG_RESET_NEEDED BIT(10) -#define I40EVF_FLAG_WB_ON_ITR_CAPABLE BIT(11) -#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(12) -#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(13) -#define I40EVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(14) -#define I40EVF_FLAG_CLIENT_NEEDS_OPEN BIT(15) -#define I40EVF_FLAG_CLIENT_NEEDS_CLOSE BIT(16) -#define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(17) -#define I40EVF_FLAG_PROMISC_ON BIT(18) -#define I40EVF_FLAG_ALLMULTI_ON BIT(19) -#define I40EVF_FLAG_LEGACY_RX BIT(20) +#define I40EVF_FLAG_IMIR_ENABLED BIT(1) +#define I40EVF_FLAG_MQ_CAPABLE BIT(2) +#define I40EVF_FLAG_PF_COMMS_FAILED BIT(3) +#define I40EVF_FLAG_RESET_PENDING BIT(4) +#define I40EVF_FLAG_RESET_NEEDED BIT(5) +#define I40EVF_FLAG_WB_ON_ITR_CAPABLE BIT(6) +#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(7) +#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(8) +#define I40EVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(9) +#define I40EVF_FLAG_CLIENT_NEEDS_OPEN BIT(10) +#define I40EVF_FLAG_CLIENT_NEEDS_CLOSE BIT(11) +#define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(12) +#define I40EVF_FLAG_PROMISC_ON BIT(13) +#define I40EVF_FLAG_ALLMULTI_ON BIT(14) +#define I40EVF_FLAG_LEGACY_RX BIT(15)/* duplicates for common code */ #define I40E_FLAG_DCB_ENABLED 0#define I40E_FLAG_RX_CSUM_ENABLED I40EVF_FLAG_RX_CSUM_ENABLED
Signature · 1 line
2.9.3
Bowers
PATCH 8/10 i40e/i40evf: organize and re-number feature flags
Quoted 25 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 08/10] i40e/i40evf: organize and re-number feature flagsFrom: Jacob Keller <[email protected]>
Now that we've reduced the number of flags, organize similar flags together and re-number them accordingly.
Also ensure that the flags variable is actually a u64 to guarantee 64bits of space on all architectures.
One alternative approach considered, but not implemented here, was to use an enumeration for the flag variables, and create a macro
I40E_FLAG()which used string concatenation to generateBIT_ULLvalues. This has the advantage of making the actual bit values compile-time dynamic so that we do not need to worry about matching the order to the bit value. However, this does produce a high level of code churn, and makes it more difficult to read a dumped flags value when debugging.
Quoted 8 lines
Signed-off-by Jacob Keller <[email protected]>Reviewed-by Williams, Mitch A <[email protected]>Change-ID I8653fff69453cd547d6fe98d29dfa9d8710387d1--- drivers/net/ethernet/intel/i40e/i40e.h | 57 +++++++++++++++------------- -- drivers/net/ethernet/intel/i40evf/i40evf.h | 30 ++++++++-------- 2 files changed, 44 insertions(+), 43 deletions(-)
PATCH 9/10 i40e/i40evf: use cmpxchg64 when updating private flags in ethtool
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
When a user gives an invalid command to change a private flag which is not supported, either because it is read-only, or the device is not capable of the feature, we simply ignore the request.
A naive solution would simply be to report error codes when one of the flags was not supported. However, this causes problems because it makes the operation not atomic. If a user requests multiple private flags together at once we could end up changing one before failing at the second flag.
We can do a bit better if we instead update a temporary copy of the flags variable in the loop, and then copy it into place after. If we aren't careful this has the pitfall of potentially silently overwriting any changes caused by other threads.
Avoid this by using cmpxchg64 which will compare and swap the flags variable only if it currently matched the old value. We'll report -EAGAIN in the (hopefully rare!) case where the cmpxchg64 fails.
This ensures that we can properly report when flags are not supported in an atomic fashion without the risk of overwriting other threads changes.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 57 +++++++++++++++------- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 41 ++++++++++++---- 2 files changed, 70 insertions(+), 28 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +39 -18
@@ -4069,23 +4069,26 @@ 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; -u64 changed_flags; +u64 orig_flags, new_flags, changed_flags;u32 i, j; - changed_flags = pf->flags; + orig_flags =READ_ONCE (pf->flags); + new_flags = orig_flags;for (i =0 ; i <I40E_PRIV_FLAGS_STR_LEN ; i++) {const struct i40e_priv_flags *priv_flags; priv_flags = &i40e_gstrings_priv_flags[i]; -if (priv_flags->read_only) -continue ; -if (flags &BIT (i)) - pf->flags |= priv_flags->flag; + new_flags |= priv_flags->flag;else - pf->flags &= ~(priv_flags->flag); + new_flags &= ~(priv_flags->flag); + +/* If this is a read-only flag, it can't be changed */ +if (priv_flags->read_only && + ((orig_flags ^ new_flags) & ~BIT (i))) +return -EOPNOTSUPP ; }if (pf->hw.pf_id !=0 )
@@ -4096,18 +4099,40 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags) priv_flags = &i40e_gl_gstrings_priv_flags[j]; -if (priv_flags->read_only) -continue ; -if (flags &BIT (i + j)) - pf->flags |= priv_flags->flag; + new_flags |= priv_flags->flag;else - pf->flags &= ~(priv_flags->flag); + new_flags &= ~(priv_flags->flag); + +/* If this is a read-only flag, it can't be changed */ +if (priv_flags->read_only && + ((orig_flags ^ new_flags) & ~BIT (i))) +return -EOPNOTSUPP ; } flags_complete: -/* check for flags that changed */ - changed_flags ^= pf->flags; +/* Before we finalize any flag changes, we need to perform some +* checks to ensure that the changes are supported and safe. +*/ + +/* ATR eviction is not supported on all devices */ +if ((new_flags &I40E_FLAG_HW_ATR_EVICT_ENABLED ) && + !(pf->hw_features &I40E_HW_ATR_EVICT_CAPABLE )) +return -EOPNOTSUPP ; + +/* Compare and exchange the new flags into place. If we failed, that +* is if cmpxchg64 returns anything but the old value, this means that +* something else has modified the flags variable since we copied it +* originally. We'll just punt with an error and log something in the +* message buffer. +*/ +if (cmpxchg64 (&pf->flags, orig_flags, new_flags) != orig_flags) { +dev_warn (&pf->pdev->dev, +"Unable to update pf->flags as it was modified by another thread...\n" ); +return -EAGAIN ; + } + + changed_flags = orig_flags ^ new_flags;/* Process any additional changes needed as a result of flag changes. * The changed_flags value reflects the list of bits that were
@@ -4121,10 +4146,6 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)set_bit (__I40E_FD_FLUSH_REQUESTED, pf->state); } -/* Only allow ATR evict on hardware that is capable of handling it */ -if (!(pf->hw_features &I40E_HW_ATR_EVICT_CAPABLE )) - pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_ENABLED ; -if (changed_flags &I40E_FLAG_TRUE_PROMISC_SUPPORT ) {u16 sw_flags =0 , valid_flags =0 ;int ret;
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +31 -10
60 lines not on this page · raw message
Signature · 1 line
2.9.3
Bowers
PATCH 9/10 i40e/i40evf: use cmpxchg64 when updating private flags in ethtool
Quoted 32 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 09/10] i40e/i40evf: use cmpxchg64 when updating private flags in ethtoolFrom: Jacob Keller <[email protected]>
When a user gives an invalid command to change a private flag which is not supported, either because it is read-only, or the device is not capable of the feature, we simply ignore the request.
A naive solution would simply be to report error codes when one of the flags was not supported. However, this causes problems because it makes the operation not atomic. If a user requests multiple private flags together at once we could end up changing one before failing at the second flag.
We can do a bit better if we instead update a temporary copy of the flags variable in the loop, and then copy it into place after. If we aren't careful this has the pitfall of potentially silently overwriting any changes caused by other threads.
Avoid this by using cmpxchg64 which will compare and swap the flags variable only if it currently matched the old value. We'll report
-EAGAINin the (hopefully rare!) case where the cmpxchg64 fails.This ensures that we can properly report when flags are not supported in an atomic fashion without the risk of overwriting other threads changes.
Quoted 6 lines
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 57 +++++++++++++++--- ---- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 41 ++++++++++++---- 2 files changed, 70 insertions(+), 28 deletions(-)
PATCH 10/10 i40e: move check for avoiding VID=0 filters into i40e_vsi_add_vlan
In reply to Alice MichaelFrom: Jacob Keller <[email protected]>
In i40e_vsi_add_vlan we treat attempting to add VID=0 as an error, because it does not do what the caller might expect. We already special case VID=0 in i40e_vlan_rx_add_vid so that we avoid this error when adding the VLAN.
This special casing is necessary so that we do not add the VLAN=0 filter since we don't want to stop receiving untagged traffic. Unfortunately, not all callers of i40e_vsi_add_vlan are aware of this, including when we add VLANs from a VF device.
Rather than special casing every single caller of i40e_vsi_add_vlan, lets just move this check internally. This makes the code simpler because the caller does not need to be aware of how VLAN=0 is special, and we don't forget to add this check in new places.
This fixes a harmless error message displaying when adding a VLAN from within a VF. The message was meaningless but there is no reason to confuse end users and system administrators, and this is now avoided.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +13 -10
@@ -2596,9 +2596,20 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, u16 vid) {int err; -if (!vid || vsi->info.pvid) +if (vsi->info.pvid)return -EINVAL ; +/* The network stack will attempt to add VID=0, with the intention to +* receive priority tagged packets with a VLAN of 0. Our HW receives +* these packets by default when configured to receive untagged +* packets, so we don't need to add a filter for this case. +* Additionally, HW interprets adding a VID=0 filter as meaning to +* receive *only* tagged traffic and stops receiving untagged traffic. +* Thus, we do not want to actually add a filter for VID=0 +*/ +if (!vid) +return 0 ; +/* Locked once because all functions invoked below iterates list*/ spin_lock_bh (&vsi->mac_filter_hash_lock); err =i40e_add_vlan_all_mac (vsi, vid);
@@ -2675,15 +2686,7 @@ static int i40e_vlan_rx_add_vid(struct net_device *netdev,if (vid >=VLAN_N_VID )return -EINVAL ; -/* If the network stack called us with vid = 0 then -* it is asking to receive priority tagged packets with -* vlan id 0. Our HW receives them by default when configured -* to receive untagged packets so there is no need to add an -* extra filter for vlan 0 tagged packets. -*/ -if (vid) - ret =i40e_vsi_add_vlan (vsi, vid); - + ret =i40e_vsi_add_vlan (vsi, vid);if (!ret)set_bit (vid, vsi->active_vlans);
Signature · 1 line
2.9.3
Bowers
PATCH 10/10 i40e: move check for avoiding VID=0 filters into i40e_vsi_add_vlan
Quoted 25 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 10/10] i40e: move check for avoiding VID=0 filters intoi40e_vsi_add_vlanFrom: Jacob Keller <[email protected]>
In
i40e_vsi_add_vlanwe treat attempting to add VID=0 as an error, because it does not do what the caller might expect. We already special case VID=0 ini40e_vlan_rx_add_vidso that we avoid this error when adding the VLAN.This special casing is necessary so that we do not add the VLAN=0 filter since we don't want to stop receiving untagged traffic. Unfortunately, not all callers of
i40e_vsi_add_vlanare aware of this, including when we add VLANs from a VF device.Rather than special casing every single caller of
i40e_vsi_add_vlan, lets just move this check internally. This makes the code simpler because the caller does not need to be aware of how VLAN=0 is special, and we don't forget to add this check in new places.
Quoted 8 lines
This fixes a harmless error message displaying when adding a VLAN from within a VF. The message was meaningless but there is no reason to confuse end users and system administrators, and this is now avoided.
Signed-off-by Jacob Keller <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
Bowers
PATCH 1/10 i40e/i40evf: fix some minor type mismatches
In reply to Alice MichaelQuoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Friday, June 23, 2017 1:25 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S74-V2 01/10] i40e/i40evf: fix some minor type mismatchesFrom: Jesse Brandeburg <[email protected]>
This patch fixes two trivial type mismatches, one where we were returning an enum type, but pretending it was an int, and the other where we were using a void* for offset math, but it is communicated more clearly and correctly to use a u8*, which we then cast to void* for prefetch to use.
Quoted 6 lines
Signed-off-by Jesse Brandeburg <[email protected]>Change-ID I8d9cf84a1ddbcff7f31eaad9e08880cad4a71f5f--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 ++-- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)