Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] driver: vrf: Fix one possible use-after-free issue
From: gfree.wind @ 2017-05-09 10:27 UTC (permalink / raw)
  To: dsa, shm, davem, fw, netdev; +Cc: Gao Feng

From: Gao Feng <gfree.wind@vip.163.com>

The current codes only deal with the case that the skb is dropped, it
may meet one use-after-free issue when NF_HOOK returns 0 that means
the skb is stolen by one netfilter rule or hook.

When one netfilter rule or hook stoles the skb and return NF_STOLEN,
it means the skb is taken by the rule, and other modules should not
touch this skb ever. Maybe the skb is queued or freed directly by the
rule.

Now uses the nf_hook instead of NF_HOOK to get the result of netfilter,
and check the return value of nf_hook. Only when its value equals 1, it
means the skb could go ahead. Or reset the skb as NULL.

BTW, because vrf_rcv_finish is empty function, so needn't invoke it
even though nf_hook returns 1. But we need to modify vrf_rcv_finish
to deal with the NF_STOLEN case.

There are two cases when skb is stolen.
1. The skb is stolen and freed directly.
   There is nothing we need to do, and vrf_rcv_finish isn't invoked.
2. The skb is queued and reinjected again.
   The vrf_rcv_finish would be invoked as okfn, so need to free the
   skb in it.

Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
---
 v2: Free the skb in vrf_rcv_finish, per Florian
 v1: initial version

 drivers/net/vrf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index ceda586..db88249 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -989,6 +989,7 @@ static u32 vrf_fib_table(const struct net_device *dev)
 
 static int vrf_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
+	kfree_skb(skb);
 	return 0;
 }
 
@@ -998,7 +999,7 @@ static struct sk_buff *vrf_rcv_nfhook(u8 pf, unsigned int hook,
 {
 	struct net *net = dev_net(dev);
 
-	if (NF_HOOK(pf, hook, net, NULL, skb, dev, NULL, vrf_rcv_finish) < 0)
+	if (nf_hook(pf, hook, net, NULL, skb, dev, NULL, vrf_rcv_finish) != 1)
 		skb = NULL;    /* kfree_skb(skb) handled by nf code */
 
 	return skb;
-- 
1.9.1

^ permalink raw reply related

* 3590
From: kirola @ 2017-05-09 10:29 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: 81646126599.zip --]
[-- Type: application/zip, Size: 1886 bytes --]

^ permalink raw reply

* RE: FEC on i.MX 7 transmit queue timeout
From: Andy Duan @ 2017-05-09 10:35 UTC (permalink / raw)
  To: Stefan Agner, Andrew Lunn
  Cc: festevam@gmail.com, netdev@vger.kernel.org,
	netdev-owner@vger.kernel.org
In-Reply-To: <d48a6d17b05280331642ea683caabc81@agner.ch>

From: Stefan Agner <stefan@agner.ch> Sent: Tuesday, May 09, 2017 2:23 AM
>To: Andy Duan <fugang.duan@nxp.com>; Andrew Lunn <andrew@lunn.ch>
>Cc: festevam@gmail.com; netdev@vger.kernel.org; netdev-
>owner@vger.kernel.org
>Subject: Re: FEC on i.MX 7 transmit queue timeout
>
>On 2017-05-07 19:13, Andy Duan wrote:
>> From: Andrew Lunn <andrew@lunn.ch> Sent: Friday, May 05, 2017 8:24 PM
>>>To: Andy Duan <fugang.duan@nxp.com>
>>>Cc: Stefan Agner <stefan@agner.ch>; festevam@gmail.com;
>>>netdev@vger.kernel.org; netdev-owner@vger.kernel.org
>>>Subject: Re: FEC on i.MX 7 transmit queue timeout
>>>
>>>> No, it is not workaround. As i said, quque1 and queue2 are for AVB
>>>> paths have higher priority in transmition.
>>>
>>>Does this higher priority result in the low priority queue being
>>>starved? Is that why the timer goes off? What happens when somebody
>>>does use AVB. Are we back to the same problem? This is what seems to
>>>make is sounds like a work around, not a fix.
>>>
>>>     Andrew
>> Yes, queue0 may be blocked by queue1 and queue2, then the queue0
>> watchdog time maybe triggered.
>> If somebody use AVB quque1 and queue2, the remaining bandwidth is for
>> queue0, for example, in 100Mbps system, quque1 cost 50Mbps bandwidth
>> and queue2 cost 50Mbps bandwidth for audio and video streaming, then
>> queue0 (best effort) has 0 bandwidth that limit user case cannot have
>> asynchronous frames (IP(tcp/udp)) on networking. Of course these is
>> extreme case.
>> In essentially,  asynchronous frames (IP) go queue0 for the original
>> design. To do these just implement .ndo_select_queue() callback in
>> driver like fsl tree.
>
>I guess you refer to this commit?
>
>http://git.freescale.com/git/cgit.cgi/imx/linux-
>imx.git/commit/?h=imx_4.1.15_2.0.0_ga&id=b0d8fa989651baf847287f6888f4d
>7b723e2a207
>
>It seems that by default there is a Credit-based scheme enabled
>(ENETx_QOS[TX_SCHEME] = 000). The driver enables the queue1/2 and
>assigns it each 50% of the bandwidth (IDLE_SLOPE_1/2 is set to 0x200, which
>according to the register description of IDLE_SLOPE means BW fraction of 0.5!).
>This actually violates even the note in register
>ENETx_DMAnCFG:
>
>"NOTE: For AVB applications, the BW fraction of class 1 and class 2 combined
>must not exceed .75."
>
Yes, the suggested BW fraction for class1 and class2 must not exceed .75, otherwise best effort
Queue will be blocked then watchdog timeout on queue0.

How to set the BW fraction that is up to user case.

>Instead of using the credit based scheme we could switch to round robin, but
>not sure if that is what we want.
> 
Using round robin has no meaning for AVB feature.

>What is the default criteria to select queues when .ndo_select_queue is not
>provided? I guess it tries to balance individual streams/processes for better
>SMP performance?
>
Since AVB audio/video streaming is based on IEEE1722 format,  .ndo_select_queue just parse
the avb streaming and insect the skb into class1 and class2 queues, which are individual streaming and processes.

^ permalink raw reply

* Re: [PATCH] net: wireless: ath: ath9k: remove unnecessary code
From: Kalle Valo @ 2017-05-09 11:32 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: ath9k-devel, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20170509034814.GA18034@embeddedgus>

"Gustavo A. R. Silva" <garsilva@embeddedor.com> writes:

> The name of an array used by itself will always return the array's address.
> So this test will always evaluate as true.
>
> Addresses-Coverity-ID: 1364903
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/net/wireless/ath/ath9k/eeprom.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
> index fb80ec8..5c3bc28 100644
> --- a/drivers/net/wireless/ath/ath9k/eeprom.c
> +++ b/drivers/net/wireless/ath/ath9k/eeprom.c
> @@ -143,7 +143,7 @@ bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data)
>  
>  	if (ah->eeprom_blob)
>  		ret = ath9k_hw_nvram_read_firmware(ah->eeprom_blob, off, data);
> -	else if (pdata && !pdata->use_eeprom && pdata->eeprom_data)
> +	else if (pdata && !pdata->use_eeprom)
>  		ret = ath9k_hw_nvram_read_pdata(pdata, off, data);
>  	else
>  		ret = common->bus_ops->eeprom_read(common, off, data);

The patch may very well be valid (didn't check yet) but the commit log
is gibberish for me.

-- 
Kalle Valo

^ permalink raw reply

* [PATCH net 0/3] mlx4 misc fixes
From: Tariq Toukan @ 2017-05-09 11:45 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan

Hi Dave,

This patchset contains misc bug fixes from the team
to the mlx4 Core and Eth drivers.

Series generated against net commit:
32f1bc0f3d26 Revert "ipv4: restore rt->fi for reference counting"

Thanks,
Tariq.

Jack Morgenstein (1):
  net/mlx4_core: Reduce harmless SRIOV error message to debug level

Kamal Heib (1):
  net/mlx4_en: Change the error print to debug print

Talat Batheesh (1):
  net/mlx4_en: Avoid adding steering rules with invalid ring

 drivers/net/ethernet/mellanox/mlx4/cmd.c              | 14 +++++++++++---
 drivers/net/ethernet/mellanox/mlx4/en_ethtool.c       |  5 +++++
 drivers/net/ethernet/mellanox/mlx4/en_rx.c            |  3 ++-
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |  2 +-
 4 files changed, 19 insertions(+), 5 deletions(-)

-- 
1.8.3.1

^ permalink raw reply

* [PATCH net 2/3] net/mlx4_en: Avoid adding steering rules with invalid ring
From: Tariq Toukan @ 2017-05-09 11:45 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Talat Batheesh, Tariq Toukan
In-Reply-To: <1494330324-11752-1-git-send-email-tariqt@mellanox.com>

From: Talat Batheesh <talatb@mellanox.com>

Inserting steering rules with illegal ring is an invalid operation,
block it.

Fixes: 820672812f82 ('net/mlx4_en: Manage flow steering rules with ethtool')
Signed-off-by: Talat Batheesh <talatb@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index ffbcb27c05e5..ae5fdc2df654 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1562,6 +1562,11 @@ static int mlx4_en_flow_replace(struct net_device *dev,
 		qpn = priv->drop_qp.qpn;
 	else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) {
 		qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1);
+		if (qpn < priv->rss_map.base_qpn ||
+		    qpn >= priv->rss_map.base_qpn + priv->rx_ring_num) {
+			en_warn(priv, "rxnfc: QP (0x%x) doesn't exist\n", qpn);
+			return -EINVAL;
+		}
 	} else {
 		if (cmd->fs.ring_cookie >= priv->rx_ring_num) {
 			en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n",
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net 1/3] net/mlx4_en: Change the error print to debug print
From: Tariq Toukan @ 2017-05-09 11:45 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Kamal Heib, Tariq Toukan
In-Reply-To: <1494330324-11752-1-git-send-email-tariqt@mellanox.com>

From: Kamal Heib <kamalh@mellanox.com>

The error print within mlx4_en_calc_rx_buf() should be a debug print.

Fixes: 51151a16a60f ('mlx4: allow order-0 memory allocations in RX path')
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index aa074e57ce06..77abd1813047 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -997,7 +997,8 @@ void mlx4_en_calc_rx_buf(struct net_device *dev)
 	en_dbg(DRV, priv, "Rx buffer scatter-list (effective-mtu:%d num_frags:%d):\n",
 	       eff_mtu, priv->num_frags);
 	for (i = 0; i < priv->num_frags; i++) {
-		en_err(priv,
+		en_dbg(DRV,
+		       priv,
 		       "  frag:%d - size:%d stride:%d\n",
 		       i,
 		       priv->frag_info[i].frag_size,
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net 3/3] net/mlx4_core: Reduce harmless SRIOV error message to debug level
From: Tariq Toukan @ 2017-05-09 11:45 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Jack Morgenstein, Tariq Toukan
In-Reply-To: <1494330324-11752-1-git-send-email-tariqt@mellanox.com>

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

Under SRIOV resource management, extra counters are allocated to VFs
from a free pool. If that pool is empty, the ALLOC_RES command for
a counter resource fails -- and this generates a misleading error
message in the message log.

Under SRIOV, each VF is allocated (i.e., guaranteed) 2 counters --
one counter per port. For ETH ports, the RoCE driver requests an
additional counter (above the guaranteed counters). If that request
fails, the VF RoCE driver simply uses the default (i.e., guaranteed)
counter for that port.

Thus, failing to allocate an additional counter does not constitute
a  problem, and the error message on the PF when this occurs should
be reduced to debug level.

Finally, to identify the situation that the reason for the failure is
that no resources are available to grant to the VF, we modified the
error returned by mlx4_grant_resource to -EDQUOT (Quota exceeded),
which more accurately describes the error.

Fixes: c3abb51bdb0e ("IB/mlx4: Add RoCE/IB dedicated counters")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/cmd.c              | 14 +++++++++++---
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |  2 +-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 0e0fa7030565..c1af47e45d3f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -1789,9 +1789,17 @@ static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave,
 	}
 
 	if (err) {
-		if (!(dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR))
-			mlx4_warn(dev, "vhcr command:0x%x slave:%d failed with error:%d, status %d\n",
-				  vhcr->op, slave, vhcr->errno, err);
+		if (!(dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR)) {
+			if (vhcr->op == MLX4_CMD_ALLOC_RES &&
+			    (vhcr->in_modifier & 0xff) == RES_COUNTER &&
+			    err == -EDQUOT)
+				mlx4_dbg(dev,
+					 "Unable to allocate counter for slave %d (%d)\n",
+					 slave, err);
+			else
+				mlx4_warn(dev, "vhcr command:0x%x slave:%d failed with error:%d, status %d\n",
+					  vhcr->op, slave, vhcr->errno, err);
+		}
 		vhcr_cmd->status = mlx4_errno_to_status(err);
 		goto out_status;
 	}
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 4aa29ee93013..07516545474f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -311,7 +311,7 @@ static inline int mlx4_grant_resource(struct mlx4_dev *dev, int slave,
 	struct mlx4_priv *priv = mlx4_priv(dev);
 	struct resource_allocator *res_alloc =
 		&priv->mfunc.master.res_tracker.res_alloc[res_type];
-	int err = -EINVAL;
+	int err = -EDQUOT;
 	int allocated, free, reserved, guaranteed, from_free;
 	int from_rsvd;
 
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH 0/4] net: stmmac: Fine-tuning for four function implementations
From: SF Markus Elfring @ 2017-05-09 11:51 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Giuseppe Cavallaro; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 13:48:03 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (4):
  Combine three seq_printf() calls into a seq_puts() in stmmac_sysfs_dma_cap_read()
  Replace five seq_printf() calls by seq_puts()
  Use seq_putc() in sysfs_display_ring()
  Delete an unnecessary return statement in stmmac_get_tx_hwtstamp()

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

-- 
2.12.2

^ permalink raw reply

* [PATCH 1/4] net: stmmac: Combine three seq_printf() calls into a seq_puts() in stmmac_sysfs_dma_cap_read()
From: SF Markus Elfring @ 2017-05-09 11:52 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Giuseppe Cavallaro; +Cc: LKML, kernel-janitors
In-Reply-To: <aa58027a-a39c-963e-4376-a4d5312ee118@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 13:10:28 +0200

A bit of text was put into a sequence by three separate function calls.
Print the same data by a single function call instead.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index cd8c60132390..2949c9fc18fa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3802,10 +3802,10 @@ static int stmmac_sysfs_dma_cap_read(struct seq_file *seq, void *v)
 		return 0;
 	}
 
-	seq_printf(seq, "==============================\n");
-	seq_printf(seq, "\tDMA HW features\n");
-	seq_printf(seq, "==============================\n");
-
+	seq_puts(seq,
+		 "==============================\n"
+		 "\tDMA HW features\n"
+		 "==============================\n");
 	seq_printf(seq, "\t10/100 Mbps: %s\n",
 		   (priv->dma_cap.mbps_10_100) ? "Y" : "N");
 	seq_printf(seq, "\t1000 Mbps: %s\n",
-- 
2.12.2

^ permalink raw reply related

* [PATCH 2/4] net: stmmac: Replace five seq_printf() calls by seq_puts()
From: SF Markus Elfring @ 2017-05-09 11:53 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Giuseppe Cavallaro; +Cc: LKML, kernel-janitors
In-Reply-To: <aa58027a-a39c-963e-4376-a4d5312ee118@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 13:20:03 +0200

Five strings which did not contain data format specifications should be put
into a sequence. Thus use the corresponding function "seq_puts".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 2949c9fc18fa..1f7022ce78b7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3748,11 +3748,11 @@ static int stmmac_sysfs_ring_read(struct seq_file *seq, void *v)
 		seq_printf(seq, "RX Queue %d:\n", queue);
 
 		if (priv->extend_desc) {
-			seq_printf(seq, "Extended descriptor ring:\n");
+			seq_puts(seq, "Extended descriptor ring:\n");
 			sysfs_display_ring((void *)rx_q->dma_erx,
 					   DMA_RX_SIZE, 1, seq);
 		} else {
-			seq_printf(seq, "Descriptor ring:\n");
+			seq_puts(seq, "Descriptor ring:\n");
 			sysfs_display_ring((void *)rx_q->dma_rx,
 					   DMA_RX_SIZE, 0, seq);
 		}
@@ -3764,11 +3764,11 @@ static int stmmac_sysfs_ring_read(struct seq_file *seq, void *v)
 		seq_printf(seq, "TX Queue %d:\n", queue);
 
 		if (priv->extend_desc) {
-			seq_printf(seq, "Extended descriptor ring:\n");
+			seq_puts(seq, "Extended descriptor ring:\n");
 			sysfs_display_ring((void *)tx_q->dma_etx,
 					   DMA_TX_SIZE, 1, seq);
 		} else {
-			seq_printf(seq, "Descriptor ring:\n");
+			seq_puts(seq, "Descriptor ring:\n");
 			sysfs_display_ring((void *)tx_q->dma_tx,
 					   DMA_TX_SIZE, 0, seq);
 		}
@@ -3798,7 +3798,7 @@ static int stmmac_sysfs_dma_cap_read(struct seq_file *seq, void *v)
 	struct stmmac_priv *priv = netdev_priv(dev);
 
 	if (!priv->hw_cap_support) {
-		seq_printf(seq, "DMA HW features not supported\n");
+		seq_puts(seq, "DMA HW features not supported\n");
 		return 0;
 	}
 
-- 
2.12.2

^ permalink raw reply related

* [PATCH 3/4] net: stmmac: Use seq_putc() in sysfs_display_ring()
From: SF Markus Elfring @ 2017-05-09 11:54 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Giuseppe Cavallaro; +Cc: LKML, kernel-janitors
In-Reply-To: <aa58027a-a39c-963e-4376-a4d5312ee118@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 13:24:27 +0200

A single character (line break) should be put into a sequence.
Thus use the corresponding function "seq_putc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 1f7022ce78b7..4fa95234978c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3730,7 +3730,7 @@ static void sysfs_display_ring(void *head, int size, int extend_desc,
 				   le32_to_cpu(p->des2), le32_to_cpu(p->des3));
 			p++;
 		}
-		seq_printf(seq, "\n");
+		seq_putc(seq, '\n');
 	}
 }
 
-- 
2.12.2

^ permalink raw reply related

* [PATCH 4/4] net: stmmac: Delete an unnecessary return statement in stmmac_get_tx_hwtstamp()
From: SF Markus Elfring @ 2017-05-09 11:55 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Giuseppe Cavallaro; +Cc: LKML, kernel-janitors
In-Reply-To: <aa58027a-a39c-963e-4376-a4d5312ee118@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 May 2017 13:36:04 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such a statement in the affected function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4fa95234978c..9ab4cbfa67f1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -445,8 +445,6 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv,
 		/* pass tstamp to stack */
 		skb_tstamp_tx(skb, &shhwtstamp);
 	}
-
-	return;
 }
 
 /* stmmac_get_rx_hwtstamp - get HW RX timestamps
-- 
2.12.2

^ permalink raw reply related

* Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code
From: Gustavo A. R. Silva @ 2017-05-09 12:00 UTC (permalink / raw)
  To: Kalle Valo
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <87lgq6387s.fsf-HodKDYzPHsUD5k0oWYwrnHL1okKdlPRT@public.gmane.org>

Hi Kalle,

Quoting Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>:

> "Gustavo A. R. Silva" <garsilva-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org> writes:
>
>> The name of an array used by itself will always return the array's address.
>> So these tests will always evaluate as false and therefore the _return_
>> will never be executed.
>>
>> Signed-off-by: Gustavo A. R. Silva <garsilva-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
>
> I don't understand the commit log, especially what does "The name of an
> array used by itself" mean?
>

Let me correct that and I'll send the patch again.

Thanks!
--
Gustavo A. R. Silva

^ permalink raw reply

* Re: [PATCH] net: wireless: ath: ath9k: remove unnecessary code
From: Gustavo A. R. Silva @ 2017-05-09 12:01 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath9k-devel, linux-wireless, netdev, linux-kernel
In-Reply-To: <87efvy1d07.fsf@kamboji.qca.qualcomm.com>

Hi Kalle,

Quoting Kalle Valo <kvalo@qca.qualcomm.com>:

> "Gustavo A. R. Silva" <garsilva@embeddedor.com> writes:
>
>> The name of an array used by itself will always return the array's address.
>> So this test will always evaluate as true.
>>
>> Addresses-Coverity-ID: 1364903
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> ---
>>  drivers/net/wireless/ath/ath9k/eeprom.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c  
>> b/drivers/net/wireless/ath/ath9k/eeprom.c
>> index fb80ec8..5c3bc28 100644
>> --- a/drivers/net/wireless/ath/ath9k/eeprom.c
>> +++ b/drivers/net/wireless/ath/ath9k/eeprom.c
>> @@ -143,7 +143,7 @@ bool ath9k_hw_nvram_read(struct ath_hw *ah, u32  
>> off, u16 *data)
>>
>>  	if (ah->eeprom_blob)
>>  		ret = ath9k_hw_nvram_read_firmware(ah->eeprom_blob, off, data);
>> -	else if (pdata && !pdata->use_eeprom && pdata->eeprom_data)
>> +	else if (pdata && !pdata->use_eeprom)
>>  		ret = ath9k_hw_nvram_read_pdata(pdata, off, data);
>>  	else
>>  		ret = common->bus_ops->eeprom_read(common, off, data);
>
> The patch may very well be valid (didn't check yet) but the commit log
> is gibberish for me.
>

Let me correct that and I'll send the patch again.

Thanks!
--
Gustavo A. R. Silva

^ permalink raw reply

* Re: [PATCH 1/4] net: macb: Add support for PTP timestamps in DMA descriptors
From: Richard Cochran @ 2017-05-09 12:04 UTC (permalink / raw)
  To: Rafal Ozieblo
  Cc: David Miller, nicolas.ferre, netdev, linux-kernel, devicetree,
	linux-arm-kernel, harini.katakam, andrei.pistirica
In-Reply-To: <1494321885-14384-1-git-send-email-rafalo@cadence.com>

On Tue, May 09, 2017 at 10:24:45AM +0100, Rafal Ozieblo wrote:
> This patch adds support for PTP timestamps in
> DMA buffer descriptors. It checks capability at runtime
> and uses appropriate buffer descriptor.
> 
> Signed-off-by: Rafal Ozieblo <rafalo@cadence.com>

You posted this series once before, on April 13, 2017.  That makes
this v2.  Please add v2 in the subject line, eg. [PATCH v2 1/4].

Also, add a cover letter [0/4] that summarizes the changes between v1
and v2 of the series.

Thanks,
Richard

^ permalink raw reply

* Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code
From: Arend Van Spriel @ 2017-05-09 12:07 UTC (permalink / raw)
  To: Kalle Valo, Gustavo A. R. Silva
  Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org, ath10k@lists.infradead.org
In-Reply-To: <87lgq6387s.fsf@kamboji.qca.qualcomm.com>

On 9-5-2017 7:33, Kalle Valo wrote:
> "Gustavo A. R. Silva" <garsilva@embeddedor.com> writes:
> 
>> The name of an array used by itself will always return the array's address.
>> So these tests will always evaluate as false and therefore the _return_
>> will never be executed.
>>
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> 
> I don't understand the commit log, especially what does "The name of an
> array used by itself" mean?

The array fields in struct wmi_start_scan_arg that are checked here are
fixed size arrays so they can never be NULL.

Maybe that helps rephrasing this commit message.

Regards,
Arend

^ permalink raw reply

* [PATCH net 0/5] qed*: General fixes
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

* [PATCH net 2/5] qed: Fix VF removal sequence
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz
In-Reply-To: <1494331671-16273-1-git-send-email-Yuval.Mintz@cavium.com>

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

* [PATCH net 1/5] qede: Fix XDP memory leak on unload
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Suddarsana Reddy Kalluru, Yuval Mintz
In-Reply-To: <1494331671-16273-1-git-send-email-Yuval.Mintz@cavium.com>

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

* [PATCH net 3/5] qed: Tell QM the number of tasks
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz
In-Reply-To: <1494331671-16273-1-git-send-email-Yuval.Mintz@cavium.com>

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

* [PATCH net 4/5] qed: Correct doorbell configuration for !4Kb pages
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Ram Amrani, Yuval Mintz
In-Reply-To: <1494331671-16273-1-git-send-email-Yuval.Mintz@cavium.com>

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

* [PATCH net 5/5] qede: Split PF/VF ndos.
From: Yuval Mintz @ 2017-05-09 12:07 UTC (permalink / raw)
  To: davem, netdev; +Cc: Yuval Mintz
In-Reply-To: <1494331671-16273-1-git-send-email-Yuval.Mintz@cavium.com>

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

* [PATCH net] rtnetlink: Fix the IFLA_PHYS_PORT_NAME TLV to include terminating NULL
From: Yotam Gigi @ 2017-05-09 12:12 UTC (permalink / raw)
  To: davem, zhangshengju, roopa, sd, bblanco, minipli, tklauser,
	nogahf, moshe, rshearma, daniel, netdev
  Cc: Yotam Gigi, David Ahern

The IFLA_PHYS_PORT_NAME rtnetlink TLV length does not include the
terminating NULL character, which is different from other string typed
TLVs. Due to the fact that libnl checks for the terminating NULL in every
string typed attribute, it crashes on every RTM_GETLINK response on
drivers that implement ndo_get_phys_port_name.

Make the fill_phys_port_name function include the terminating NULL in the
TLV size by using the nla_put_string helper function.

Fixes: db24a9044ee1 ("net: add support for phys_port_name")
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Cc: David Ahern <dsa@cumulusnetworks.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
Please consider this for stable too. Thanks!
---
 net/core/rtnetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index c4e84c5..69daf39 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1056,7 +1056,7 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
 		return err;
 	}
 
-	if (nla_put(skb, IFLA_PHYS_PORT_NAME, strlen(name), name))
+	if (nla_put_string(skb, IFLA_PHYS_PORT_NAME, name))
 		return -EMSGSIZE;
 
 	return 0;
-- 
2.4.11

^ permalink raw reply related

* Re: [PATCH] net: fec: select queue depending on VLAN priority
From: Andrew Lunn @ 2017-05-09 12:15 UTC (permalink / raw)
  To: Stefan Agner; +Cc: fugang.duan, festevam, netdev, linux-kernel
In-Reply-To: <20170509053708.2573-1-stefan@agner.ch>

On Mon, May 08, 2017 at 10:37:08PM -0700, Stefan Agner wrote:
> Since the addition of the multi queue code with commit 59d0f7465644
> ("net: fec: init multi queue date structure") the queue selection
> has been handelt by the default transmit queue selection
> implementation which tries to evenly distribute the traffic across
> all available queues. This selection presumes that the queues are
> using an equal priority, however, the queues 1 and 2 are actually
> of higher priority (the classification of the queues is enabled in
> fec_enet_enable_ring).
> 
> This can lead to net scheduler warnings and continuous TX ring
> dumps when exercising the system with iperf.
> 
> Use only queue 0 for all common traffic (no VLAN and P802.1p
> priority 0 and 1) and route level 2-7 through queue 1 and 2.

Hi Stefan

Did you try:

vconfig set_egress_map eth0.42 0 7
ip addr add 10.42.42.42/24 eth0.42
iperf -c 10.42.42.1

i.e. send a continuous stream on one of the higher priority queues.

>From what was said earlier in this thread, isn't queue 0 going to be
starved? As well as this patch, don't we also need some default
bandwidth allocations to the queues to ensure queue 0 does get some
bandwidth?

	Andrew

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox