i40e/i40evf updates
Subsystems (2)
cover i40e/i40evf updates
Jacob Keller avoids large memcpy by assigning struct.
Jesse Brandeburg drops duplicate definition, fixes missing space, fixes bug in dma sync, allocates memory safely, fixes do not sleep in netdev_ops, drops unused function, and counts allocation errors.
Kiran Patil adds APIs to add/remove port mirroring rules.
Shannon Nelson does TSO only if CHECKSUM_PARTIAL is set, and negates phy int mask bits.
drivers/net/ethernet/intel/i40e/i40e.h | 1 - drivers/net/ethernet/intel/i40e/i40e_common.c | 162 +++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 8 +- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 + drivers/net/ethernet/intel/i40e/i40e_main.c | 53 +++----- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 12 ++ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 11 +- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 11 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +- 9 files changed, 218 insertions(+), 44 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/12 i40e: trivial: drop duplicate definition
From: Jesse Brandeburg <[email protected]>
The probe routine already had a u32 val declared, no need to do it again. Found by W=2 compile.
---
Testing-Hints:
Try making W=2 and check output for:
"val" shadow declaration is gone.
/driver/i40e/i40e_main.c: In function ???i40e_probe???:
/driver/i40e/i40e_main.c:10752:7: warning: declaration of ???val??? shadows a previous local [-Wshadow]
/driver/i40e/i40e_main.c:10411:6: note: shadowed declaration is here
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -2
@@ -11006,8 +11006,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if ((pf->flags &I40E_FLAG_SRIOV_ENABLED ) && (pf->flags &I40E_FLAG_MSIX_ENABLED ) && !test_bit (__I40E_BAD_EEPROM, &pf->state)) { -u32 val; -/* disable link interrupts for VFs */ val =rd32 (hw,I40E_PFGEN_PORTMDIO_NUM ); val &= ~I40E_PFGEN_PORTMDIO_NUM_VFLINK_STAT_ENA_MASK ;
Signature · 1 line
2.1.0
Bowers
PATCH 1/12 i40e: trivial: drop duplicate definition
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 01/12] i40e: trivial: drop duplicate definitionFrom: Jesse Brandeburg <[email protected]>
The probe routine already had a u32 val declared, no need to do it again. Found by W=2 compile.
Signed-off-by Jesse Brandeburg <[email protected]>Change-ID Id7b65f6d0ef6bb71067d0557f5be0202b6d8741e---
Testing-Hints:
Try making W=2 and check output for:
"val" shadow declaration is gone.
/driver/i40e/i40e_main.c: In function ?i40e_probe?:
/driver/i40e/i40e_main.c:10752:7: warning: declaration of ?val? shadows a
previous local [-Wshadow]
/driver/i40e/i40e_main.c:10411:6: note: shadowed declaration is here
Quoted 2 lines
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 -- 1 file changed, 2 deletions(-)
Patch code changes correctly applied, warning not present at compile time
PATCH 2/12 i40e: trivial: fix missing space
In reply to Deepthi KavalurFrom: Jesse Brandeburg <[email protected]>
Missing space in comment, fixed.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -3754,7 +3754,7 @@ static int i40e_vsi_request_irq(struct i40e_vsi *vsi, char *basename)#ifdef CONFIG_NET_POLL_CONTROLLER /** -* i40e_netpoll - A Polling 'interrupt'handler +* i40e_netpoll - A Polling 'interrupt' handler * @netdev: network interface device structure * * This is used by netconsole to send skbs without having to re-enable
Signature · 1 line
2.1.0
Bowers
PATCH 2/12 i40e: trivial: fix missing space
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 02/12] i40e: trivial: fix missing spaceFrom: Jesse Brandeburg <[email protected]>
Quoted 8 lines
Missing space in comment, fixed.
Reported-by Sergei Shtylyov <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Change-ID I8cdf3ce5994b4a97dcc3eeb33422533918546667--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Patch code changes correctly applied
PATCH 3/12 i40e: fix bug in dma sync
In reply to Deepthi KavalurFrom: Jesse Brandeburg <[email protected]>
Driver was using an offset based off a dma handle while mapping and unmapping using sync_single_range_for[cpu|device], where it should be using dma handle (returned from alloc_coherent) and the offset of the memory to be sync'd.
---
Testing-Hints:
Test traffic, test with DMA API debugging enabled.
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 8 ++++---- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +4 -4
@@ -1218,8 +1218,8 @@ void i40e_alloc_rx_buffers_ps(struct i40e_ring *rx_ring, u16 cleaned_count) }dma_sync_single_range_for_device (rx_ring->dev, - bi->dma, -0 , + rx_ring->rx_bi[0 ].dma, + i * rx_ring->rx_hdr_len, rx_ring->rx_hdr_len,DMA_FROM_DEVICE );/* Refresh the desc even if buffer_addrs didn't change
@@ -1534,8 +1534,8 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)skb_record_rx_queue (skb, rx_ring->queue_index);/* we are reusing so sync this buffer for CPU use */ dma_sync_single_range_for_cpu (rx_ring->dev, - rx_bi->dma, -0 , + rx_ring->rx_bi[0 ].dma, + i * rx_ring->rx_hdr_len, rx_ring->rx_hdr_len,DMA_FROM_DEVICE ); }
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +4 -4
@@ -699,8 +699,8 @@ void i40evf_alloc_rx_buffers_ps(struct i40e_ring *rx_ring, u16 cleaned_count) }dma_sync_single_range_for_device (rx_ring->dev, - bi->dma, -0 , + rx_ring->rx_bi[0 ].dma, + i * rx_ring->rx_hdr_len, rx_ring->rx_hdr_len,DMA_FROM_DEVICE );/* Refresh the desc even if buffer_addrs didn't change
@@ -1006,8 +1006,8 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)skb_record_rx_queue (skb, rx_ring->queue_index);/* we are reusing so sync this buffer for CPU use */ dma_sync_single_range_for_cpu (rx_ring->dev, - rx_bi->dma, -0 , + rx_ring->rx_bi[0 ].dma, + i * rx_ring->rx_hdr_len, rx_ring->rx_hdr_len,DMA_FROM_DEVICE ); }
Signature · 1 line
2.1.0
Bowers
PATCH 3/12 i40e: fix bug in dma sync
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 03/12] i40e: fix bug in dma syncFrom: Jesse Brandeburg <[email protected]>
Driver was using an offset based off a dma handle while mapping and unmapping using sync_single_range_for[cpu|device], where it should be using dma handle (returned from
alloc_coherent) and the offset of the memory to be sync'd.Signed-off-by Jesse Brandeburg <[email protected]>Reviewed-by Nelson, Shannon <[email protected]>Reviewed-by Williams, Mitch A <[email protected]>Change-ID I208256565b1595ff0e9171ab852de06b997917c6
Quoted 7 lines
---
Testing-Hints:
Test traffic, test with DMA API debugging enabled.drivers/net/ethernet/intel/i40e/i40e_txrx.c | 8 ++++---- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
Patch code changes correctly applied, no dma errors recorded
PATCH 4/12 i40e: do TSO only if CHECKSUM_PARTIAL is set
In reply to Deepthi KavalurFrom: Shannon Nelson <[email protected]>
Don't bother trying to set up a TSO if the skb->ip_summed is not set to CHECKSUM_PARTIAL.
---
Testing-Hints:
I'm sure there's a better test available, but I found this by inspection and then adding a debug printk to see what was happening. For now, just verify that the code is inserted and compiles.
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 +++ drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +3 -0
@@ -2213,6 +2213,9 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,u32 l4len;int err; +if (skb->ip_summed !=CHECKSUM_PARTIAL ) +return 0 ; +if (!skb_is_gso (skb))return 0 ;
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +3 -0
@@ -1470,6 +1470,9 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,u32 l4len;int err; +if (skb->ip_summed !=CHECKSUM_PARTIAL ) +return 0 ; +if (!skb_is_gso (skb))return 0 ;
Signature · 1 line
2.1.0
Bowers
PATCH 4/12 i40e: do TSO only if CHECKSUM_PARTIAL is set
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 04/12] i40e: do TSO only ifCHECKSUM_PARTIALis setFrom: Shannon Nelson <[email protected]>
Don't bother trying to set up a TSO if the
skb->ip_summedis not set toCHECKSUM_PARTIAL.Signed-off-by Shannon Nelson <[email protected]>Change-ID I6495b3568e404907a2965b48cf3e2effa7c9ab55---
Testing-Hints:
I'm sure there's a better test available, but I found this by inspection and then adding a debug printk to see what was happening.
For now, just verify that the code is inserted and compiles.
Quoted 3 lines
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 +++ drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 3 +++ 2 files changed, 6 insertions(+)
Patch code changes correctly applied
PATCH 5/12 i40e: allocate memory safer
In reply to Deepthi KavalurFrom: Jesse Brandeburg <[email protected]>
The sync_vsi_filter function was allocating memory in such a way that it could sleep (GFP_KERNEL) which was causing a problem when called by the team driver under rcu_read_lock(), which cannot be held while sleeping. Found with lockdep.
---
Testing-Hints:
Run lockdep enabled kernel and try these steps:
teamd -t team0 -rd -c '{"runner":{"name":"activebackup"}}' teamdctl team0 port add ens3f0
teamdctl team0 port add ens3f0
teamdctl team0 port add ens3f1
ip link set team0 up
ip link add link team0 name team0.3 type vlan id 3 ip l set team0.3 up
ip link del team0.3
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
@@ -1937,7 +1937,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)sizeof (struct i40e_aqc_remove_macvlan_element_data ); del_list_size = filter_list_len *sizeof (struct i40e_aqc_remove_macvlan_element_data ); - del_list =kzalloc (del_list_size,GFP_KERNEL ); + del_list =kzalloc (del_list_size,GFP_ATOMIC );if (!del_list) {i40e_cleanup_add_list (&tmp_add_list);
@@ -2015,7 +2015,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)sizeof (struct i40e_aqc_add_macvlan_element_data ), add_list_size = filter_list_len *sizeof (struct i40e_aqc_add_macvlan_element_data ); - add_list =kzalloc (add_list_size,GFP_KERNEL ); + add_list =kzalloc (add_list_size,GFP_ATOMIC );if (!add_list) {/* Purge element from temporary lists */ i40e_cleanup_add_list (&tmp_add_list);
Signature · 1 line
2.1.0
Bowers
PATCH 5/12 i40e: allocate memory safer
Quoted 29 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 05/12] i40e: allocate memory saferFrom: Jesse Brandeburg <[email protected]>
The
sync_vsi_filterfunction was allocating memory in such a way that it could sleep (GFP_KERNEL) which was causing a problem when called by the team driver underrcu_read_lock(), which cannot be held while sleeping. Found with lockdep.Signed-off-by Jesse Brandeburg <[email protected]>Change-ID I4e59053cb5eedcf3d0ca151715be3dc42a94bdd5---
Testing-Hints:
Run lockdep enabled kernel and try these steps:
teamd -t team0 -rd -c '{"runner":{"name":"activebackup"}}' teamdctl team0 port add ens3f0
teamdctl team0 port add ens3f0
teamdctl team0 port add ens3f1
ip link set team0 up
ip link add link team0 name team0.3 type vlan id 3 ip l set team0.3 up
ip link del team0.3
Quoted 2 lines
drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Patch code changes correctly applied, no lock errors reported with lock validator
PATCH 6/12 i40e: fix: do not sleep in netdev_ops
In reply to Deepthi KavalurFrom: Jesse Brandeburg <[email protected]>
The driver was being called by vlan, bonding, teaming operations that expected to be able to hold locks like rcu_read_lock().
This causes the driver to be held to the requirement to not sleep, and was found by the kernel debug options for checking sleep inside critical section, and the locking validator.
---
Testing-Hints:
Add and remove vlan, over and under bonding and teaming driver, add and delete mac address, run debug kernel with lock validator.
drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +10 -1
@@ -1542,7 +1542,11 @@ static int i40e_set_mac(struct net_device *netdev, void *p)ether_addr_copy (netdev->dev_addr, addr->sa_data); -return i40e_sync_vsi_filters (vsi); +/* schedule our worker thread which will take care of +* applying the new filter changes +*/ +i40e_service_event_schedule (vsi->back); +return 0 ; }/**
@@ -1766,6 +1770,11 @@ bottom_of_search_loop: vsi->flags |=I40E_VSI_FLAG_FILTER_CHANGED ; vsi->back->flags |=I40E_FLAG_FILTER_SYNC ; } + +/* schedule our worker thread which will take care of +* applying the new filter changes +*/ +i40e_service_event_schedule (vsi->back); }/**
Signature · 1 line
2.1.0
PATCH 6/12 i40e: fix: do not sleep in netdev_ops
Quoted 5 lines · On Mon, 4 Jan 2016 10:33:06 -0800 Deepthi Kavalur <[email protected]>…
From: Jesse Brandeburg <[email protected]>
The driver was being called by vlan, bonding, teaming operations that expected to be able to hold locks like
rcu_read_lock().
Quoted 7 lines
This causes the driver to be held to the requirement to not sleep, and was found by the kernel debug options for checking sleep inside critical section, and the locking validator.
Signed-off-by Jesse Brandeburg <[email protected]>Reviewed-by Nelson, Shannon <[email protected]>Change-ID Ibc68c835f5ffa8ffe0638ffe910a66fc5649a7f7
I don't understand how you ever applied this in your testing and built a kernel, as this change (the complete version) was already applied in Jeff's tree back on 2-Dec:
https://git.kernel.org/cgit/linux/kernel/git/jkirsher/next-queue.git/commit/drivers/net/ethernet/intel/i40e?id=0e4425ed641f3eef67c892bc541949cd745a9ba9
Likely this patch can just be dropped, but we need a process check here.
Kavalur
PATCH 6/12 i40e: fix: do not sleep in netdev_ops
There was another commit on 3-Dec that reverted/modified the i40e_set_mac().
3-Dec: https://git.kernel.org/cgit/linux/kernel/git/jkirsher/next-queue.git/commit/?h=dev-queue&id=ea02e90b4b49782462d06a425e05c776909fbae4
Only the missing part of the below commit is getting added in this patch.
2-Dec: https://git.kernel.org/cgit/linux/kernel/git/jkirsher/next-queue.git/commit/drivers/net/ethernet/intel/i40e?id=0e4425ed641f3eef67c892bc541949cd745a9ba9.
Brandeburg
PATCH 6/12 i40e: fix: do not sleep in netdev_ops
Quoted 2 lines
There was another commit on 3-Dec that reverted/modified the
i40e_set_mac().
3-Dec: https://git.kernel.org/cgit/linux/kernel/git/jkirsher/next-queue.git/commit/?h=dev-queue&id=ea02e90b4b49782462d06a425e05c776909fbae4
That patch you reference is introducing a (likely) merge resolution error, and re-introducing the bug that the original patch fixed, this is just an artifact of the order of things applied to the kernel, that we need to fix with the right code upstream.
Bowers
PATCH 6/12 i40e: fix: do not sleep in netdev_ops
In reply to Deepthi KavalurQuoted 20 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 06/12] i40e: fix: do not sleep innetdev_opsFrom: Jesse Brandeburg <[email protected]>
The driver was being called by vlan, bonding, teaming operations that expected to be able to hold locks like
rcu_read_lock().This causes the driver to be held to the requirement to not sleep, and was found by the kernel debug options for checking sleep inside critical section, and the locking validator.
Signed-off-by Jesse Brandeburg <[email protected]>Reviewed-by Nelson, Shannon <[email protected]>Change-ID Ibc68c835f5ffa8ffe0638ffe910a66fc5649a7f7
Quoted 7 lines
---
Testing-Hints:
Add and remove vlan, over and under bonding and teaming driver, add and delete mac address, run debug kernel with lock validator.drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Patch code changes correctly applied, no lock errors reported with lock validator
PATCH 7/12 i40e: APIs to Add/remove port mirroring rules
In reply to Deepthi KavalurFrom: Kiran Patil <[email protected]>
This patch implements necessary functions related to port mirroring features such as add/delete mirror rule, function to set promiscuous VLAN mode for VSI if mirror rule_type is "VLAN Mirroring".
---
Testing-Hints:
These APIs will be tested as part of testing 'Cisco CSX - Port Mirroring)'. Hooks to test this APIs will be exposed via. debugfs.
drivers/net/ethernet/intel/i40e/i40e_common.c | 162 +++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 12 ++ 2 files changed, 174 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_common.c +162 -0
@@ -2041,6 +2041,37 @@ i40e_status i40e_aq_set_vsi_broadcast(struct i40e_hw *hw, }/** +* i40e_aq_set_vsi_vlan_promisc - control the VLAN promiscuous setting +* @hw: pointer to the hw struct +* @seid: vsi number +* @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN +* @cmd_details: pointer to command details structure or NULL +**/ +i40e_status i40e_aq_set_vsi_vlan_promisc (struct i40e_hw *hw, +u16 seid,bool enable, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_set_vsi_promiscuous_modes *cmd = + (struct i40e_aqc_set_vsi_promiscuous_modes *)&desc.params.raw; +i40e_status status; +u16 flags =0 ; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_set_vsi_promiscuous_modes); +if (enable) + flags |=I40E_AQC_SET_VSI_PROMISC_VLAN ; + + cmd->promiscuous_flags =cpu_to_le16 (flags); + cmd->valid_flags =cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_VLAN ); + cmd->seid =cpu_to_le16 (seid); + + status =i40e_asq_send_command (hw, &desc,NULL ,0 , cmd_details); + +return status; +} + +/** * i40e_get_vsi_params - get VSI configuration info * @hw: pointer to the hw struct * @vsi_ctx: pointer to a vsi context struct
@@ -2478,6 +2509,137 @@ i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 seid, }/** +* i40e_mirrorrule_op - Internal helper function to add/delete mirror rule +* @hw: pointer to the hw struct +* @opcode: AQ opcode for add or delete mirror rule +* @sw_seid: Switch SEID (to which rule refers) +* @rule_type: Rule Type (ingress/egress/VLAN) +* @id: Destination VSI SEID or Rule ID +* @count: length of the list +* @mr_list: list of mirrored VSI SEIDs or VLAN IDs +* @cmd_details: pointer to command details structure or NULL +* @rule_id: Rule ID returned from FW +* @rule_used: Number of rules used in internal switch +* @rule_free: Number of rules free in internal switch +* +* Add/Delete a mirror rule to a specific switch. Mirror rules are supported for +* VEBs/VEPA elements only +**/ +static i40e_status i40e_mirrorrule_op (struct i40e_hw *hw, +u16 opcode,u16 sw_seid,u16 rule_type,u16 id, +u16 count,__le16 *mr_list, +struct i40e_asq_cmd_details *cmd_details, +u16 *rule_id,u16 *rules_used,u16 *rules_free) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_add_delete_mirror_rule *cmd = + (struct i40e_aqc_add_delete_mirror_rule *)&desc.params.raw; +struct i40e_aqc_add_delete_mirror_rule_completion *resp = + (struct i40e_aqc_add_delete_mirror_rule_completion *)&desc.params.raw; +i40e_status status; +u16 buf_size; + + buf_size = count *sizeof (*mr_list); + +/* prep the rest of the request */ +i40e_fill_default_direct_cmd_desc (&desc, opcode); + cmd->seid =cpu_to_le16 (sw_seid); + cmd->rule_type =cpu_to_le16 (rule_type & +I40E_AQC_MIRROR_RULE_TYPE_MASK ); + cmd->num_entries =cpu_to_le16 (count); +/* Dest VSI for add, rule_id for delete */ + cmd->destination =cpu_to_le16 (id); +if (mr_list) { + desc.flags |=cpu_to_le16 ((u16)(I40E_AQ_FLAG_BUF | +I40E_AQ_FLAG_RD )); +if (buf_size >I40E_AQ_LARGE_BUF ) + desc.flags |=cpu_to_le16 ((u16 )I40E_AQ_FLAG_LB ); + } + + status =i40e_asq_send_command (hw, &desc, mr_list, buf_size, + cmd_details); +if (!status || + hw->aq.asq_last_status ==I40E_AQ_RC_ENOSPC ) { +if (rule_id) + *rule_id =le16_to_cpu (resp->rule_id); +if (rules_used) + *rules_used =le16_to_cpu (resp->mirror_rules_used); +if (rules_free) + *rules_free =le16_to_cpu (resp->mirror_rules_free); + } +return status; +} + +/** +* i40e_aq_add_mirrorrule - add a mirror rule +* @hw: pointer to the hw struct +* @sw_seid: Switch SEID (to which rule refers) +* @rule_type: Rule Type (ingress/egress/VLAN) +* @dest_vsi: SEID of VSI to which packets will be mirrored +* @count: length of the list +* @mr_list: list of mirrored VSI SEIDs or VLAN IDs +* @cmd_details: pointer to command details structure or NULL +* @rule_id: Rule ID returned from FW +* @rule_used: Number of rules used in internal switch +* @rule_free: Number of rules free in internal switch +* +* Add mirror rule. Mirror rules are supported for VEBs or VEPA elements only +**/ +i40e_status i40e_aq_add_mirrorrule (struct i40e_hw *hw,u16 sw_seid, +u16 rule_type,u16 dest_vsi,u16 count,__le16 *mr_list, +struct i40e_asq_cmd_details *cmd_details, +u16 *rule_id,u16 *rules_used,u16 *rules_free) +{ +if (!(rule_type ==I40E_AQC_MIRROR_RULE_TYPE_ALL_INGRESS || + rule_type ==I40E_AQC_MIRROR_RULE_TYPE_ALL_EGRESS )) { +if (count ==0 || !mr_list) +return I40E_ERR_PARAM ; + } + +return i40e_mirrorrule_op (hw, i40e_aqc_opc_add_mirror_rule, sw_seid, + rule_type, dest_vsi, count, mr_list, + cmd_details, rule_id, rules_used, rules_free); +} + +/** +* i40e_aq_delete_mirrorrule - delete a mirror rule +* @hw: pointer to the hw struct +* @sw_seid: Switch SEID (to which rule refers) +* @rule_type: Rule Type (ingress/egress/VLAN) +* @count: length of the list +* @rule_id: Rule ID that is returned in the receive desc as part of +* add_mirrorrule. +* @mr_list: list of mirrored VLAN IDs to be removed +* @cmd_details: pointer to command details structure or NULL +* @rule_used: Number of rules used in internal switch +* @rule_free: Number of rules free in internal switch +* +* Delete a mirror rule. Mirror rules are supported for VEBs/VEPA elements only +**/ +i40e_status i40e_aq_delete_mirrorrule (struct i40e_hw *hw,u16 sw_seid, +u16 rule_type,u16 rule_id,u16 count,__le16 *mr_list, +struct i40e_asq_cmd_details *cmd_details, +u16 *rules_used,u16 *rules_free) +{ +/* Rule ID has to be valid except rule_type: INGRESS VLAN mirroring */ +if (rule_type !=I40E_AQC_MIRROR_RULE_TYPE_VLAN ) { +if (!rule_id) +return I40E_ERR_PARAM ; + }else { +/* count and mr_list shall be valid for rule_type INGRESS VLAN +* mirroring. For other rule_type, count and rule_type should +* not matter. +*/ +if (count ==0 || !mr_list) +return I40E_ERR_PARAM ; + } + +return i40e_mirrorrule_op (hw, i40e_aqc_opc_delete_mirror_rule, sw_seid, + rule_type, rule_id, count, mr_list, + cmd_details,NULL , rules_used, rules_free); +} + +/** * i40e_aq_send_msg_to_vf * @hw: pointer to the hardware structure * @vfid: VF id to send msg
drivers/net/ethernet/intel/i40e/i40e_prototype.h +12 -0
@@ -127,6 +127,9 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details);i40e_status i40e_aq_set_vsi_multicast_promiscuous (struct i40e_hw *hw,u16 vsi_id,bool set,struct i40e_asq_cmd_details *cmd_details); +i40e_status i40e_aq_set_vsi_vlan_promisc (struct i40e_hw *hw, +u16 seid,bool enable, +struct i40e_asq_cmd_details *cmd_details);i40e_status i40e_aq_get_vsi_params (struct i40e_hw *hw,struct i40e_vsi_context *vsi_ctx,struct i40e_asq_cmd_details *cmd_details);
@@ -149,6 +152,15 @@ i40e_status i40e_aq_add_macvlan(struct i40e_hw *hw, u16 vsi_id,i40e_status i40e_aq_remove_macvlan (struct i40e_hw *hw,u16 vsi_id,struct i40e_aqc_remove_macvlan_element_data *mv_list,u16 count,struct i40e_asq_cmd_details *cmd_details); +i40e_status i40e_aq_add_mirrorrule (struct i40e_hw *hw,u16 sw_seid, +u16 rule_type,u16 dest_vsi,u16 count,__le16 *mr_list, +struct i40e_asq_cmd_details *cmd_details, +u16 *rule_id,u16 *rules_used,u16 *rules_free); +i40e_status i40e_aq_delete_mirrorrule (struct i40e_hw *hw,u16 sw_seid, +u16 rule_type,u16 rule_id,u16 count,__le16 *mr_list, +struct i40e_asq_cmd_details *cmd_details, +u16 *rules_used,u16 *rules_free); +i40e_status i40e_aq_send_msg_to_vf (struct i40e_hw *hw,u16 vfid,u32 v_opcode,u32 v_retval,u8 *msg,u16 msglen,struct i40e_asq_cmd_details *cmd_details);
Signature · 1 line
2.1.0
Bowers
PATCH 7/12 i40e: APIs to Add/remove port mirroring rules
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 07/12] i40e: APIs to Add/remove port mirroring rulesFrom: Kiran Patil <[email protected]>
This patch implements necessary functions related to port mirroring features such as add/delete mirror rule, function to set promiscuous VLAN mode for VSI if mirror
rule_typeis "VLAN Mirroring".Signed-off-by Kiran Patil <[email protected]>Change-ID Iaf513fd5f188f99dcb977b48f99e73185dfddc40---
Testing-Hints:
These APIs will be tested as part of testing 'Cisco CSX - Port Mirroring)'. Hooks to test this APIs will be exposed via. debugfs.
Quoted 4 lines
drivers/net/ethernet/intel/i40e/i40e_common.c | 162 +++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 12 ++ 2 files changed, 174 insertions(+)
Patch code changes correctly applied
PATCH 8/12 i40e: negate phy int mask bits
In reply to Deepthi KavalurFrom: Shannon Nelson <[email protected]>
The phy interrupt mask bits mask out the events we don't want, so we need to negate the bitmask of events we want.
---
Testing Hints:
The software will not be notified that an empty module has been placed into the cage, and link has not been established.
drivers/net/ethernet/intel/i40e/i40e_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +8 -8
@@ -6816,12 +6816,12 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)if (ret) goto end_core_reset; -/* driver is only interested in link up/down and module qualification -* reports from firmware +/* The driver only wants link up/down and module qualification +* reports from firmware. Note the negative logic. */ ret =i40e_aq_set_phy_int_mask (&pf->hw, -I40E_AQ_EVENT_LINK_UPDOWN | -I40E_AQ_EVENT_MODULE_QUAL_FAIL ,NULL ); + ~(I40E_AQ_EVENT_LINK_UPDOWN | +I40E_AQ_EVENT_MODULE_QUAL_FAIL ),NULL );if (ret) dev_info(&pf->pdev->dev, "set phy mask fail, err %s aq_err %s\n", i40e_stat_str(&pf->hw, ret),
@@ -10959,12 +10959,12 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } } -/* driver is only interested in link up/down and module qualification -* reports from firmware +/* The driver only wants link up/down and module qualification +* reports from firmware. Note the negative logic. */ err =i40e_aq_set_phy_int_mask (&pf->hw, -I40E_AQ_EVENT_LINK_UPDOWN | -I40E_AQ_EVENT_MODULE_QUAL_FAIL ,NULL ); + ~(I40E_AQ_EVENT_LINK_UPDOWN | +I40E_AQ_EVENT_MODULE_QUAL_FAIL ),NULL );if (err) dev_info(&pf->pdev->dev, "set phy mask fail, err %s aq_err %s\n", i40e_stat_str(&pf->hw, err),
Signature · 1 line
2.1.0
Bowers
PATCH 8/12 i40e: negate phy int mask bits
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 08/12] i40e: negate phy int mask bitsFrom: Shannon Nelson <[email protected]>
The phy interrupt mask bits mask out the events we don't want, so we need to negate the bitmask of events we want.
Signed-off-by Shannon Nelson <[email protected]>Change-ID I273244da5a8d285b6abc84fd68a90f1e6fa0393e
Quoted 7 lines
---
Testing Hints:
The software will not be notified that an empty module has been placed into the cage, and link has not been established.drivers/net/ethernet/intel/i40e/i40e_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Patch code changes correctly applied, driver not notified when empty module inserted
PATCH 9/12 i40e: drop unused function
In reply to Deepthi KavalurFrom: Jesse Brandeburg <[email protected]>
Delete the unused irq_dynamic_disable function.
---
Testing-Hints: Compile only
drivers/net/ethernet/intel/i40e/i40e.h | 1 - drivers/net/ethernet/intel/i40e/i40e_main.c | 16 ---------------- 2 files changed, 17 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -1
@@ -756,7 +756,6 @@ static inline void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector)/* skip the flush */ } -void i40e_irq_dynamic_disable (struct i40e_vsi *vsi,int vector);void i40e_irq_dynamic_disable_icr0 (struct i40e_pf *pf);void i40e_irq_dynamic_enable_icr0 (struct i40e_pf *pf);#ifdef I40E_FCOE
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -16
@@ -3273,22 +3273,6 @@ void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf) }/** -* i40e_irq_dynamic_disable - Disable default interrupt generation settings -* @vsi: pointer to a vsi -* @vector: disable a particular Hw Interrupt vector -**/ -void i40e_irq_dynamic_disable (struct i40e_vsi *vsi,int vector) -{ -struct i40e_pf *pf = vsi->back; -struct i40e_hw *hw = &pf->hw; -u32 val; - - val =I40E_ITR_NONE <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ; -wr32 (hw,I40E_PFINT_DYN_CTLN (vector -1 ), val); -i40e_flush (hw); -} - -/** * i40e_msix_clean_rings - MSIX mode Interrupt Handler * @irq: interrupt number * @data: pointer to a q_vector
Signature · 1 line
2.1.0
Bowers
PATCH 9/12 i40e: drop unused function
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 09/12] i40e: drop unused functionFrom: Jesse Brandeburg <[email protected]>
Delete the unused
irq_dynamic_disablefunction.Signed-off-by Jesse Brandeburg <[email protected]>Reviewed-by Singhai, Anjali <[email protected]>Change-ID Ia46071066babd121c7c90f141b6210b00078de3f
Quoted 6 lines
---
Testing-Hints: Compile onlydrivers/net/ethernet/intel/i40e/i40e.h | 1 - drivers/net/ethernet/intel/i40e/i40e_main.c | 16 ---------------- 2 files changed, 17 deletions(-)
Patch code changes correctly applied
PATCH 10/12 i40e: count allocation errors
In reply to Deepthi KavalurFrom: Jesse Brandeburg <[email protected]>
Driver already counted allocation errors, so print them as part of the ethtool -S output. Useful for debugging if your system is having trouble making memory available for the driver.
---
Testing-Hints:
Look for rx_alloc_fail andi rx_pg_alloc_fail in the ethtool -S output. Memory pressure or the kernel allocation failure simulator are necessary to get the counters to increment.
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 -0
@@ -89,6 +89,8 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {I40E_VSI_STAT ("rx_unknown_protocol" , eth_stats.rx_unknown_protocol),I40E_VSI_STAT ("tx_linearize" , tx_linearize),I40E_VSI_STAT ("tx_force_wb" , tx_force_wb), +I40E_VSI_STAT ("rx_alloc_fail" , rx_buf_failed), + I40E_VSI_STAT("rx_pg_alloc_fail", rx_page_failed), };/* These PF_STATs might look like duplicates of some NETDEV_STATs,
Signature · 1 line
2.1.0
Bowers
PATCH 10/12 i40e: count allocation errors
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 10/12] i40e: count allocation errorsFrom: Jesse Brandeburg <[email protected]>
Driver already counted allocation errors, so print them as part of the ethtool - S output. Useful for debugging if your system is having trouble making memory available for the driver.
Signed-off-by Jesse Brandeburg <[email protected]>Change-ID I83839fa86e81e6d80f03b917c88dd3ef9a64dde0
Quoted 8 lines
---
Testing-Hints:
Look forrx_alloc_failandirx_pg_alloc_failin the ethtool -S output. Memory pressure or the kernel allocation failure simulator are necessary to get the counters to increment.drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 ++ 1 file changed, 2 insertions(+)
Patch code changes correctly applied, ethtool shows added counters
PATCH 11/12 i40e: avoid large memcpy by assigning struct
In reply to Deepthi KavalurFrom: Jacob Keller <[email protected]>
Assign the i40e_pf structure directly instead of using a large memcpy, which avoids a sparse warning and lets the compiler optimize the copy since it knows the size of the structure in advance.
--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +5 -3
@@ -185,9 +185,11 @@ static ssize_t i40e_dbg_dump_write(struct file *filp,if (i40e_dbg_prep_dump_buf (pf, buflen)) { p = i40e_dbg_dump_buf; - len =sizeof (struct i40e_pf ); -memcpy (p, pf, len); - p += len; +/* avoid use of memcpy here due to sparse warning +* about copy size. +*/ + *((struct i40e_pf *)p) = *pf; + p +=sizeof (struct i40e_pf ); len = (sizeof (struct i40e_aq_desc ) * pf->hw.aq.num_asq_entries);
Signature · 1 line
2.1.0
Bowers
PATCH 11/12 i40e: avoid large memcpy by assigning struct
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 11/12] i40e: avoid large memcpy by assigning structFrom: Jacob Keller <[email protected]>
Assign the
i40e_pfstructure directly instead of using a large memcpy, which avoids a sparse warning and lets the compiler optimize the copy since it knows the size of the structure in advance.
Quoted 6 lines
Signed-off-by Jacob Keller <[email protected]>Reviewed-by Brandeburg, Jesse <[email protected]>Change-ID I17604e23be2616521eb760290befcb767b52b3f7--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Patch code changes correctly applied
PATCH 12/12 i40e/i40evf: bump version to 1.4.12/1.4.8
In reply to Deepthi KavalurFrom: Jesse Brandeburg <[email protected]>
Bump driver versions to i40e-1.4.12 and i40evf-1.4.8
---
Testing-Hints: Check version.
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -51,7 +51,7 @@ static const char i40e_driver_string[] =#define DRV_VERSION_MAJOR 1#define DRV_VERSION_MINOR 4 -#define DRV_VERSION_BUILD 10 +#define DRV_VERSION_BUILD 12#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ __stringify(DRV_VERSION_MINOR) "." \ __stringify(DRV_VERSION_BUILD) DRV_KERN
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -1
@@ -38,7 +38,7 @@ static const char i40evf_driver_string[] =#define DRV_VERSION_MAJOR 1#define DRV_VERSION_MINOR 4 -#define DRV_VERSION_BUILD 4 +#define DRV_VERSION_BUILD 8#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ __stringify(DRV_VERSION_MINOR) "." \ __stringify(DRV_VERSION_BUILD) \
Signature · 1 line
2.1.0
Bowers
PATCH 12/12 i40e/i40evf: bump version to 1.4.12/1.4.8
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Deepthi Kavalur
Sent: Monday, January 04, 2016 10:33 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S26 12/12] i40e/i40evf: bump version to 1.4.12/1.4.8From: Jesse Brandeburg <[email protected]>
Bump driver versions to i40e-1.4.12 and i40evf-1.4.8
Quoted 8 lines
Signed-off-by Jesse Brandeburg <[email protected]>Change-ID I0ad82668c4ded04250391fda396ce191a42ab754---
Testing-Hints: Check version.drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Patch code changes correctly applied, drivers reports correct version