netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions
@ 2019-08-30 12:08 Igor Russkikh
  2019-08-30 12:08 ` [PATCH net 1/5] net: aquantia: fix removal of vlan 0 Igor Russkikh
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Igor Russkikh @ 2019-08-30 12:08 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Igor Russkikh

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(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net 1/5] net: aquantia: fix removal of vlan 0
  2019-08-30 12:08 [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Igor Russkikh
@ 2019-08-30 12:08 ` Igor Russkikh
  2019-08-30 12:08 ` [PATCH net 2/5] net: aquantia: fix limit of vlan filters Igor Russkikh
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Igor Russkikh @ 2019-08-30 12:08 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Igor Russkikh, Dmitry Bogdanov

From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>

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

Fixes: 7975d2aff5afb ("net: aquantia: add support of rx-vlan-filter offload")
Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_filters.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
index 440690b18734..b13704544a23 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 2/5] net: aquantia: fix limit of vlan filters
  2019-08-30 12:08 [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Igor Russkikh
  2019-08-30 12:08 ` [PATCH net 1/5] net: aquantia: fix removal of vlan 0 Igor Russkikh
@ 2019-08-30 12:08 ` Igor Russkikh
  2019-08-30 12:08 ` [PATCH net 3/5] net: aquantia: reapply vlan filters on up Igor Russkikh
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Igor Russkikh @ 2019-08-30 12:08 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Igor Russkikh, Dmitry Bogdanov

From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>

Fix a limit condition of vlans on the interface before setting vlan
promiscuous mode

Fixes: 48dd73d08d4dd ("net: aquantia: fix vlans not working over bridged network")
Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_filters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
index b13704544a23..aee827f07c16 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 3/5] net: aquantia: reapply vlan filters on up
  2019-08-30 12:08 [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Igor Russkikh
  2019-08-30 12:08 ` [PATCH net 1/5] net: aquantia: fix removal of vlan 0 Igor Russkikh
  2019-08-30 12:08 ` [PATCH net 2/5] net: aquantia: fix limit of vlan filters Igor Russkikh
@ 2019-08-30 12:08 ` Igor Russkikh
  2019-08-30 12:08 ` [PATCH net 4/5] net: aquantia: linkstate irq should be oneshot Igor Russkikh
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Igor Russkikh @ 2019-08-30 12:08 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Igor Russkikh, Dmitry Bogdanov

From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>

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.

Fixes: 7975d2aff5afb ("net: aquantia: add support of rx-vlan-filter offload")
Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
index 100722ad5c2d..b4a0fb281e69 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 4/5] net: aquantia: linkstate irq should be oneshot
  2019-08-30 12:08 [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Igor Russkikh
                   ` (2 preceding siblings ...)
  2019-08-30 12:08 ` [PATCH net 3/5] net: aquantia: reapply vlan filters on up Igor Russkikh
@ 2019-08-30 12:08 ` Igor Russkikh
  2019-08-30 12:08 ` [PATCH net 5/5] net: aquantia: fix out of memory condition on rx side Igor Russkikh
  2019-08-31  6:28 ` [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Jakub Kicinski
  5 siblings, 0 replies; 9+ messages in thread
From: Igor Russkikh @ 2019-08-30 12:08 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Igor Russkikh

Declaring 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.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Reported-by: Michael Symolkin <Michael.Symolkin@aquantia.com>
Fixes: 4c83f170b3ac ("net: aquantia: link status irq handling")
---
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index e1392766e21e..8f66e7817811 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 5/5] net: aquantia: fix out of memory condition on rx side
  2019-08-30 12:08 [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Igor Russkikh
                   ` (3 preceding siblings ...)
  2019-08-30 12:08 ` [PATCH net 4/5] net: aquantia: linkstate irq should be oneshot Igor Russkikh
@ 2019-08-30 12:08 ` Igor Russkikh
  2019-08-31  6:28 ` [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Jakub Kicinski
  5 siblings, 0 replies; 9+ messages in thread
From: Igor Russkikh @ 2019-08-30 12:08 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Igor Russkikh, Dmitry Bogdanov

From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>

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.

Fixes: 970a2e9864b0 ("net: ethernet: aquantia: Vector operations")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
index 715685aa48c3..28892b8acd0e 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
@@ -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;
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions
  2019-08-30 12:08 [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Igor Russkikh
                   ` (4 preceding siblings ...)
  2019-08-30 12:08 ` [PATCH net 5/5] net: aquantia: fix out of memory condition on rx side Igor Russkikh
@ 2019-08-31  6:28 ` Jakub Kicinski
  2019-08-31 20:36   ` David Miller
  5 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2019-08-31  6:28 UTC (permalink / raw)
  To: Igor Russkikh; +Cc: David S . Miller, netdev

On Fri, 30 Aug 2019 12:08:28 +0000, Igor Russkikh wrote:
> 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?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions
  2019-08-31  6:28 ` [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Jakub Kicinski
@ 2019-08-31 20:36   ` David Miller
  2019-09-02 10:07     ` Igor Russkikh
  0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2019-08-31 20:36 UTC (permalink / raw)
  To: jakub.kicinski; +Cc: Igor.Russkikh, netdev

From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Fri, 30 Aug 2019 23:28:56 -0700

> On Fri, 30 Aug 2019 12:08:28 +0000, Igor Russkikh wrote:
>> 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions
  2019-08-31 20:36   ` David Miller
@ 2019-09-02 10:07     ` Igor Russkikh
  0 siblings, 0 replies; 9+ messages in thread
From: Igor Russkikh @ 2019-09-02 10:07 UTC (permalink / raw)
  To: David Miller, jakub.kicinski; +Cc: netdev


>>
>> LGTM, Fixes tag should had been first there on patch 4.
> 
> Series applied with fixes tag ordering fixed in patch 4.

Thanks Jakub, David,

> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-02 10:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 12:08 [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Igor Russkikh
2019-08-30 12:08 ` [PATCH net 1/5] net: aquantia: fix removal of vlan 0 Igor Russkikh
2019-08-30 12:08 ` [PATCH net 2/5] net: aquantia: fix limit of vlan filters Igor Russkikh
2019-08-30 12:08 ` [PATCH net 3/5] net: aquantia: reapply vlan filters on up Igor Russkikh
2019-08-30 12:08 ` [PATCH net 4/5] net: aquantia: linkstate irq should be oneshot Igor Russkikh
2019-08-30 12:08 ` [PATCH net 5/5] net: aquantia: fix out of memory condition on rx side Igor Russkikh
2019-08-31  6:28 ` [PATCH net 0/5] net: aquantia: fixes on vlan filters and other conditions Jakub Kicinski
2019-08-31 20:36   ` David Miller
2019-09-02 10:07     ` Igor Russkikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).