net: aquantia: fixes on vlan filters and other conditions
Subsystems (3)
cover net: aquantia: fixes on vlan filters and other conditions
Here is a set of various bug fixes related to vlan filter offload and two other rare cases.
Dmitry Bogdanov (4):
net: aquantia: fix removal of vlan 0
net: aquantia: fix limit of vlan filters
net: aquantia: reapply vlan filters on up
net: aquantia: fix out of memory condition on rx side
Igor Russkikh (1):
net: aquantia: linkstate irq should be oneshot
drivers/net/ethernet/aquantia/atlantic/aq_filters.c | 5 +++-- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 4 ++++ drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/5 net: aquantia: fix removal of vlan 0
From: Dmitry Bogdanov <[email protected]>
Due to absence of checking against the rx flow rule when vlan 0 is being removed, the other rule could be removed instead of the rule with vlan 0
--- drivers/net/ethernet/aquantia/atlantic/aq_filters.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_filters.c +2 -1
@@ -431,7 +431,8 @@ int aq_del_fvlan_by_vlan(struct aq_nic_s *aq_nic, u16 vlan_id)if (be16_to_cpu (rule->aq_fsp.h_ext.vlan_tci) == vlan_id)break ; } -if (rule &&be16_to_cpu (rule->aq_fsp.h_ext.vlan_tci) == vlan_id) { +if (rule && rule->type == aq_rx_filter_vlan && +be16_to_cpu (rule->aq_fsp.h_ext.vlan_tci) == vlan_id) {struct ethtool_rxnfc cmd; cmd.fs.location = rule->aq_fsp.location;
Signature · 1 line
2.17.1
PATCH 2/5 net: aquantia: fix limit of vlan filters
In reply to Igor RusskikhFrom: Dmitry Bogdanov <[email protected]>
Fix a limit condition of vlans on the interface before setting vlan promiscuous mode
--- drivers/net/ethernet/aquantia/atlantic/aq_filters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_filters.c +1 -1
@@ -844,7 +844,7 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)return err;if (aq_nic->ndev->features &NETIF_F_HW_VLAN_CTAG_FILTER ) { -if (hweight <AQ_VLAN_MAX_FILTERS && hweight >0 ) { +if (hweight <=AQ_VLAN_MAX_FILTERS && hweight >0 ) { err = aq_hw_ops->hw_filter_vlan_ctrl (aq_hw, !(aq_nic->packet_filter &IFF_PROMISC )); aq_nic->aq_nic_cfg.is_vlan_force_promisc = false;
Signature · 1 line
2.17.1
PATCH 3/5 net: aquantia: reapply vlan filters on up
In reply to Igor RusskikhFrom: Dmitry Bogdanov <[email protected]>
In case of device reconfiguration the driver may reset the device invisible for other modules, vlan module in particular. So vlans will not be removed&created and vlan filters will not be configured in the device. The patch reapplies the vlan filters at device start.
--- drivers/net/ethernet/aquantia/atlantic/aq_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +4 -0
@@ -61,6 +61,10 @@ static int aq_ndev_open(struct net_device *ndev)if (err <0 ) goto err_exit; + err =aq_filters_vlans_update (aq_nic); +if (err <0 ) + goto err_exit; + err =aq_nic_start (aq_nic);if (err <0 ) goto err_exit;
Signature · 1 line
2.17.1
PATCH 4/5 net: aquantia: linkstate irq should be oneshot
In reply to Igor RusskikhDeclaring threaded irq handler should also indicate the irq is oneshot. It is oneshot indeed, because HW implements irq automasking on trigger.
Not declaring this causes some kernel configurations to fail on interface up, because request_threaded_irq returned an err code.
The issue was originally hidden on normal x86_64 configuration with latest kernel, because depending on interrupt controller, irq driver added ONESHOT flag on its own.
Issue was observed on older kernels (4.14) where no such logic exists.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +1 -1
@@ -393,7 +393,7 @@ int aq_nic_start(struct aq_nic_s *self) self->aq_nic_cfg.link_irq_vec); err =request_threaded_irq (irqvec,NULL , aq_linkstate_threaded_isr, -IRQF_SHARED , +IRQF_SHARED |IRQF_ONESHOT , self->ndev->name, self);if (err <0 ) goto err_exit;
Signature · 1 line
2.17.1
PATCH 5/5 net: aquantia: fix out of memory condition on rx side
In reply to Igor RusskikhFrom: Dmitry Bogdanov <[email protected]>
On embedded environments with hard memory limits it is a normal although rare case when skb can't be allocated on rx part under high traffic.
In such OOM cases napi_complete_done() was not called.
So the napi object became in an invalid state like it is "scheduled". Kernel do not re-schedules the poll of that napi object.
Consequently, kernel can not remove that object the system hangs on ifconfig down waiting for a poll.
We are fixing this by gracefully closing napi poll routine with correct invocation of napi_complete_done.
This was reproduced with artificially failing the allocation of skb to simulate an "out of memory" error case and check that traffic does not get stuck.
--- drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_vec.c +2 -1
@@ -86,6 +86,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) } } +err_exit:if (!was_tx_cleaned) work_done = budget;
@@ -95,7 +96,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) 1U << self->aq_ring_param.vec_idx); } } -err_exit: +return work_done; }
Signature · 1 line
2.17.1
Quoted 2 lines · Igor Russkikh
Here is a set of various bug fixes related to vlan filter offload and two other rare cases.
LGTM, Fixes tag should had been first there on patch 4.
You should also perhaps check the return value from napi_complete_done() as an optimization for net-next?
David Miller
maintainerFrom: Jakub Kicinski <[email protected]>
Date: Fri, 30 Aug 2019 23:28:56 -0700
Quoted 5 lines · Igor Russkikh
Quoted 2 lines
Here is a set of various bug fixes related to vlan filter offload and two other rare cases.
LGTM, Fixes tag should had been first there on patch 4.
Series applied with fixes tag ordering fixed in patch 4.
Quoted 5 lines
Quoted 3 lines
LGTM, Fixes tag should had been first there on patch 4.
Series applied with fixes tag ordering fixed in patch 4.
Thanks Jakub, David,
Quoted 2 lines
You should also perhaps check the return value from
napi_complete_done()as an optimization for net-next?
Right, thanks, will put that with next net-next patchset.
Regards,
Igor