netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/5] qed*: General fixes
@ 2017-05-09 12:07 Yuval Mintz
  2017-05-09 12:07 ` [PATCH net 1/5] qede: Fix XDP memory leak on unload Yuval Mintz
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz

This series contain several fixes for qed and qede.

 - #1 [and ~#5] relate to XDP cleanups
 - #2 and #5 correct VF behavior
 - #3 and #4 fix and add missing configurations needed for RoCE & storage

Dave,

Please consider applying the series to 'net'.

Thanks,
Yuval

Sudarsana Reddy Kalluru (1):
  qede: Fix XDP memory leak on unload

Ram Amrani (1):
  qed: Correct doorbell configuration for !4Kb pages

Yuval Mintz (3):
  qed: Fix VF removal sequence
  qed: Tell QM the number of tasks
  qede: Split PF/VF ndos

 drivers/net/ethernet/qlogic/qed/qed_cxt.c      |  1 +
 drivers/net/ethernet/qlogic/qed/qed_dev.c      |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_main.c     |  6 ++++--
 drivers/net/ethernet/qlogic/qede/qede_filter.c |  5 -----
 drivers/net/ethernet/qlogic/qede/qede_main.c   | 25 ++++++++++++++++++++++++-
 5 files changed, 30 insertions(+), 9 deletions(-)

-- 
1.9.3

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

* [PATCH net 1/5] qede: Fix XDP memory leak on unload
  2017-05-09 12:07 [PATCH net 0/5] qed*: General fixes Yuval Mintz
@ 2017-05-09 12:07 ` Yuval Mintz
  2017-05-09 12:07 ` [PATCH net 2/5] qed: Fix VF removal sequence Yuval Mintz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Suddarsana Reddy Kalluru, Yuval Mintz

From: Suddarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>

When (re|un)loading, Tx-queues belonging to XDP would not get freed.

Fixes: cb6aeb079294 ("qede: Add support for XDP_TX")
Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qede/qede_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index b9ba23d..263fd28 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1313,6 +1313,9 @@ static void qede_free_mem_fp(struct qede_dev *edev, struct qede_fastpath *fp)
 	if (fp->type & QEDE_FASTPATH_RX)
 		qede_free_mem_rxq(edev, fp->rxq);
 
+	if (fp->type & QEDE_FASTPATH_XDP)
+		qede_free_mem_txq(edev, fp->xdp_tx);
+
 	if (fp->type & QEDE_FASTPATH_TX)
 		qede_free_mem_txq(edev, fp->txq);
 }
-- 
1.9.3

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

* [PATCH net 2/5] qed: Fix VF removal sequence
  2017-05-09 12:07 [PATCH net 0/5] qed*: General fixes Yuval Mintz
  2017-05-09 12:07 ` [PATCH net 1/5] qede: Fix XDP memory leak on unload Yuval Mintz
@ 2017-05-09 12:07 ` Yuval Mintz
  2017-05-09 12:07 ` [PATCH net 3/5] qed: Tell QM the number of tasks Yuval Mintz
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz

After previos changes in HW-stop scheme, VFs stopped sending CLOSE
messages to their PFs when they unload.

Fixes: 1226337ad98f ("qed: Correct HW stop flow")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
index b7ad36b..0cbbd59 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
@@ -1093,10 +1093,12 @@ static int qed_slowpath_stop(struct qed_dev *cdev)
 		qed_free_stream_mem(cdev);
 		if (IS_QED_ETH_IF(cdev))
 			qed_sriov_disable(cdev, true);
+	}
+
+	qed_nic_stop(cdev);
 
-		qed_nic_stop(cdev);
+	if (IS_PF(cdev))
 		qed_slowpath_irq_free(cdev);
-	}
 
 	qed_disable_msix(cdev);
 
-- 
1.9.3

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

* [PATCH net 3/5] qed: Tell QM the number of tasks
  2017-05-09 12:07 [PATCH net 0/5] qed*: General fixes Yuval Mintz
  2017-05-09 12:07 ` [PATCH net 1/5] qede: Fix XDP memory leak on unload Yuval Mintz
  2017-05-09 12:07 ` [PATCH net 2/5] qed: Fix VF removal sequence Yuval Mintz
@ 2017-05-09 12:07 ` Yuval Mintz
  2017-05-09 12:07 ` [PATCH net 4/5] qed: Correct doorbell configuration for !4Kb pages Yuval Mintz
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz

Driver doesn't pass the number of tasks to the QM init logic
which would cause back-pressure in scenarios requiring many tasks
[E.g., using max MRs] and thus reduced performance.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_cxt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
index b3aaa98..6948457 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
@@ -1460,6 +1460,7 @@ void qed_qm_init_pf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 	params.is_first_pf = p_hwfn->first_on_engine;
 	params.num_pf_cids = iids.cids;
 	params.num_vf_cids = iids.vf_cids;
+	params.num_tids = iids.tids;
 	params.start_pq = qm_info->start_pq;
 	params.num_pf_pqs = qm_info->num_pqs - qm_info->num_vf_pqs;
 	params.num_vf_pqs = qm_info->num_vf_pqs;
-- 
1.9.3

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

* [PATCH net 4/5] qed: Correct doorbell configuration for !4Kb pages
  2017-05-09 12:07 [PATCH net 0/5] qed*: General fixes Yuval Mintz
                   ` (2 preceding siblings ...)
  2017-05-09 12:07 ` [PATCH net 3/5] qed: Tell QM the number of tasks Yuval Mintz
@ 2017-05-09 12:07 ` Yuval Mintz
  2017-05-09 12:07 ` [PATCH net 5/5] qede: Split PF/VF ndos Yuval Mintz
  2017-05-09 15:25 ` [PATCH net 0/5] qed*: General fixes David Miller
  5 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Ram Amrani, Yuval Mintz

From: Ram Amrani <Ram.Amrani@cavium.com>

When configuring the doorbell DPI address, driver aligns the start
address to 4KB [HW-pages] instead of host PAGE_SIZE.
As a result, RoCE applications might receive addresses which are
unaligned to pages [when PAGE_SIZE > 4KB], which is a security risk.

Fixes: 51ff17251c9c ("qed: Add support for RoCE hw init")
Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index bb70522..463927f 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -1370,7 +1370,7 @@ enum QED_ROCE_EDPM_MODE {
 						   NULL) +
 		       qed_cxt_get_proto_cid_count(p_hwfn, PROTOCOLID_ETH,
 						   NULL);
-	norm_regsize = roundup(QED_PF_DEMS_SIZE * non_pwm_conn, 4096);
+	norm_regsize = roundup(QED_PF_DEMS_SIZE * non_pwm_conn, PAGE_SIZE);
 	min_addr_reg1 = norm_regsize / 4096;
 	pwm_regsize = db_bar_size - norm_regsize;
 
-- 
1.9.3

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

* [PATCH net 5/5] qede: Split PF/VF ndos.
  2017-05-09 12:07 [PATCH net 0/5] qed*: General fixes Yuval Mintz
                   ` (3 preceding siblings ...)
  2017-05-09 12:07 ` [PATCH net 4/5] qed: Correct doorbell configuration for !4Kb pages Yuval Mintz
@ 2017-05-09 12:07 ` Yuval Mintz
  2017-05-17  6:16   ` Mintz, Yuval
  2017-05-09 15:25 ` [PATCH net 0/5] qed*: General fixes David Miller
  5 siblings, 1 reply; 10+ messages in thread
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz

PFs and VFs share the same structure of NDOs today,
and the VFs explicitly fails the ndo_xdp() callback stating
it doesn't support XDP.

This results in lots of:

  [qede_xdp:1032(enp131s2)]VFs don't support XDP
  ------------[ cut here ]------------
  WARNING: CPU: 4 PID: 1426 at net/core/rtnetlink.c:1637 rtnl_dump_ifinfo+0x354/0x3c0
  ...
  Call Trace:
    ? __alloc_skb+0x9b/0x1d0
    netlink_dump+0x122/0x290
    netlink_recvmsg+0x27d/0x430
    sock_recvmsg+0x3d/0x50
  ...

As every dump request for the VF interface info would fail due to
rtnl_xdp_fill() returning an error code.

To resolve this, introduce a subset of the NDOs meant for the VF
in a seperate structure and register that one instead for VFs,
and omit the ndo_xdp initialization.

Fixes: 40b8c45492ef ("qede: Prevent VFs from using XDP")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qede/qede_filter.c |  5 -----
 drivers/net/ethernet/qlogic/qede/qede_main.c   | 22 +++++++++++++++++++++-
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
index eb56520..333876c 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
@@ -1028,11 +1028,6 @@ int qede_xdp(struct net_device *dev, struct netdev_xdp *xdp)
 {
 	struct qede_dev *edev = netdev_priv(dev);
 
-	if (IS_VF(edev)) {
-		DP_NOTICE(edev, "VFs don't support XDP\n");
-		return -EOPNOTSUPP;
-	}
-
 	switch (xdp->command) {
 	case XDP_SETUP_PROG:
 		return qede_xdp_set(edev, xdp->prog);
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 263fd28..38b77bb 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -563,6 +563,23 @@ static int qede_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 #endif
 };
 
+static const struct net_device_ops qede_netdev_vf_ops = {
+	.ndo_open = qede_open,
+	.ndo_stop = qede_close,
+	.ndo_start_xmit = qede_start_xmit,
+	.ndo_set_rx_mode = qede_set_rx_mode,
+	.ndo_set_mac_address = qede_set_mac_addr,
+	.ndo_validate_addr = eth_validate_addr,
+	.ndo_change_mtu = qede_change_mtu,
+	.ndo_vlan_rx_add_vid = qede_vlan_rx_add_vid,
+	.ndo_vlan_rx_kill_vid = qede_vlan_rx_kill_vid,
+	.ndo_set_features = qede_set_features,
+	.ndo_get_stats64 = qede_get_stats64,
+	.ndo_udp_tunnel_add = qede_udp_tunnel_add,
+	.ndo_udp_tunnel_del = qede_udp_tunnel_del,
+	.ndo_features_check = qede_features_check,
+};
+
 /* -------------------------------------------------------------------------
  * START OF PROBE / REMOVE
  * -------------------------------------------------------------------------
@@ -622,7 +639,10 @@ static void qede_init_ndev(struct qede_dev *edev)
 
 	ndev->watchdog_timeo = TX_TIMEOUT;
 
-	ndev->netdev_ops = &qede_netdev_ops;
+	if (IS_VF(edev))
+		ndev->netdev_ops = &qede_netdev_vf_ops;
+	else
+		ndev->netdev_ops = &qede_netdev_ops;
 
 	qede_set_ethtool_ops(ndev);
 
-- 
1.9.3

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

* Re: [PATCH net 0/5] qed*: General fixes
  2017-05-09 12:07 [PATCH net 0/5] qed*: General fixes Yuval Mintz
                   ` (4 preceding siblings ...)
  2017-05-09 12:07 ` [PATCH net 5/5] qede: Split PF/VF ndos Yuval Mintz
@ 2017-05-09 15:25 ` David Miller
  5 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2017-05-09 15:25 UTC (permalink / raw)
  To: Yuval.Mintz; +Cc: netdev

From: Yuval Mintz <Yuval.Mintz@cavium.com>
Date: Tue, 9 May 2017 15:07:46 +0300

> This series contain several fixes for qed and qede.
> 
>  - #1 [and ~#5] relate to XDP cleanups
>  - #2 and #5 correct VF behavior
>  - #3 and #4 fix and add missing configurations needed for RoCE & storage
> 
> Dave,
> 
> Please consider applying the series to 'net'.

Series applied, thank you.

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

* RE: [PATCH net 5/5] qede: Split PF/VF ndos.
  2017-05-09 12:07 ` [PATCH net 5/5] qede: Split PF/VF ndos Yuval Mintz
@ 2017-05-17  6:16   ` Mintz, Yuval
  2017-05-17 15:10     ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Mintz, Yuval @ 2017-05-17  6:16 UTC (permalink / raw)
  To: davem, netdev

> PFs and VFs share the same structure of NDOs today, and the VFs explicitly
> fails the ndo_xdp() callback stating it doesn't support XDP.
> 
> This results in lots of:
> 
>   [qede_xdp:1032(enp131s2)]VFs don't support XDP
>   ------------[ cut here ]------------
>   WARNING: CPU: 4 PID: 1426 at net/core/rtnetlink.c:1637
> rtnl_dump_ifinfo+0x354/0x3c0
>   ...
>   Call Trace:
>     ? __alloc_skb+0x9b/0x1d0
>     netlink_dump+0x122/0x290
>     netlink_recvmsg+0x27d/0x430
>     sock_recvmsg+0x3d/0x50
>   ...
> 
> As every dump request for the VF interface info would fail due to
> rtnl_xdp_fill() returning an error code.
> 
> To resolve this, introduce a subset of the NDOs meant for the VF in a
> seperate structure and register that one instead for VFs, and omit the
> ndo_xdp initialization.
> 
> Fixes: 40b8c45492ef ("qede: Prevent VFs from using XDP")
> Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>

I'm currently working on adding XDP support for qede VFs.
Problem is there's quite a bit of IOV infrastructure involved in this,
and legacy [well, current] PFs would prevent their VFs from utilizing it.

Once I have it ready, if I'd add back the ndo_xdp unconditionally for VFs,
then when working over legacy PFs above issue would resurface.

Looking at my alternatives for solving this, I can't see any 'good' options -
it seems mightily unorthodox to modify net_device_ops, I.e., add/remove
an NDO function-pointer based on some device property, and having
multiple ops declared for the sake of a single feature seems unscalable.

Any better solutions?

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

* Re: [PATCH net 5/5] qede: Split PF/VF ndos.
  2017-05-17  6:16   ` Mintz, Yuval
@ 2017-05-17 15:10     ` David Miller
  2017-05-18  4:58       ` Mintz, Yuval
  0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2017-05-17 15:10 UTC (permalink / raw)
  To: Yuval.Mintz; +Cc: netdev

From: "Mintz, Yuval" <Yuval.Mintz@cavium.com>
Date: Wed, 17 May 2017 06:16:46 +0000

> Looking at my alternatives for solving this, I can't see any 'good'
> options - it seems mightily unorthodox to modify net_device_ops,
> I.e., add/remove an NDO function-pointer based on some device
> property, and having multiple ops declared for the sake of a single
> feature seems unscalable.

Multiple ops is the only thing that works right now.

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

* RE: [PATCH net 5/5] qede: Split PF/VF ndos.
  2017-05-17 15:10     ` David Miller
@ 2017-05-18  4:58       ` Mintz, Yuval
  0 siblings, 0 replies; 10+ messages in thread
From: Mintz, Yuval @ 2017-05-18  4:58 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

> > Looking at my alternatives for solving this, I can't see any 'good'
> > options - it seems mightily unorthodox to modify net_device_ops, I.e.,
> > add/remove an NDO function-pointer based on some device property, and
> > having multiple ops declared for the sake of a single feature seems
> > unscalable.
> 
> Multiple ops is the only thing that works right now.

What about something like - 

diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
index 333876c..7450c8b 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
@@ -1028,6 +1028,13 @@ int qede_xdp(struct net_device *dev, struct netdev_xdp *xdp)
 {
        struct qede_dev *edev = netdev_priv(dev);

+       /* Not all VFs can support XDP; But we can't fail the query */
+       if ((<Actual condition to determine XDP support>) {
+               if (xdp->command == XDP_QUERY_PROG)
+                       return 0;
+               return -EOPNOTSUPP;
+       }
+
        switch (xdp->command) {
        case XDP_SETUP_PROG:
                return qede_xdp_set(edev, xdp->prog);

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

end of thread, other threads:[~2017-05-18  4:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 12:07 [PATCH net 0/5] qed*: General fixes Yuval Mintz
2017-05-09 12:07 ` [PATCH net 1/5] qede: Fix XDP memory leak on unload Yuval Mintz
2017-05-09 12:07 ` [PATCH net 2/5] qed: Fix VF removal sequence Yuval Mintz
2017-05-09 12:07 ` [PATCH net 3/5] qed: Tell QM the number of tasks Yuval Mintz
2017-05-09 12:07 ` [PATCH net 4/5] qed: Correct doorbell configuration for !4Kb pages Yuval Mintz
2017-05-09 12:07 ` [PATCH net 5/5] qede: Split PF/VF ndos Yuval Mintz
2017-05-17  6:16   ` Mintz, Yuval
2017-05-17 15:10     ` David Miller
2017-05-18  4:58       ` Mintz, Yuval
2017-05-09 15:25 ` [PATCH net 0/5] qed*: General fixes David Miller

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