Netdev List
 help / color / mirror / Atom feed
* [PATCH net] openvswitch: Fix pop_vlan action for double tagged frames
From: Eric Garver @ 2017-12-19 18:57 UTC (permalink / raw)
  To: netdev; +Cc: Jiri Benc, ovs-dev

skb_vlan_pop() expects skb->protocol to be a valid TPID for double
tagged frames. As such don't override skb->protocol for normal ethernet
frames when extracting the key.

Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
Signed-off-by: Eric Garver <e@erig.me>
---
 net/openvswitch/flow.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index dbe2379329c5..06d32ba3dd69 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -559,8 +559,9 @@ static int parse_nsh(struct sk_buff *skb, struct sw_flow_key *key)
  *      of a correct length, otherwise the same as skb->network_header.
  *      For other key->eth.type values it is left untouched.
  *
- *    - skb->protocol: the type of the data starting at skb->network_header.
- *      Equals to key->eth.type.
+ *    - skb->protocol: For Ethernet, the ethertype or VLAN TPID.
+ *      For non-Ethernet, the type of the data starting at skb->network_header
+ *      (also equal to key->eth.type).
  */
 static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
 {
@@ -579,6 +580,7 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
 			return -EINVAL;
 
 		skb_reset_network_header(skb);
+		key->eth.type = skb->protocol;
 	} else {
 		eth = eth_hdr(skb);
 		ether_addr_copy(key->eth.src, eth->h_source);
@@ -592,15 +594,14 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
 		if (unlikely(parse_vlan(skb, key)))
 			return -ENOMEM;
 
-		skb->protocol = parse_ethertype(skb);
-		if (unlikely(skb->protocol == htons(0)))
+		key->eth.type = parse_ethertype(skb);
+		if (unlikely(key->eth.type == htons(0)))
 			return -ENOMEM;
 
 		skb_reset_network_header(skb);
 		__skb_push(skb, skb->data - skb_mac_header(skb));
 	}
 	skb_reset_mac_len(skb);
-	key->eth.type = skb->protocol;
 
 	/* Network layer. */
 	if (key->eth.type == htons(ETH_P_IP)) {
-- 
2.12.0

^ permalink raw reply related

* Re: [net-next: PATCH 0/8] Armada 7k/8k PP2 ACPI support
From: Marcin Wojtas @ 2017-12-19 18:59 UTC (permalink / raw)
  To: David Miller
  Cc: linux-kernel, linux-arm-kernel, netdev, Russell King - ARM Linux,
	Rafael J. Wysocki, Andrew Lunn, Florian Fainelli,
	Antoine Ténart, Thomas Petazzoni, Gregory Clément,
	Ezequiel Garcia, nadavh, Neta Zur Hershkovits, Ard Biesheuvel,
	Grzegorz Jaszczyk, Tomasz Nowicki
In-Reply-To: <20171219.134810.48027351795338458.davem@davemloft.net>

Hi David,

2017-12-19 19:48 GMT+01:00 David Miller <davem@davemloft.net>:
> From: Marcin Wojtas <mw@semihalf.com>
> Date: Mon, 18 Dec 2017 10:17:56 +0100
>
>> Above support configures 1G to use its PHY normally. 10G can work now
>> only with the link interrupt mode. Somehow reading of the
>> string property in fwnode_mdiobus_child_is_phy works only with
>> DT and cannot cope with 10G PHY nodes as in:
>> https://pastebin.com/3JnYpU0A
>>
>> Above root cause will be further checked. In the meantime I will
>> appreciate any comments or remarks for the kernel patches.
>
> I would like you to figure this out before these changes go in.
>

Of course! v2 will not have such problem, I've been waiting however
for the feedback about the ACPI representation. Anyway, I'm strongly
leaning towards using _ADR/_CID objects in PHY's nodes for ACPI, so
maybe I'll just issue the v2 in order to push the discussion a bit
forward.

Thanks,
Marcin

^ permalink raw reply

* Re: [PATCH net] ipv4: Fix use-after-free when flushing FIB tables
From: David Miller @ 2017-12-19 19:01 UTC (permalink / raw)
  To: idosch
  Cc: alexander.duyck, idosch, netdev, alexander.h.duyck, fengguang.wu,
	dsahern, mlxsw
In-Reply-To: <20171219184913.GA18980@splinter>

From: Ido Schimmel <idosch@idosch.org>
Date: Tue, 19 Dec 2017 20:49:13 +0200

> How about I'll send v2 with a comment and then we can try Alex's
> suggestion in net-next?

Sounds good.

^ permalink raw reply

* Re: [PATCH net-next v5 0/5] Introduce NETIF_F_GRO_HW
From: Marcelo Ricardo Leitner @ 2017-12-19 19:04 UTC (permalink / raw)
  To: David Miller; +Cc: michael.chan, netdev, andrew.gospodarek
In-Reply-To: <20171219.105024.1047087594002892419.davem@davemloft.net>

On Tue, Dec 19, 2017 at 10:50:24AM -0500, David Miller wrote:
> From: Michael Chan <michael.chan@broadcom.com>
> Date: Sat, 16 Dec 2017 03:09:39 -0500
> 
> > Introduce NETIF_F_GRO_HW feature flag and convert drivers that support
> > hardware GRO to use the new flag.
> 
> Series applied, thanks for following through with this work.

Can we clarify on the meaning/expectations of dev_weight? The
documentation currently says:
The maximum number of packets that kernel can handle on a NAPI
interrupt, it's a Per-CPU variable.

I believe 'packets' here refers to packets on the wire.

For drivers doing LRO, we don't have visibility on how many
packets were aggregated so they count as 1, aggregated or not.

But for GRO_HW, drivers implementing it will get a bonus on its
dev_weight because instead of pulling 5 packets in a cycle to create 1
gro'ed skb, it will pull 1 big packet (which includes 5) and count it
as 1.

I understand that for all that matters, the hardware operations
involved on GRO_HW are really for only 1 packet, so it would make
sense to count it as 1. OTOH, this bump may cause additional pressure
in other places as in fact we are allowing more packets in in a given
cycle.

At least qede driver is counting 1 GRO_HW pkt as 1 budget.

Thanks,
Marcelo

^ permalink raw reply

* Re: pull-request: wireless-drivers-next 2017-12-18
From: David Miller @ 2017-12-19 19:06 UTC (permalink / raw)
  To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	luciano.coelho-ral2JQCrhuEAvxtiuMwx3w
In-Reply-To: <874looktmz.fsf-HodKDYzPHsUD5k0oWYwrnHL1okKdlPRT@public.gmane.org>

From: Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Date: Mon, 18 Dec 2017 16:17:24 +0200

> a pull request for 4.16 to net-next tree. This is a big one, but on the
> other hand most of the stuff here has been some time on linux-next so
> hopefully there are no nasty surprises. Even though Arnd just send a
> patch[1] five minutes ago about fixing a wcn36xx build warning, but I
> don't think that's critical enough to hold up this, so I'll send it to
> you in the next pull request.
> 
> But this time we actually have a merge conflict due to a000 hardware
> rename in iwlwifi:
> 
> CONFLICT (content): Merge conflict in drivers/net/wireless/intel/iwlwifi/pcie/drv.c
> 
> The fix is quite straightforward, take the 22000 versions and manually
> add an entry for 0xA0F0 device:
> 
> {IWL_PCI_DEVICE(0xA0F0, 0x0000, iwl22000_2ax_cfg_hr)},
> 
> I put the 'git diff' output of my test resolution below, hopefully it
> helps. I'll also Cc Luca so he can correct any mistakes I did :)
> 
> Please let me know if you have any problems.

Pulled, and thanks for the resolution diff.  It helped a lot.

^ permalink raw reply

* Re: [PATCH 0/2 net-next] ibmvnic: Fix and increase maximum TX/RX queues
From: David Miller @ 2017-12-19 19:08 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev
In-Reply-To: <1513623132-16554-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Mon, 18 Dec 2017 12:52:10 -0600

> This series renames IBMVNIC_MAX_TX_QUEUES to IBMVNIC_MAX_QUEUES since
> it is used to allocate both RX and TX queues. The value is also increased
> to accommodate newer hardware.

Series applied.

^ permalink raw reply

* Re: [PATCH net-next] ibmvnic: Include header descriptor support for ARP packets
From: David Miller @ 2017-12-19 19:10 UTC (permalink / raw)
  To: tlfalcon; +Cc: netdev
In-Reply-To: <1513623160-16621-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Mon, 18 Dec 2017 12:52:40 -0600

> In recent tests with new adapters, it was discovered that ARP
> packets were not being properly processed. This patch adds
> support for ARP packet headers to be passed to backing adapters,
> if necessary.
> 
> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>

Applied.

^ permalink raw reply

* Re: [net 1/1] tipc: fix list sorting bug in function tipc_group_update_member()
From: David Miller @ 2017-12-19 19:10 UTC (permalink / raw)
  To: jon.maloy
  Cc: netdev, mohan.krishna.ghanta.krishnamurthy, tung.q.nguyen,
	hoang.h.le, canh.d.luu, ying.xue, tipc-discussion
In-Reply-To: <1513623785-26566-1-git-send-email-jon.maloy@ericsson.com>

From: Jon Maloy <jon.maloy@ericsson.com>
Date: Mon, 18 Dec 2017 20:03:05 +0100

> When, during a join operation, or during message transmission, a group
> member needs to be added to the group's 'congested' list, we sort it
> into the list in ascending order, according to its current advertised
> window size. However, we miss the case when the member is already on
> that list. This will have the result that the member, after the window
> size has been decremented, might be at the wrong position in that list.
> This again may have the effect that we during broadcast and multicast
> transmissions miss the fact that a destination is not yet ready for
> reception, and we end up sending anyway. From this point on, the
> behavior during the remaining session is unpredictable, e.g., with
> underflowing window sizes.
> 
> We now correct this bug by unconditionally removing the member from
> the list before (re-)sorting it in.
> 
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>

Applied, thanks Jon.

^ permalink raw reply

* Re: [PATCH v3 net-next 3/6] net: Add SW fallback infrastructure for offloaded sockets
From: Eric Dumazet @ 2017-12-19 19:12 UTC (permalink / raw)
  To: Ilya Lesokhin, netdev, davem
  Cc: davejwatson, tom, hannes, borisp, aviadye, liranl
In-Reply-To: <20171218111033.13256-4-ilyal@mellanox.com>

On Mon, 2017-12-18 at 13:10 +0200, Ilya Lesokhin wrote:
> Offloaded sockets rely on the netdev to transform the transmitted
> packets before sending them over the network.
> When a packet from an offloaded socket is looped back or
> rerouted to a different device we need to detect it and
> do the transformation in software
> 
> Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
> Signed-off-by: Boris Pismenny <borisp@mellanox.com>
> ---
>  include/net/sock.h | 17 +++++++++++++++++
>  net/core/dev.c     |  4 ++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 9a9047268d37..5397307603ec 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -479,6 +479,9 @@ struct sock {
>  	void			(*sk_error_report)(struct sock *sk);
>  	int			(*sk_backlog_rcv)(struct sock *sk,
>  						  struct sk_buff *skb);
> +	struct sk_buff*		(*sk_offload_check)(struct sock *sk,
> +						    struct net_device *dev,
> +						    struct sk_buff *skb);
>  	void                    (*sk_destruct)(struct sock *sk);
>  	struct sock_reuseport __rcu	*sk_reuseport_cb;
>  	struct rcu_head		sk_rcu;
> @@ -2324,6 +2327,20 @@ static inline bool sk_fullsock(const struct sock *sk)
>  	return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV);
>  }
>  
> +/* Checks if this SKB belongs to an HW offloaded socket
> + * and whether any SW fallbacks are required based on dev.
> + */
> +static inline struct sk_buff *skb_offload_check(struct sk_buff *skb,
> +						struct net_device *dev)
> +{
> +	struct sock *sk = skb->sk;
> +
> +	if (sk && sk_fullsock(sk) && sk->sk_offload_check)
> +		skb = sk->sk_offload_check(sk, dev, skb);
> +
> +	return skb;
> +}
> +
>  /* This helper checks if a socket is a LISTEN or NEW_SYN_RECV
>   * SYNACK messages can be attached to either ones (depending on SYNCOOKIE)
>   */
> diff --git a/net/core/dev.c b/net/core/dev.c
> index b0eee49a2489..6a78d9046674 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3051,6 +3051,10 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
>  	if (unlikely(!skb))
>  		goto out_null;
>  
> +	skb = skb_offload_check(skb, dev);
> +	if (!skb)
> +		goto out_null;
> +
>  	if (netif_needs_gso(skb, features)) {
>  		struct sk_buff *segs;
>  

How is it going to work with stacked devices (bonding, team, tunnels) ?

^ permalink raw reply

* Re: [PATCH 1/2] net: stmmac: Fix TX timestamp calculation
From: David Miller @ 2017-12-19 19:12 UTC (permalink / raw)
  To: megahallon
  Cc: netdev, linux-kernel, Jose.Abreu, peppe.cavallaro,
	alexandre.torgue
In-Reply-To: <20171218223400.29644-1-megahallon@gmail.com>

From: Fredrik Hallenberg <megahallon@gmail.com>
Date: Mon, 18 Dec 2017 23:33:59 +0100

> When using GMAC4 the value written in PTP_SSIR should be shifted however
> the shifted value is also used in subsequent calculations which results
> in a bad timestamp value.
> 
> Signed-off-by: Fredrik Hallenberg <megahallon@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/2] net: stmmac: Fix bad RX timestamp extraction
From: David Miller @ 2017-12-19 19:12 UTC (permalink / raw)
  To: megahallon
  Cc: netdev, linux-kernel, Jose.Abreu, peppe.cavallaro,
	alexandre.torgue
In-Reply-To: <20171218223400.29644-2-megahallon@gmail.com>

From: Fredrik Hallenberg <megahallon@gmail.com>
Date: Mon, 18 Dec 2017 23:34:00 +0100

> As noted in dwmac4_wrback_get_rx_timestamp_status the timestamp is found
> in the context descriptor following the current descriptor. However the
> current code looks for the context descriptor in the current
> descriptor, which will always fail.
> 
> Signed-off-by: Fredrik Hallenberg <megahallon@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH v3 net-next 1/6] tcp: Add clean acked data hook
From: Eric Dumazet @ 2017-12-19 19:13 UTC (permalink / raw)
  To: Ilya Lesokhin, netdev, davem
  Cc: davejwatson, tom, hannes, borisp, aviadye, liranl
In-Reply-To: <20171218111033.13256-2-ilyal@mellanox.com>

On Mon, 2017-12-18 at 13:10 +0200, Ilya Lesokhin wrote:
> Called when a TCP segment is acknowledged.
> Could be used by application protocols who hold additional
> metadata associated with the stream data
> This is required by TLS device offload to release
> metadata associated with acknowledged TLS records.
> 
> Signed-off-by: Boris Pismenny <borisp@mellanox.com>
> Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
> Signed-off-by: Aviad Yehezkel <aviadye@mellanox.com>
> ---
>  include/net/inet_connection_sock.h | 2 ++
>  net/ipv4/tcp_input.c               | 3 +++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
> index 8e1bf9ae4a5e..ec405a667a85 100644
> --- a/include/net/inet_connection_sock.h
> +++ b/include/net/inet_connection_sock.h
> @@ -77,6 +77,7 @@ struct inet_connection_sock_af_ops {
>   * @icsk_af_ops		   Operations which are AF_INET{4,6} specific
>   * @icsk_ulp_ops	   Pluggable ULP control hook
>   * @icsk_ulp_data	   ULP private data
> + * @icsk_clean_acked	   Clean acked data hook
>   * @icsk_listen_portaddr_node	hash to the portaddr listener hashtable
>   * @icsk_ca_state:	   Congestion control state
>   * @icsk_retransmits:	   Number of unrecovered [RTO] timeouts
> @@ -102,6 +103,7 @@ struct inet_connection_sock {
>  	const struct inet_connection_sock_af_ops *icsk_af_ops;
>  	const struct tcp_ulp_ops  *icsk_ulp_ops;
>  	void			  *icsk_ulp_data;
> +	void			  (*icsk_clean_acked)(struct sock *sk);
>  	struct hlist_node         icsk_listen_portaddr_node;
>  	unsigned int		  (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
>  	__u8			  icsk_ca_state:6,
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 4d55c4b338ee..961abc5be84c 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -3592,6 +3592,9 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
>  	if (!prior_packets)
>  		goto no_queue;
>  
> +	if (icsk->icsk_clean_acked)
> +		icsk->icsk_clean_acked(sk);
> +
>  	/* See if we can take anything off of the retransmit queue. */
>  	flag |= tcp_clean_rtx_queue(sk, prior_fack, prior_snd_una, &sack_state);
>  

1) tcp_ack() is already very expensive.

2) Since you do not pass any state here, this looks very suspicious to
me.

^ permalink raw reply

* Re: [Patch net-next] net_sched: properly check for empty skb array on error path
From: David Miller @ 2017-12-19 19:13 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, john.fastabend
In-Reply-To: <20171218223426.4685-1-xiyou.wangcong@gmail.com>

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 18 Dec 2017 14:34:26 -0800

> First, the check of &q->ring.queue against NULL is wrong, it
> is always false. We should check the value rather than the address.
> 
> Secondly, we need the same check in pfifo_fast_reset() too,
> as both ->reset() and ->destroy() are called in qdisc_destroy().
> 
> Fixes: c5ad119fb6c0 ("net: sched: pfifo_fast use skb_array")
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, thanks Cong.

^ permalink raw reply

* [PATCH v1 1/4] lib/net_utils: Relax NULL-termination requirement on input string
From: Andy Shevchenko @ 2017-12-19 19:14 UTC (permalink / raw)
  To: David S. Miller, netdev, Larry Finger, Florian Schilhabel, devel,
	Greg Kroah-Hartman
  Cc: Andy Shevchenko

We have not been caring about garbage at the end of input string and this
change doesn't affect it. What we prevent here is possibility to go over
boundaries when input string is not NULL terminated at all.

Allow mac_pton() work on non-NULL terminated strings.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 lib/net_utils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/net_utils.c b/lib/net_utils.c
index af525353395d..d32c6961fe0f 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -4,12 +4,14 @@
 #include <linux/ctype.h>
 #include <linux/kernel.h>
 
+#define MAC_PTON_MINLEN		(3 * ETH_ALEN - 1)
+
 bool mac_pton(const char *s, u8 *mac)
 {
 	int i;
 
 	/* XX:XX:XX:XX:XX:XX */
-	if (strlen(s) < 3 * ETH_ALEN - 1)
+	if (strnlen(s, MAC_PTON_MINLEN) < MAC_PTON_MINLEN)
 		return false;
 
 	/* Don't dirty result unless string is valid MAC. */
-- 
2.15.1

^ permalink raw reply related

* [PATCH v1 4/4] staging: rtl8712: Replace mac address parsing
From: Andy Shevchenko @ 2017-12-19 19:14 UTC (permalink / raw)
  To: David S. Miller, netdev, Larry Finger, Florian Schilhabel, devel,
	Greg Kroah-Hartman
  Cc: Andy Shevchenko
In-Reply-To: <20171219191412.14880-1-andriy.shevchenko@linux.intel.com>

Replace copy_from_user() + mac_pton() with mac_pton_from_user().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index e30a5be5f318..3f82c39eb071 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1953,7 +1953,7 @@ static int r871x_get_ap_info(struct net_device *dev,
 	struct list_head *plist, *phead;
 	unsigned char *pbuf;
 	u8 bssid[ETH_ALEN];
-	char data[33];
+	int ret;
 
 	if (padapter->bDriverStopped || (pdata == NULL))
 		return -EINVAL;
@@ -1967,9 +1967,11 @@ static int r871x_get_ap_info(struct net_device *dev,
 	pdata->flags = 0;
 	if (pdata->length < 32)
 		return -EINVAL;
-	if (copy_from_user(data, pdata->pointer, 32))
-		return -EINVAL;
-	data[32] = 0;
+	ret = mac_pton_from_user(pdata->pointer, 32, bssid);
+	if (ret)
+		return ret;
+
+	netdev_info(dev, "r8712u: BSSID:%pM\n", bssid);
 
 	spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
 	phead = &queue->queue;
@@ -1978,14 +1980,6 @@ static int r871x_get_ap_info(struct net_device *dev,
 		if (end_of_queue_search(phead, plist))
 			break;
 		pnetwork = container_of(plist, struct wlan_network, list);
-		if (!mac_pton(data, bssid)) {
-			netdev_info(dev, "r8712u: Invalid BSSID '%s'.\n",
-				    (u8 *)data);
-			spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
-					       irqL);
-			return -EINVAL;
-		}
-		netdev_info(dev, "r8712u: BSSID:%pM\n", bssid);
 		if (ether_addr_equal(bssid, pnetwork->network.MacAddress)) {
 			/* BSSID match, then check if supporting wpa/wpa2 */
 			pbuf = r8712_get_wpa_ie(&pnetwork->network.IEs[12],
-- 
2.15.1

^ permalink raw reply related

* Re: [PATCH net-next v2] cxgb4: RSS table is 4k for T6
From: David Miller @ 2017-12-19 19:14 UTC (permalink / raw)
  To: ganeshgr; +Cc: netdev, nirranjan, indranil, venkatesh
In-Reply-To: <1513648348-7956-1-git-send-email-ganeshgr@chelsio.com>

From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Tue, 19 Dec 2017 07:22:28 +0530

> RSS table is 4k for T6 and later cards, add check for the
> same.
> 
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>

Applied, thanks Ganesh.

^ permalink raw reply

* [PATCH v1 2/4] lib/net_utils: Introduce mac_pton_from_user()
From: Andy Shevchenko @ 2017-12-19 19:14 UTC (permalink / raw)
  To: David S. Miller, netdev, Larry Finger, Florian Schilhabel, devel,
	Greg Kroah-Hartman
  Cc: Andy Shevchenko
In-Reply-To: <20171219191412.14880-1-andriy.shevchenko@linux.intel.com>

Some drivers are getting MAC from user space. Make a helper for them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/kernel.h |  1 +
 lib/net_utils.c        | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ce51455e2adf..e203b313608d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -587,6 +587,7 @@ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
 extern char *bin2hex(char *dst, const void *src, size_t count);
 
 bool mac_pton(const char *s, u8 *mac);
+int __must_check mac_pton_from_user(const char __user *s, size_t count, u8 *mac);
 
 /*
  * General tracing related utility functions - trace_printk(),
diff --git a/lib/net_utils.c b/lib/net_utils.c
index d32c6961fe0f..7be3483aece6 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -3,6 +3,7 @@
 #include <linux/if_ether.h>
 #include <linux/ctype.h>
 #include <linux/kernel.h>
+#include <linux/uaccess.h>
 
 #define MAC_PTON_MINLEN		(3 * ETH_ALEN - 1)
 
@@ -27,3 +28,14 @@ bool mac_pton(const char *s, u8 *mac)
 	return true;
 }
 EXPORT_SYMBOL(mac_pton);
+
+int mac_pton_from_user(const char __user *s, size_t count, u8 *mac)
+{
+	char buf[MAC_PTON_MINLEN];
+
+	count = min(count, sizeof(buf));
+	if (copy_from_user(buf, s, count))
+		return -EFAULT;
+	return mac_pton(buf, mac) ? 0 : -EINVAL;
+}
+EXPORT_SYMBOL(mac_pton_from_user);
-- 
2.15.1

^ permalink raw reply related

* [PATCH v1 3/4] staging: rtl8723bs: Replace mac address parsing
From: Andy Shevchenko @ 2017-12-19 19:14 UTC (permalink / raw)
  To: David S. Miller, netdev, Larry Finger, Florian Schilhabel, devel,
	Greg Kroah-Hartman
  Cc: Andy Shevchenko
In-Reply-To: <20171219191412.14880-1-andriy.shevchenko@linux.intel.com>

Replace copy_from_user() + sscanf() with mac_pton_from_user().

While here, replace memcpy(..., ETH_ALEN) with ether_addr_copy().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/rtl8723bs/core/rtw_debug.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c b/drivers/staging/rtl8723bs/core/rtw_debug.c
index b5dd244fee8f..79ac91a6c3ba 100644
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
@@ -380,21 +380,15 @@ ssize_t proc_set_roam_tgt_addr(struct file *file, const char __user *buffer, siz
 {
 	struct net_device *dev = data;
 	struct adapter *adapter = (struct adapter *)rtw_netdev_priv(dev);
-
-	char tmp[32];
 	u8 addr[ETH_ALEN];
+	int ret;
 
-	if (count < 1)
-		return -EFAULT;
-
-	if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
-
-		int num = sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", addr, addr+1, addr+2, addr+3, addr+4, addr+5);
-		if (num == 6)
-			memcpy(adapter->mlmepriv.roam_tgt_addr, addr, ETH_ALEN);
+	ret = mac_pton_from_user(buffer, count, addr);
+	if (ret)
+		return ret;
 
-		DBG_871X("set roam_tgt_addr to "MAC_FMT"\n", MAC_ARG(adapter->mlmepriv.roam_tgt_addr));
-	}
+	ether_addr_copy(adapter->mlmepriv.roam_tgt_addr, addr);
+	DBG_871X("set roam_tgt_addr to "MAC_FMT"\n", MAC_ARG(adapter->mlmepriv.roam_tgt_addr));
 
 	return count;
 }
-- 
2.15.1

^ permalink raw reply related

* Re: [PATCH net] net: always reevalulate autoflowlabel setting for reset packet
From: David Miller @ 2017-12-19 19:15 UTC (permalink / raw)
  To: shli; +Cc: netdev, Kernel-team, shli, kafai
In-Reply-To: <b20c7b756a507786dbbe2127b3c014954a1587fd.1513652093.git.shli@fb.com>

From: Shaohua Li <shli@kernel.org>
Date: Mon, 18 Dec 2017 18:58:25 -0800

> @@ -789,7 +789,9 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
>  	unsigned int tot_len = sizeof(struct tcphdr);
>  	struct dst_entry *dst;
>  	__be32 *topt;
> +	struct ipv6_pinfo *np = inet6_sk(ctl_sk);
>  
> +	np->autoflowlabel = ip6_default_np_autolabel(net);

Please put the 'np' variable declaration a few lines up in order to preserve
the reverse christmas tree ordering of local variables (longest to
shortest line).

THank you.

^ permalink raw reply

* RE: [PATCH v3 net-next 3/6] net: Add SW fallback infrastructure for offloaded sockets
From: Ilya Lesokhin @ 2017-12-19 19:15 UTC (permalink / raw)
  To: Eric Dumazet, netdev@vger.kernel.org, davem@davemloft.net
  Cc: davejwatson@fb.com, tom@herbertland.com,
	hannes@stressinduktion.org, Boris Pismenny, Aviad Yehezkel,
	Liran Liss
In-Reply-To: <1513710737.64874.2.camel@gmail.com>

> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index b0eee49a2489..6a78d9046674 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -3051,6 +3051,10 @@ static struct sk_buff *validate_xmit_skb(struct
> sk_buff *skb, struct net_device
> >  	if (unlikely(!skb))
> >  		goto out_null;
> >
> > +	skb = skb_offload_check(skb, dev);
> > +	if (!skb)
> > +		goto out_null;
> > +
> >  	if (netif_needs_gso(skb, features)) {
> >  		struct sk_buff *segs;
> >
> 
> How is it going to work with stacked devices (bonding, team, tunnels) ?
> 

Currently we don't support TLS offload on stacked devices.
Note however that in that case the TLS layer will refuse to use device offload
And we will not go through this software offload path.


^ permalink raw reply

* Re: [PATCH V2 net-next 01/17] net: hns3: add support to query tqps number
From: David Miller @ 2017-12-19 19:16 UTC (permalink / raw)
  To: lipeng321; +Cc: netdev, linux-kernel, linuxarm, salil.mehta
In-Reply-To: <1513656159-127589-2-git-send-email-lipeng321@huawei.com>

From: Lipeng <lipeng321@huawei.com>
Date: Tue, 19 Dec 2017 12:02:23 +0800

> @@ -5002,6 +5002,26 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
>  	ae_dev->priv = NULL;
>  }
>  
> +static u32 hclge_get_max_channels(struct hnae3_handle *handle)
> +{
> +	struct hclge_vport *vport = hclge_get_vport(handle);
> +	struct hnae3_knic_private_info *kinfo = &handle->kinfo;
> +	struct hclge_dev *hdev = vport->back;
> +

Please order local variables from longest to shortest line.

Please audit your entire submission for this problem.

^ permalink raw reply

* Re: [PATCH V2 net-next 02/17] net: hns3: add support to modify tqps number
From: David Miller @ 2017-12-19 19:18 UTC (permalink / raw)
  To: lipeng321; +Cc: netdev, linux-kernel, linuxarm, salil.mehta
In-Reply-To: <1513656159-127589-3-git-send-email-lipeng321@huawei.com>

From: Lipeng <lipeng321@huawei.com>
Date: Tue, 19 Dec 2017 12:02:24 +0800

> @@ -2651,6 +2651,19 @@ static int hns3_get_ring_config(struct hns3_nic_priv *priv)
>  	return ret;
>  }
>  
> +static void hns3_put_ring_config(struct hns3_nic_priv *priv)
> +{
> +	struct hnae3_handle *h = priv->ae_handle;
> +	u16 i;
> +
> +	for (i = 0; i < h->kinfo.num_tqps; i++) {

Please use a plain "int" for index iteration loops like this since
that is the canonical type to use.

> +static void hclge_release_tqp(struct hclge_vport *vport)
> +{
> +	struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo;
> +	struct hclge_dev *hdev = vport->back;
> +	u16 i;
> +
> +	for (i = 0; i < kinfo->num_tqps; i++) {

Likewise.

^ permalink raw reply

* Re: [PATCH v1] net: pasemi: Replace mac address parsing
From: Randy Dunlap @ 2017-12-19 19:19 UTC (permalink / raw)
  To: Andy Shevchenko, Kees Cook, Eric Dumazet, David S. Miller, netdev
In-Reply-To: <20171219183103.74530-1-andriy.shevchenko@linux.intel.com>

On 12/19/2017 10:31 AM, Andy Shevchenko wrote:
> Replace sscanf() with mac_pton().
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

You don't need to select GENERIC_NET_UTILS for that?

> ---
>  drivers/net/ethernet/pasemi/pasemi_mac.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
> index c9a55b774935..07a2eb3781b1 100644
> --- a/drivers/net/ethernet/pasemi/pasemi_mac.c
> +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
> @@ -212,9 +212,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
>  		return -ENOENT;
>  	}
>  
> -	if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
> -		   &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
> -	    != ETH_ALEN) {
> +	if (!mac_pton(maddr, addr)) {
>  		dev_warn(&pdev->dev,
>  			 "can't parse mac address, not configuring\n");
>  		return -EINVAL;
> 


-- 
~Randy

^ permalink raw reply

* RE: [PATCH v3 net-next 1/6] tcp: Add clean acked data hook
From: Ilya Lesokhin @ 2017-12-19 19:21 UTC (permalink / raw)
  To: Eric Dumazet, netdev@vger.kernel.org, davem@davemloft.net
  Cc: davejwatson@fb.com, tom@herbertland.com,
	hannes@stressinduktion.org, Boris Pismenny, Aviad Yehezkel,
	Liran Liss
In-Reply-To: <1513710804.64874.3.camel@gmail.com>

> 1) tcp_ack() is already very expensive.
> 
I'm not sure how what we should do with that comment. We need
Some trigger to free TLS records. tcp_ack seemed like a reasonable
Trigger.

> 2) Since you do not pass any state here, this looks very suspicious to
> me.
> 
The state we need is the acknowledged sequence and it located in the socket.
https://github.com/Mellanox/tls-offload/blob/tls_device_v3/net/tls/tls_device.c#L157


^ permalink raw reply

* Re: [PATCH v1] bridge: Use helpers to handle MAC address
From: Randy Dunlap @ 2017-12-19 19:21 UTC (permalink / raw)
  To: Andy Shevchenko, Stephen Hemminger, David S. Miller, bridge,
	netdev
In-Reply-To: <20171219181053.86320-1-andriy.shevchenko@linux.intel.com>

On 12/19/2017 10:10 AM, Andy Shevchenko wrote:
> Use
> 	%pM to print MAC
> 	mac_pton() to convert it from ASCII to binary format, and
> 	ether_addr_copy() to copy.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

(same)
	select GENERIC_NET_UTILS
?

> ---
>  net/bridge/br_sysfs_br.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
> index 723f25eed8ea..b1be0dcfba6b 100644
> --- a/net/bridge/br_sysfs_br.c
> +++ b/net/bridge/br_sysfs_br.c
> @@ -272,10 +272,7 @@ static ssize_t group_addr_show(struct device *d,
>  			       struct device_attribute *attr, char *buf)
>  {
>  	struct net_bridge *br = to_bridge(d);
> -	return sprintf(buf, "%x:%x:%x:%x:%x:%x\n",
> -		       br->group_addr[0], br->group_addr[1],
> -		       br->group_addr[2], br->group_addr[3],
> -		       br->group_addr[4], br->group_addr[5]);
> +	return sprintf(buf, "%pM\n", br->group_addr);
>  }
>  
>  static ssize_t group_addr_store(struct device *d,
> @@ -284,14 +281,11 @@ static ssize_t group_addr_store(struct device *d,
>  {
>  	struct net_bridge *br = to_bridge(d);
>  	u8 new_addr[6];
> -	int i;
>  
>  	if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN))
>  		return -EPERM;
>  
> -	if (sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
> -		   &new_addr[0], &new_addr[1], &new_addr[2],
> -		   &new_addr[3], &new_addr[4], &new_addr[5]) != 6)
> +	if (!mac_pton(buf, new_addr))
>  		return -EINVAL;
>  
>  	if (!is_link_local_ether_addr(new_addr))
> @@ -306,8 +300,7 @@ static ssize_t group_addr_store(struct device *d,
>  		return restart_syscall();
>  
>  	spin_lock_bh(&br->lock);
> -	for (i = 0; i < 6; i++)
> -		br->group_addr[i] = new_addr[i];
> +	ether_addr_copy(br->group_addr, new_addr);
>  	spin_unlock_bh(&br->lock);
>  
>  	br->group_addr_set = true;
> 


-- 
~Randy

^ 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