Netdev List
 help / color / mirror / Atom feed
* Re: [patch iproute2] tc: add support for vlan tc action
From: Jamal Hadi Salim @ 2014-11-11 13:36 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, pshelar, therbert, edumazet, willemb, dborkman, mst, fw,
	Paul.Durrant, tgraf, Stephen Hemminger
In-Reply-To: <1415700966-9225-1-git-send-email-jiri@resnulli.us>

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]


Ive run out of time - but will test; so far looks good.
Attached a small patchlet on top of yours.

cheers,
jamal

[-- Attachment #2: patch-for-jiri --]
[-- Type: text/plain, Size: 1493 bytes --]

diff --git a/tc/m_vlan.c b/tc/m_vlan.c
index 54c0ce7..2755e20 100644
--- a/tc/m_vlan.c
+++ b/tc/m_vlan.c
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#include <linux/if_ether.h>
 #include "utils.h"
 #include "rt_names.h"
 #include "tc_util.h"
@@ -22,6 +23,8 @@ static void explain(void)
 {
 	fprintf(stderr, "Usage: vlan pop\n");
 	fprintf(stderr, "       vlan push [ protocol VLANPROTO ] id VLANID\n");
+	fprintf(stderr, "       VLANPROTO is one of 802.1Q or 802.1ad\n");
+	fprintf(stderr, "            with default: 802.1Q\n");
 }
 
 static void usage(void)
@@ -121,7 +124,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p,
 		if (matches(*argv, "index") == 0) {
 			NEXT_ARG();
 			if (get_u32(&parm.index, *argv, 10)) {
-				fprintf(stderr, "Pedit: Illegal \"index\"\n");
+				fprintf(stderr, "vlan: Illegal \"index\"\n");
 				return -1;
 			}
 			argc--;
@@ -141,8 +144,15 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p,
 	addattr_l(n, MAX_MSG, TCA_VLAN_PARMS, &parm, sizeof(parm));
 	if (id_set)
 		addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_ID, &id, 2);
-	if (proto_set)
+	if (proto_set) {
+		if (proto != ETH_P_8021Q && proto != ETH_P_8021AD) {
+			fprintf(stderr, "protocol id 0x%x not supported\n", proto);
+			explain();
+			return -1;
+		}
+
 		addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_PROTOCOL, &proto, 2);
+	}
 	tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
 
 	*argc_p = argc;

^ permalink raw reply related

* Re: [Patch net-next] net: remove netif_set_real_num_rx_queues()
From: Edward Cree @ 2014-11-11 13:10 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, Eric Dumazet, David S. Miller
In-Reply-To: <1415648136-4167-1-git-send-email-xiyou.wangcong@gmail.com>

On 10/11/14 19:35, Cong Wang wrote:
> vlan was the only user of netif_set_real_num_rx_queues(),
> but it no longer calls it after
> commit 4af429d29b341bb1735f04c2fb960178 ("vlan: lockless transmit path").
> So we can just remove it.
>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>
> ---
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 888d551..4a6f770 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2762,23 +2762,6 @@ static inline int netif_set_real_num_rx_queues(struct net_device *dev,
>  }
>  #endif
>  
> -static inline int netif_copy_real_num_queues(struct net_device *to_dev,
> -					     const struct net_device *from_dev)
Patch title says you're removing _set_ but body only removes _copy_. 
Which one is right?
> -{
> -	int err;
> -
> -	err = netif_set_real_num_tx_queues(to_dev,
> -					   from_dev->real_num_tx_queues);
> -	if (err)
> -		return err;
> -#ifdef CONFIG_SYSFS
> -	return netif_set_real_num_rx_queues(to_dev,
> -					    from_dev->real_num_rx_queues);
> -#else
> -	return 0;
> -#endif
> -}
> -
>  #ifdef CONFIG_SYSFS
>  static inline unsigned int get_netdev_rx_queue_index(
>  		struct netdev_rx_queue *queue)
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [patch net-next 1/2] net: move vlan pop/push functions into common code
From: Eric Dumazet @ 2014-11-11 13:06 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, jhs, pshelar, therbert, edumazet, willemb,
	dborkman, mst, fw, Paul.Durrant, tgraf
In-Reply-To: <1415700789-9171-1-git-send-email-jiri@resnulli.us>

On Tue, 2014-11-11 at 11:13 +0100, Jiri Pirko wrote:
> So it can be used from out of openvswitch code.
> Did couple of cosmetic changes on the way, namely variable naming and
> adding support for 8021AD proto.
> 
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
>  include/linux/skbuff.h    |  2 ++
>  net/core/skbuff.c         | 86 +++++++++++++++++++++++++++++++++++++++++++++++
>  net/openvswitch/actions.c | 76 ++---------------------------------------
>  3 files changed, 90 insertions(+), 74 deletions(-)
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 103fbe8..3b0445c 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -2673,6 +2673,8 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet);
>  unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
>  struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
>  struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
> +int skb_vlan_pop(struct sk_buff *skb);
> +int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
>  
>  struct skb_checksum_ops {
>  	__wsum (*update)(const void *mem, int len, __wsum wsum);
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 7001896..75e53d4 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4151,6 +4151,92 @@ err_free:
>  }
>  EXPORT_SYMBOL(skb_vlan_untag);
>  
> +/* remove VLAN header from packet and update csum accordingly. */
> +static int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci)
> +{
> +	struct vlan_hdr *vhdr;
> +	int err;
> +



> +	if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
> +		return -ENOMEM;
> +
> +	if (!skb_cloned(skb) || skb_clone_writable(skb, VLAN_ETH_HLEN))
> +		return 0;
> +
> +	err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
> +	if (unlikely(err))
> +		return err;

All this should be a function of its own (OVS calls this
make_writable()).

Its too bad netfilter has a different skb_make_writable()


> +
> +	if (skb->ip_summed == CHECKSUM_COMPLETE)
> +		skb->csum = csum_sub(skb->csum, csum_partial(skb->data
> +					+ (2 * ETH_ALEN), VLAN_HLEN, 0));

This looks like skb_postpull_rcsum()

BTW, calling csum_partial() for 4 bytes is quite expensive.

^ permalink raw reply

* Re: [patch iproute2] tc: add support for vlan tc action
From: Jamal Hadi Salim @ 2014-11-11 12:35 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, pshelar, therbert, edumazet, willemb, dborkman, mst, fw,
	Paul.Durrant, tgraf
In-Reply-To: <1415700966-9225-1-git-send-email-jiri@resnulli.us>

On 11/11/14 05:16, Jiri Pirko wrote:
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Looks good.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply

* Re: [patch net-next 2/2] sched: introduce vlan action
From: Jamal Hadi Salim @ 2014-11-11 12:34 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, pshelar, therbert, edumazet, willemb, dborkman, mst, fw,
	Paul.Durrant, tgraf
In-Reply-To: <1415700789-9171-2-git-send-email-jiri@resnulli.us>

On 11/11/14 05:13, Jiri Pirko wrote:
> This tc action allows to work with vlan tagged skbs. Two supported
> sub-actions are header pop and header push.
>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Looks good. I am going to test it - but dont see any obvious issues I
from inspection; willing to say:

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply

* Re: 802.3x pause frames
From: Ben Hutchings @ 2014-11-11 12:29 UTC (permalink / raw)
  To: Julia Niewiejska; +Cc: netdev
In-Reply-To: <545B70C9.7090702@fkie.fraunhofer.de>

[-- Attachment #1: Type: text/plain, Size: 1940 bytes --]

On Thu, 2014-11-06 at 13:59 +0100, Julia Niewiejska wrote:
> Hello,
> 
> I indend to do some experiments with 802.3x pause frames, but I have yet 
> to find a setup that works. I used a tool that generates pause frames 
> [1] in two setups. First one consists of two virtual machines on a 
> VMWare ESXi 5.5 server connected with each other through a virtual 
> switch. In second setup two physical machines (Desktop PCs) were 
> connected directly by an ethernet cable. The VMs are running Debian 
> Wheezy 32bit while Debian Testing (Jessie) 64bit is installed on both 
> desktop PCs. Below you will find some information on the ethernet 
> adapters and drivers used in the VM [2], the desktop PC with the more up 
> to date hardware [3] and the older machine [4]. I used the following 
> command to activate flow control:
> 
> ethtool -A <eth> autoneg off rx on tx on
> 
> First of all I noticed some discrepancies between the output of 
> mii-tools or ethtool -a and the attempt to change the flow control 
> settings with the command above. Only the Realtek adapter actually 
> output that it didn't support the operation, the other adapters accepted 
> the settings without any error message.
> 
> In both setups pause frames were generated on one machine while a ping 
> was sent simultaneously, as suggested in [1]. While the VM connection 
> was set to 1 Gbps the whole time, I also tested a 10 Mbps setting on the 
> physical connection. Even though the pause frames were always visible in 
> tcpdump at the receiver, I didn't notice any influence whatsoever in the 
> ping results.
[...]

MACs that implement flow control will not pass pause frames to the host;
therefore these MACs do not implement flow control.

Ben.

-- 
Ben Hutchings
Experience is directly proportional to the value of equipment destroyed.
                                                         - Carolyn Scheppner

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply

* Re: [PATCH net] net: sctp: fix memory leak in auth key management
From: Neil Horman @ 2014-11-11 12:06 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, linux-sctp, netdev, Vlad Yasevich
In-Reply-To: <1415638809-20288-1-git-send-email-dborkman@redhat.com>

On Mon, Nov 10, 2014 at 06:00:09PM +0100, Daniel Borkmann wrote:
> A very minimal and simple user space application allocating an SCTP
> socket, setting SCTP_AUTH_KEY setsockopt(2) on it and then closing
> the socket again will leak the memory containing the authentication
> key from user space:
> 
> unreferenced object 0xffff8800837047c0 (size 16):
>   comm "a.out", pid 2789, jiffies 4296954322 (age 192.258s)
>   hex dump (first 16 bytes):
>     01 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace:
>     [<ffffffff816d7e8e>] kmemleak_alloc+0x4e/0xb0
>     [<ffffffff811c88d8>] __kmalloc+0xe8/0x270
>     [<ffffffffa0870c23>] sctp_auth_create_key+0x23/0x50 [sctp]
>     [<ffffffffa08718b1>] sctp_auth_set_key+0xa1/0x140 [sctp]
>     [<ffffffffa086b383>] sctp_setsockopt+0xd03/0x1180 [sctp]
>     [<ffffffff815bfd94>] sock_common_setsockopt+0x14/0x20
>     [<ffffffff815beb61>] SyS_setsockopt+0x71/0xd0
>     [<ffffffff816e58a9>] system_call_fastpath+0x12/0x17
>     [<ffffffffffffffff>] 0xffffffffffffffff
> 
> This is bad because of two things, we can bring down a machine from
> user space when auth_enable=1, but also we would leave security sensitive
> keying material in memory without clearing it after use. The issue is
> that sctp_auth_create_key() already sets the refcount to 1, but after
> allocation sctp_auth_set_key() does an additional refcount on it, and
> thus leaving it around when we free the socket.
> 
> Fixes: 65b07e5d0d0 ("[SCTP]: API updates to suport SCTP-AUTH extensions.")
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> Cc: Vlad Yasevich <vyasevich@gmail.com>
> ---
>  net/sctp/auth.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/net/sctp/auth.c b/net/sctp/auth.c
> index 0e85291..fb7976a 100644
> --- a/net/sctp/auth.c
> +++ b/net/sctp/auth.c
> @@ -862,8 +862,6 @@ int sctp_auth_set_key(struct sctp_endpoint *ep,
>  		list_add(&cur_key->key_list, sh_keys);
>  
>  	cur_key->key = key;
> -	sctp_auth_key_hold(key);
> -
>  	return 0;
>  nomem:
>  	if (!replace)
> -- 
> 1.7.11.7
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply

* Re: [PATCH net] net: sctp: fix NULL pointer dereference in af->from_addr_param on malformed packet
From: Neil Horman @ 2014-11-11 12:05 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, linux-sctp, netdev, Vlad Yasevich
In-Reply-To: <1415638466-20176-1-git-send-email-dborkman@redhat.com>

On Mon, Nov 10, 2014 at 05:54:26PM +0100, Daniel Borkmann wrote:
> An SCTP server doing ASCONF will panic on malformed INIT ping-of-death
> in the form of:
> 
>   ------------ INIT[PARAM: SET_PRIMARY_IP] ------------>
> 
> While the INIT chunk parameter verification dissects through many things
> in order to detect malformed input, it misses to actually check parameters
> inside of parameters. E.g. RFC5061, section 4.2.4 proposes a 'set primary
> IP address' parameter in ASCONF, which has as a subparameter an address
> parameter.
> 
> So an attacker may send a parameter type other than SCTP_PARAM_IPV4_ADDRESS
> or SCTP_PARAM_IPV6_ADDRESS, param_type2af() will subsequently return 0
> and thus sctp_get_af_specific() returns NULL, too, which we then happily
> dereference unconditionally through af->from_addr_param().
> 
> The trace for the log:
> 
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000078
> IP: [<ffffffffa01e9c62>] sctp_process_init+0x492/0x990 [sctp]
> PGD 0
> Oops: 0000 [#1] SMP
> [...]
> Pid: 0, comm: swapper Not tainted 2.6.32-504.el6.x86_64 #1 Bochs Bochs
> RIP: 0010:[<ffffffffa01e9c62>]  [<ffffffffa01e9c62>] sctp_process_init+0x492/0x990 [sctp]
> [...]
> Call Trace:
>  <IRQ>
>  [<ffffffffa01f2add>] ? sctp_bind_addr_copy+0x5d/0xe0 [sctp]
>  [<ffffffffa01e1fcb>] sctp_sf_do_5_1B_init+0x21b/0x340 [sctp]
>  [<ffffffffa01e3751>] sctp_do_sm+0x71/0x1210 [sctp]
>  [<ffffffffa01e5c09>] ? sctp_endpoint_lookup_assoc+0xc9/0xf0 [sctp]
>  [<ffffffffa01e61f6>] sctp_endpoint_bh_rcv+0x116/0x230 [sctp]
>  [<ffffffffa01ee986>] sctp_inq_push+0x56/0x80 [sctp]
>  [<ffffffffa01fcc42>] sctp_rcv+0x982/0xa10 [sctp]
>  [<ffffffffa01d5123>] ? ipt_local_in_hook+0x23/0x28 [iptable_filter]
>  [<ffffffff8148bdc9>] ? nf_iterate+0x69/0xb0
>  [<ffffffff81496d10>] ? ip_local_deliver_finish+0x0/0x2d0
>  [<ffffffff8148bf86>] ? nf_hook_slow+0x76/0x120
>  [<ffffffff81496d10>] ? ip_local_deliver_finish+0x0/0x2d0
> [...]
> 
> A minimal way to address this is to check for NULL as we do on all
> other such occasions where we know sctp_get_af_specific() could
> possibly return with NULL.
> 
> Fixes: d6de3097592b ("[SCTP]: Add the handling of "Set Primary IP Address" parameter to INIT")
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> Cc: Vlad Yasevich <vyasevich@gmail.com>
> ---
>  net/sctp/sm_make_chunk.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index ab734be..9f32741 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -2609,6 +2609,9 @@ do_addr_param:
>  		addr_param = param.v + sizeof(sctp_addip_param_t);
>  
>  		af = sctp_get_af_specific(param_type2af(param.p->type));
> +		if (af == NULL)
> +			break;
> +
>  		af->from_addr_param(&addr, addr_param,
>  				    htons(asoc->peer.port), 0);
>  
> -- 
> 1.7.11.7
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply

* Re: [PATCH] smsc911x: power-up phydev before doing a software reset.
From: Javier Martinez Canillas @ 2014-11-11 11:20 UTC (permalink / raw)
  To: Enric Balletbo i Serra; +Cc: netdev, Steve Glendinning, Enrico Butera
In-Reply-To: <1415643789-5367-1-git-send-email-eballetbo@iseebcn.com>

Hello Enric,

On Mon, Nov 10, 2014 at 7:23 PM, Enric Balletbo i Serra
<eballetbo@iseebcn.com> wrote:
> With commit be9dad1f9f26604fb ("net: phy: suspend phydev when going
> to HALTED"), the PHY device will be put in a low-power mode using
> BMCR_PDOWN if the the interface is set down. The smsc911x driver does
> a software_reset opening the device driver (ndo_open). In such case,
> the PHY must be powered-up before access to any register and before
> calling the software_reset function. Otherwise, as the PHY is powered
> down the software reset fails and the interface can not be enabled
> again.
>

The patch looks good to me, I just have a small comment.

> +
> +       /* If the PHY general power-down bit is not set is not necessary to
> +        * disable the general power down-mode.
> +        */
> +       if (rc & BMCR_PDOWN) {
> +               rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN);
> +               if (rc < 0) {
> +                       SMSC_WARN(pdata, drv, "Failed writing PHY control reg");
> +                       return rc;
> +               }
> +
> +               mdelay(1);

According to Documentation/timers/timers-howto.txt, the *delay()
family of functions should only be used in atomic context since those
are implemented as a busy-wait loop to achieve the desired delay.

AFAICT smsc911x_soft_reset() is only called from process context so
usleep_range() should be used instead.

Best regards,
Javier

^ permalink raw reply

* Re: [PATCH] brcmfmac: unlink URB when request timed out
From: Arend van Spriel @ 2014-11-11 11:05 UTC (permalink / raw)
  To: Mathy Vanhoef, brudley, frankyl, meuleman, linville, pieterpg,
	linux-wireless, brcm80211-dev-list, netdev, Oliver Neukum
In-Reply-To: <5460E2FA.40201@gmail.com>

On 10-11-14 17:08, Mathy Vanhoef wrote:
> On 11/10/2014 06:18 AM, Arend van Spriel wrote:
>> On 09-11-14 19:10, Mathy Vanhoef wrote:
>>> From: Mathy Vanhoef <vanhoefm@gmail.com>
>>>
>>> Unlink the submitted URB in brcmf_usb_dl_cmd if the request timed out. This
>>> assures the URB is never submitted twice, preventing a driver crash.
>>
>> Hi Mathy,
>>
>> What driver crash are you referring to? The log only shows the WARNING
>> ending in a USB disconnect but no actual crash. Does your patch get the
>> driver running properly or does it only avoid the warning.
> 
> Hi Arend,
> 
> It shows a warning, after which the device doesn't work (but the computer is
> still usable). But I've noticed that when *unplugging* the USB cable the OS may
> freeze. This doesn't always happen though, sometimes unplugging works OK. The
> patch both avoids the warning, and gets the device/driver running properly
> (unplugging also works OK).
> 
>>
>> With that said, it seems there is some need for improvement, but I also
>> notice you are running this on a virtual machine so could that affect
>> the timeout to kick in before completion. Could you try to increase the
>> timeout. Still when a timeout occurs this needs to be handled properly.
>> Could you also try the following patch?
> 
> I did a few additional tests:
> 
> 1. When increasing IOCTL_RESP_TIMEOUT to 20000 (ten times the normal value) the
>    timeout and warning still occur. Device/driver doesn't work.
> 2. When increasing BRCMF_USB_RESET_GETVER_SPINWAIT to 1000 (ten timers the
>    normal value) everything works. Device/driver works.

This means the ctl_urb completes on your system within 3sec, but not
within 2.1sec. After discussing this with my colleague, we think you
should use usb_kill_urb() instead of usb_unlink_urb() as it assures the
completion handler is called. Could you retest that and let us know.

Regards,
Arend

> 3. Quick test using backports-3.18-rc1-1 (aka unpatched driver) on a non-
>    virtualized Linux install: In that case everything worked fine. So the bug
>    may only be triggered in a virtualized environment / VMWare.
> 4. When applying your patch, the driver stops early during initialization of
>    the device. I included a WARN_ONCE before returning EINVAL and got the
>    output below.
> 
> Kind regards,
> Mathy
> ---
> [  220.955647] usb 1-1: new high-speed USB device number 3 using ehci-pci
> [  221.487797] usb 1-1: New USB device found, idVendor=043e, idProduct=3004
> [  221.487802] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [  221.487804] usb 1-1: Product: Remote Download Wireless Adapter
> [  221.487806] usb 1-1: Manufacturer: Broadcom
> [  221.487808] usb 1-1: SerialNumber: 000000000001
> [  221.490472] brcmfmac: brcmf_usb_probe Enter 0x043e:0x3004
> [  221.490476] brcmfmac: brcmf_usb_probe Broadcom high speed USB WLAN interface detected
> [  221.490477] brcmfmac: brcmf_usb_probe_cb Enter
> [  221.490480] brcmfmac: brcmf_usb_attach Enter
> [  221.490494] brcmfmac: brcmf_usb_dlneeded Enter
> [  221.490495] ------------[ cut here ]------------
> [  221.490503] WARNING: CPU: 0 PID: 100 at drivers/net/wireless/brcm80211/brcmfmac/usb.c:716 brcmf_usb_dl_cmd+0x75/0x1a0 [brcmfmac]()
> [  221.490505] EINVAL devinfo=c0044000 ctl_rub=ef898380 completed=0
> [  221.490506] Modules linked in: brcmfmac brcmutil vmw_pvscsi pcnet32 mptspi mptscsih mptbase
> [  221.490514] CPU: 0 PID: 100 Comm: kworker/0:1 Not tainted 3.18.0-rc3-wl+ #2
> [  221.490515] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013
> [  221.490528] Workqueue: usb_hub_wq hub_event
> [  221.490530]  00000000 00000000 eecffb58 c1711f4a eecffb98 eecffb88 c103edaf f11cbc58
> [  221.490534]  eecffbb4 00000064 f11cbc84 000002cc f11c1595 f11c1595 c0044000 ffffffea
> [  221.490537]  ef726000 eecffba0 c103ee4e 00000009 eecffb98 f11cbc58 eecffbb4 eecffbd0
> [  221.490541] Call Trace:
> [  221.490550]  [<c1711f4a>] dump_stack+0x41/0x52
> [  221.490558]  [<c103edaf>] warn_slowpath_common+0x7f/0xa0
> [  221.490563]  [<f11c1595>] ? brcmf_usb_dl_cmd+0x75/0x1a0 [brcmfmac]
> [  221.490567]  [<f11c1595>] ? brcmf_usb_dl_cmd+0x75/0x1a0 [brcmfmac]
> [  221.490570]  [<c103ee4e>] warn_slowpath_fmt+0x2e/0x30
> [  221.490575]  [<f11c1595>] brcmf_usb_dl_cmd+0x75/0x1a0 [brcmfmac]
> [  221.490580]  [<f11c2cd8>] brcmf_usb_probe+0x3c8/0x640 [brcmfmac]
> [  221.490583]  [<c1717d53>] ? mutex_lock+0x13/0x32
> [  221.490586]  [<c1493ae3>] usb_probe_interface+0xa3/0x180
> [  221.490590]  [<c13f5690>] ? __driver_attach+0x90/0x90
> [  221.490592]  [<c13f546e>] driver_probe_device+0x5e/0x1f0
> [  221.490595]  [<c13f5690>] ? __driver_attach+0x90/0x90
> [  221.490597]  [<c13f56c9>] __device_attach+0x39/0x50
> [  221.490600]  [<c13f3d84>] bus_for_each_drv+0x34/0x70
> [  221.490602]  [<c13f53db>] device_attach+0x7b/0x90
> [  221.490604]  [<c13f5690>] ? __driver_attach+0x90/0x90
> [  221.490607]  [<c13f4b8f>] bus_probe_device+0x6f/0x90
> [  221.490609]  [<c13f3256>] device_add+0x426/0x520
> [  221.490611]  [<c1491503>] ? usb_control_msg+0xb3/0xd0
> [  221.490614]  [<c1717d53>] ? mutex_lock+0x13/0x32
> [  221.490627]  [<c14922f8>] usb_set_configuration+0x3f8/0x700
> [  221.490630]  [<c13f5690>] ? __driver_attach+0x90/0x90
> [  221.490633]  [<c149ac7b>] generic_probe+0x2b/0x90
> [  221.490637]  [<c1188bc0>] ? sysfs_create_link+0x20/0x40
> [  221.490639]  [<c1492bec>] usb_probe_device+0xc/0x10
> [  221.490641]  [<c13f546e>] driver_probe_device+0x5e/0x1f0
> [  221.490644]  [<c13f5690>] ? __driver_attach+0x90/0x90
> [  221.490646]  [<c13f56c9>] __device_attach+0x39/0x50
> [  221.490649]  [<c13f3d84>] bus_for_each_drv+0x34/0x70
> [  221.490651]  [<c13f53db>] device_attach+0x7b/0x90
> [  221.490653]  [<c13f5690>] ? __driver_attach+0x90/0x90
> [  221.490656]  [<c13f4b8f>] bus_probe_device+0x6f/0x90
> [  221.490658]  [<c13f3256>] device_add+0x426/0x520
> [  221.490661]  [<c148aa2e>] ? usb_new_device+0x16e/0x3a0
> [  221.490663]  [<c148aad7>] usb_new_device+0x217/0x3a0
> [  221.490666]  [<c148bff7>] hub_event+0xa17/0xda0
> [  221.490668]  [<c1716918>] ? __schedule+0x2f8/0x710
> [  221.490672]  [<c105127c>] ? pwq_dec_nr_in_flight+0x3c/0x90
> [  221.490674]  [<c10513ee>] process_one_work+0x11e/0x360
> [  221.490677]  [<c1051750>] worker_thread+0xf0/0x3c0
> [  221.490680]  [<c106e14a>] ? __wake_up_locked+0x1a/0x20
> [  221.490682]  [<c1051660>] ? process_scheduled_works+0x30/0x30
> [  221.490685]  [<c1055b56>] kthread+0x96/0xb0
> [  221.490687]  [<c1050000>] ? put_unbound_pool+0x110/0x170
> [  221.490691]  [<c1719c81>] ret_from_kernel_thread+0x21/0x30
> [  221.490693]  [<c1055ac0>] ? kthread_worker_fn+0x110/0x110
> [  221.490695] ---[ end trace 9befd914693f3083 ]---
> [  221.490697] brcmfmac: brcmf_usb_dlneeded chip 57005 rev 0xf11cfcec
> [  221.490699] brcmfmac: brcmf_fw_get_firmwares enter: dev=1-1
> 
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
> index 5265aa7..15b1aa7 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
> @@ -709,8 +709,13 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd,
>  	char *tmpbuf;
>  	u16 size;
>  
> -	if ((!devinfo) || (devinfo->ctl_urb == NULL))
> +	if (!devinfo || !devinfo->ctl_urb || !devinfo->ctl_completed) {
> +		WARN_ONCE(1, "EINVAL devinfo=%p ctl_rub=%p completed=%d\n",
> +			devinfo,
> +			devinfo ? devinfo->ctl_urb : NULL,
> +			devinfo ? devinfo->ctl_completed : -1);
>  		return -EINVAL;
> +	}
>  
>  	tmpbuf = kmalloc(buflen, GFP_ATOMIC);
>  	if (!tmpbuf)
> 
> 
>>
>> Regards,
>> Arend
>> ---
>>  drivers/net/wireless/brcm80211/brcmfmac/usb.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
>> b/drivers/net/wireles
>> index dc13591..786c40b 100644
>> --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
>> +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
>> @@ -640,7 +640,7 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info
>> *devinf
>>         char *tmpbuf;
>>         u16 size;
>>
>> -       if ((!devinfo) || (devinfo->ctl_urb == NULL))
>> +       if (!devinfo || !devinfo->ctl_urb || !devinfo->ctl_completed)
>>                 return -EINVAL;
>>
>>         tmpbuf = kmalloc(buflen, GFP_ATOMIC);
>>
>>> Signed-off-by: Mathy Vanhoef <vanhoefm@gmail.com>
>>> ---
>>> Currently brcmfmac may crash when a USB device is attached (tested with a LG
>>> TWFM-B003D). In particular it fails on the second call to brcmf_usb_dl_cmd in
>>> the while loop of brcmf_usb_resetcfg. The problem is that an URB is being
>>> submitted twice:
>>>
>>> [  169.861800] brcmfmac: brcmf_usb_dl_writeimage Enter, fw f14db000, len 348160
>>> [  171.787791] brcmfmac: brcmf_usb_dl_writeimage Exit, err=0
>>> [  171.787797] brcmfmac: brcmf_usb_dlstart Exit, err=0
>>> [  171.787799] brcmfmac: brcmf_usb_dlrun Enter
>>> [  171.791794] brcmfmac: brcmf_usb_resetcfg Enter
>>> [  173.988072] ------------[ cut here ]------------
>>> [  173.988083] WARNING: CPU: 0 PID: 369 at drivers/usb/core/urb.c:339 usb_submit_urb+0x4e6/0x500()
>>> [  173.988085] URB eaf45f00 submitted while active
>>> [  173.988086] Modules linked in: brcmfmac brcmutil vmw_pvscsi pcnet32 mptspi mptscsih mptbase
>>> [  173.988100] CPU: 0 PID: 369 Comm: kworker/0:2 Not tainted 3.18.0-rc3-wl #1
>>> [  173.988102] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013
>>> [  173.988106] Workqueue: events request_firmware_work_func
>>> [  173.988108]  00000000 00000000 ee747db8 c1711f4a ee747df8 ee747de8 c103edaf c18d1e10
>>> [  173.988112]  ee747e14 00000171 c18a8b29 00000153 c1490556 c1490556 eaf45f00 eafdc660
>>> [  173.988115]  f14b8fa0 ee747e00 c103ee4e 00000009 ee747df8 c18d1e10 ee747e14 ee747e50
>>> [  173.988119] Call Trace:
>>> [  173.988129]  [<c1711f4a>] dump_stack+0x41/0x52
>>> [  173.988136]  [<c103edaf>] warn_slowpath_common+0x7f/0xa0
>>> [  173.988139]  [<c1490556>] ? usb_submit_urb+0x4e6/0x500
>>> [  173.988141]  [<c1490556>] ? usb_submit_urb+0x4e6/0x500
>>> [  173.988147]  [<f14b8fa0>] ? brcmf_usb_ioctl_resp_wake+0x40/0x40 [brcmfmac]
>>> [  173.988150]  [<c103ee4e>] warn_slowpath_fmt+0x2e/0x30
>>> [  173.988152]  [<c1490556>] usb_submit_urb+0x4e6/0x500
>>> [  173.988156]  [<c1123de1>] ? __kmalloc+0x21/0x140
>>> [  173.988161]  [<f14b91c3>] ? brcmf_usb_dl_cmd+0x33/0x120 [brcmfmac]
>>> [  173.988166]  [<f14b9243>] brcmf_usb_dl_cmd+0xb3/0x120 [brcmfmac]
>>> [  173.988170]  [<f14ba6c4>] brcmf_usb_probe_phase2+0x4e4/0x640 [brcmfmac]
>>> [  173.988176]  [<f14b4900>] brcmf_fw_request_code_done+0xd0/0xf0 [brcmfmac]
>>> [  173.988178]  [<c1400876>] request_firmware_work_func+0x26/0x50
>>> [  173.988182]  [<c10513ee>] process_one_work+0x11e/0x360
>>> [  173.988184]  [<c1051750>] worker_thread+0xf0/0x3c0
>>> [  173.988205]  [<c106e14a>] ? __wake_up_locked+0x1a/0x20
>>> [  173.988208]  [<c1051660>] ? process_scheduled_works+0x30/0x30
>>> [  173.988211]  [<c1055b56>] kthread+0x96/0xb0
>>> [  173.988214]  [<c1719c81>] ret_from_kernel_thread+0x21/0x30
>>> [  173.988217]  [<c1055ac0>] ? kthread_worker_fn+0x110/0x110
>>> [  173.988219] ---[ end trace 0c88bf46801de083 ]---
>>> [  173.988221] brcmf_usb_dl_cmd: usb_submit_urb failed -16
>>> [  173.988396] brcmfmac: brcmf_usb_probe_phase2 failed: dev=1-1, err=-19
>>> [  173.989503] brcmfmac: brcmf_usb_disconnect Enter
>>>
>>> This patch fixes the brcmf_usb_dl_cmd function to prevent an URB from being
>>> submitted twice. Tested using a LG TWFM-B003D, which now works properly.
>>>
>>>
>>>  drivers/net/wireless/brcm80211/brcmfmac/usb.c |    6 ++++--
>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
>>> index 5265aa7..1bc7858 100644
>>> --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
>>> +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
>>> @@ -738,10 +738,12 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd,
>>>  		goto finalize;
>>>  	}
>>>  
>>> -	if (!brcmf_usb_ioctl_resp_wait(devinfo))
>>> +	if (!brcmf_usb_ioctl_resp_wait(devinfo)) {
>>> +		usb_unlink_urb(devinfo->ctl_urb);
>>>  		ret = -ETIMEDOUT;
>>> -	else
>>> +	} else {
>>>  		memcpy(buffer, tmpbuf, buflen);
>>> +	}
>>>  
>>>  finalize:
>>>  	kfree(tmpbuf);
>>>
>>

^ permalink raw reply

* Re: [PATCH 1/1] linux-wireless: Added psk in struct cfg80211_connect_params needed for offloading 4way handshake to driver
From: Arend van Spriel @ 2014-11-11 10:44 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Gautam (Gautam Kumar) Shukla, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org, davem@davemloft.net,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, Jithu Jance, Sreenath S,
	Vladimir Kondratiev
In-Reply-To: <1415702338.2163.5.camel@sipsolutions.net>

On 11-11-14 11:38, Johannes Berg wrote:
> On Tue, 2014-11-11 at 11:35 +0100, Arend van Spriel wrote:
> 
>> What did pop up is the wiphy flags vs. nl80211 feature flags. When that
>> comes up it looks like 'potAtoes, potaetoes' to me.
>>
>> So is there are clear design rule for when to use which flag. For me the
>> wiphy object represents the device/firmware and 4-way handshake offload
>> support is determined by what the device/firmware supports.
> 
> There are three types of flags:
> 
>  * wiphy flag attributes - deprecated as far as I'm concerned

Ok. deprecated is clear enough ;-)

>  * wiphy nl80211 feature flags - much easier to use in kernel (and
> userspace)
>  * nl80211 protocol flags - only one exists
>                             (NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP)

Thanks,
Arend

^ permalink raw reply

* Re: [PATCH 1/1] linux-wireless: Added psk in struct cfg80211_connect_params needed for offloading 4way handshake to driver
From: Johannes Berg @ 2014-11-11 10:38 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Gautam (Gautam Kumar) Shukla, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org, davem@davemloft.net,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, Jithu Jance, Sreenath S,
	Vladimir Kondratiev
In-Reply-To: <5461E67E.7010408@broadcom.com>

On Tue, 2014-11-11 at 11:35 +0100, Arend van Spriel wrote:

> What did pop up is the wiphy flags vs. nl80211 feature flags. When that
> comes up it looks like 'potAtoes, potaetoes' to me.
> 
> So is there are clear design rule for when to use which flag. For me the
> wiphy object represents the device/firmware and 4-way handshake offload
> support is determined by what the device/firmware supports.

There are three types of flags:

 * wiphy flag attributes - deprecated as far as I'm concerned
 * wiphy nl80211 feature flags - much easier to use in kernel (and
userspace)
 * nl80211 protocol flags - only one exists
                            (NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP)

johannes

^ permalink raw reply

* Re: [PATCH 1/1] linux-wireless: Added psk in struct cfg80211_connect_params needed for offloading 4way handshake to driver
From: Arend van Spriel @ 2014-11-11 10:35 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Gautam (Gautam Kumar) Shukla,
	linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jithu Jance,
	Sreenath S, Vladimir Kondratiev
In-Reply-To: <1415700220.2163.3.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>

On 11-11-14 11:03, Johannes Berg wrote:
> On Tue, 2014-11-11 at 10:54 +0100, Arend van Spriel wrote:
> 
>>> Also, there's a competing approach from QCA that's far more suited.
>>
>> I probably was not paying attention to it, but would you have a
>> reference to this.
> 
> ... digs around in email ...
> 
> http://mid.gmane.org/1343907187-6686-1-git-send-email-qca_vkondrat-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org
> 
> Anyway, looking back at that, it wasn't really all that different, just
> a bit more complete maybe.

Read through the whole thread. It seems some comments from you needed to
be addressed and Vladimir wanted to evaluate it. So that was the end of
the thread.

What did pop up is the wiphy flags vs. nl80211 feature flags. When that
comes up it looks like 'potAtoes, potaetoes' to me.

So is there are clear design rule for when to use which flag. For me the
wiphy object represents the device/firmware and 4-way handshake offload
support is determined by what the device/firmware supports.

Regards,
Arend

> johannes
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

^ permalink raw reply

* RE: [PATCH 1/1] linux-wireless: Added psk in struct cfg80211_connect_params needed for offloading 4way handshake to driver
From: Gautam (Gautam Kumar) Shukla @ 2014-11-11 10:33 UTC (permalink / raw)
  To: Arend Van Spriel, Johannes Berg
  Cc: linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jithu Jance,
	Sreenath S
In-Reply-To: <5461DCC9.5050702-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>

Thanks a lot  Johannes and Arend , for your comments and review .
It will really help me in my next patch submission .

Just wanted to know when QCA patch will get in main line as it was  last updated on  23 aug 2012.


Thanks and regards

-----Original Message-----
From: Arend van Spriel [mailto:arend@broadcom.com] 
Sent: Tuesday, November 11, 2014 3:24 PM
To: Johannes Berg; Gautam (Gautam Kumar) Shukla
Cc: linville@tuxdriver.com; linux-wireless@vger.kernel.org; davem@davemloft.net; linux-api@vger.kernel.org; linux-kernel@vger.kernel.org; netdev@vger.kernel.org; Jithu Jance; Sreenath S
Subject: Re: [PATCH 1/1] linux-wireless: Added psk in struct cfg80211_connect_params needed for offloading 4way handshake to driver

On 11-11-14 10:29, Johannes Berg wrote:
> On Tue, 2014-11-11 at 05:56 +0000, Gautam (Gautam Kumar) Shukla wrote:
>> For offloading 4 way handshake to driver, currently we don't have any 
>> member  of struct cfg80211_connect_params to pass PSK from supplicant 
>> to driver. I have added psk for the same and added rest of the code 
>> needed in nl80211.h and nl80211.c to parse and make it available to 
>> driver.
>> From supplicant, we already have psk member field in assoc_params to 
>> use .
>>
>> Tested on x86 linux.
> 
> Your commit message needs serious work.
> 
> Also, there's a competing approach from QCA that's far more suited.

I probably was not paying attention to it, but would you have a reference to this.

> In either case though, I'm going to ask which driver is going to use 
> this and when it's going to land in mainline.

I had the same question ;-)

> johannes
> 
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-wireless" in the body of a message to majordomo@vger.kernel.org 
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply

* Re: [PATCH net] ipv6: fix IPV6_PKTINFO with v4 mapped
From: Hannes Frederic Sowa @ 2014-11-11 10:32 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev
In-Reply-To: <1415670865.9613.24.camel@edumazet-glaptop2.roam.corp.google.com>

On Tue, Nov 11, 2014, at 02:54, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> Use IS_ENABLED(CONFIG_IPV6), to enable this code if IPv6 is
> a module.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Fixes: c8e6ad0829a7 ("ipv6: honor IPV6_PKTINFO with v4 mapped addresses
> on sendmsg")

Oops, thanks for fixing.

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

^ permalink raw reply

* [patch iproute2] tc: add support for vlan tc action
From: Jiri Pirko @ 2014-11-11 10:16 UTC (permalink / raw)
  To: netdev
  Cc: davem, jhs, pshelar, therbert, edumazet, willemb, dborkman, mst,
	fw, Paul.Durrant, tgraf
In-Reply-To: <reply-to=1415700789-9171-2-git-send-email-jiri@resnulli.us>

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 include/linux/tc_act/tc_vlan.h |  35 +++++++
 tc/Makefile                    |   1 +
 tc/m_vlan.c                    | 205 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 241 insertions(+)
 create mode 100644 include/linux/tc_act/tc_vlan.h
 create mode 100644 tc/m_vlan.c

diff --git a/include/linux/tc_act/tc_vlan.h b/include/linux/tc_act/tc_vlan.h
new file mode 100644
index 0000000..f7b8d44
--- /dev/null
+++ b/include/linux/tc_act/tc_vlan.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __LINUX_TC_VLAN_H
+#define __LINUX_TC_VLAN_H
+
+#include <linux/pkt_cls.h>
+
+#define TCA_ACT_VLAN 12
+
+#define TCA_VLAN_ACT_POP	1
+#define TCA_VLAN_ACT_PUSH	2
+
+struct tc_vlan {
+	tc_gen;
+	int v_action;
+};
+
+enum {
+	TCA_VLAN_UNSPEC,
+	TCA_VLAN_TM,
+	TCA_VLAN_PARMS,
+	TCA_VLAN_PUSH_VLAN_ID,
+	TCA_VLAN_PUSH_VLAN_PROTOCOL,
+	__TCA_VLAN_MAX,
+};
+#define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1)
+
+#endif
diff --git a/tc/Makefile b/tc/Makefile
index 1ab36c6..830c97d 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -40,6 +40,7 @@ TCMODULES += m_pedit.o
 TCMODULES += m_skbedit.o
 TCMODULES += m_csum.o
 TCMODULES += m_simple.o
+TCMODULES += m_vlan.o
 TCMODULES += p_ip.o
 TCMODULES += p_icmp.o
 TCMODULES += p_tcp.o
diff --git a/tc/m_vlan.c b/tc/m_vlan.c
new file mode 100644
index 0000000..54c0ce7
--- /dev/null
+++ b/tc/m_vlan.c
@@ -0,0 +1,205 @@
+/*
+ * m_vlan.c		vlan manipulation module
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ *
+ * Authors:     Jiri Pirko <jiri@resnulli.us>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include "utils.h"
+#include "rt_names.h"
+#include "tc_util.h"
+#include <linux/tc_act/tc_vlan.h>
+
+static void explain(void)
+{
+	fprintf(stderr, "Usage: vlan pop\n");
+	fprintf(stderr, "       vlan push [ protocol VLANPROTO ] id VLANID\n");
+}
+
+static void usage(void)
+{
+	explain();
+	exit(-1);
+}
+
+static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p,
+		      int tca_id, struct nlmsghdr *n)
+{
+	int argc = *argc_p;
+	char **argv = *argv_p;
+	struct rtattr *tail;
+	int action = 0;
+	__u16 id;
+	int id_set = 0;
+	__u16 proto;
+	int proto_set = 0;
+	struct tc_vlan parm = { 0 };
+
+	if (matches(*argv, "vlan") != 0)
+		return -1;
+
+	NEXT_ARG();
+
+	while (argc > 0) {
+		if (matches(*argv, "pop") == 0) {
+			if (action) {
+				fprintf(stderr, "unexpexted \"%s\" - action already specified\n",
+					*argv);
+				explain();
+				return -1;
+			}
+			action = TCA_VLAN_ACT_POP;
+		} else if (matches(*argv, "push") == 0) {
+			if (action) {
+				fprintf(stderr, "unexpexted \"%s\" - action already specified\n",
+					*argv);
+				explain();
+				return -1;
+			}
+			action = TCA_VLAN_ACT_PUSH;
+		} else if (matches(*argv, "id") == 0) {
+			if (action != TCA_VLAN_ACT_PUSH) {
+				fprintf(stderr, "\"%s\" is only valid for push\n",
+					*argv);
+				explain();
+				return -1;
+			}
+			NEXT_ARG();
+			if (get_u16(&id, *argv, 0))
+				invarg("id is invalid", *argv);
+			id_set = 1;
+		} else if (matches(*argv, "protocol") == 0) {
+			if (action != TCA_VLAN_ACT_PUSH) {
+				fprintf(stderr, "\"%s\" is only valid for push\n",
+					*argv);
+				explain();
+				return -1;
+			}
+			NEXT_ARG();
+			if (ll_proto_a2n(&proto, *argv))
+				invarg("protocol is invalid", *argv);
+			proto_set = 1;
+		} else if (matches(*argv, "help") == 0) {
+			usage();
+		} else {
+			break;
+		}
+		argc--;
+		argv++;
+	}
+
+	parm.action = TC_ACT_PIPE;
+	if (argc) {
+		if (matches(*argv, "reclassify") == 0) {
+			parm.action = TC_ACT_RECLASSIFY;
+			NEXT_ARG();
+		} else if (matches(*argv, "pipe") == 0) {
+			parm.action = TC_ACT_PIPE;
+			NEXT_ARG();
+		} else if (matches(*argv, "drop") == 0 ||
+			   matches(*argv, "shot") == 0) {
+			parm.action = TC_ACT_SHOT;
+			NEXT_ARG();
+		} else if (matches(*argv, "continue") == 0) {
+			parm.action = TC_ACT_UNSPEC;
+			NEXT_ARG();
+		} else if (matches(*argv, "pass") == 0) {
+			parm.action = TC_ACT_OK;
+			NEXT_ARG();
+		}
+	}
+
+	if (argc) {
+		if (matches(*argv, "index") == 0) {
+			NEXT_ARG();
+			if (get_u32(&parm.index, *argv, 10)) {
+				fprintf(stderr, "Pedit: Illegal \"index\"\n");
+				return -1;
+			}
+			argc--;
+			argv++;
+		}
+	}
+
+	if (action == TCA_VLAN_ACT_PUSH && !id_set) {
+		fprintf(stderr, "id needs to be set for push\n");
+		explain();
+		return -1;
+	}
+
+	parm.v_action = action;
+	tail = NLMSG_TAIL(n);
+	addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+	addattr_l(n, MAX_MSG, TCA_VLAN_PARMS, &parm, sizeof(parm));
+	if (id_set)
+		addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_ID, &id, 2);
+	if (proto_set)
+		addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_PROTOCOL, &proto, 2);
+	tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
+
+	*argc_p = argc;
+	*argv_p = argv;
+	return 0;
+}
+
+static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg)
+{
+	struct rtattr *tb[TCA_VLAN_MAX + 1];
+	__u16 val;
+	struct tc_vlan *parm;
+
+	if (arg == NULL)
+		return -1;
+
+	parse_rtattr_nested(tb, TCA_VLAN_MAX, arg);
+
+	if (!tb[TCA_VLAN_PARMS]) {
+		fprintf(f, "[NULL vlan parameters]");
+		return -1;
+	}
+	parm = RTA_DATA(tb[TCA_VLAN_PARMS]);
+
+	fprintf(f, " vlan");
+
+	switch(parm->v_action) {
+	case TCA_VLAN_ACT_POP:
+		fprintf(f, " pop");
+		break;
+	case TCA_VLAN_ACT_PUSH:
+		fprintf(f, " push");
+		if (tb[TCA_VLAN_PUSH_VLAN_ID]) {
+			val = rta_getattr_u16(tb[TCA_VLAN_PUSH_VLAN_ID]);
+			fprintf(f, " id %d", val);
+		}
+		if (tb[TCA_VLAN_PUSH_VLAN_PROTOCOL]) {
+			val = rta_getattr_u16(tb[TCA_VLAN_PUSH_VLAN_PROTOCOL]);
+			fprintf(f, " proto %04x", val);
+		}
+		break;
+	}
+
+	if (show_stats) {
+		if (tb[TCA_VLAN_TM]) {
+			struct tcf_t *tm = RTA_DATA(tb[TCA_VLAN_TM]);
+			print_tm(f, tm);
+		}
+	}
+
+	fprintf(f, "\n ");
+
+	return 0;
+}
+
+struct action_util vlan_action_util = {
+	.id = "vlan",
+	.parse_aopt = parse_vlan,
+	.print_aopt = print_vlan,
+};
-- 
1.9.3

^ permalink raw reply related

* [patch net-next 2/2] sched: introduce vlan action
From: Jiri Pirko @ 2014-11-11 10:13 UTC (permalink / raw)
  To: netdev
  Cc: davem, jhs, pshelar, therbert, edumazet, willemb, dborkman, mst,
	fw, Paul.Durrant, tgraf
In-Reply-To: <1415700789-9171-1-git-send-email-jiri@resnulli.us>

This tc action allows to work with vlan tagged skbs. Two supported
sub-actions are header pop and header push.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 include/net/tc_act/tc_vlan.h        |  27 +++++
 include/uapi/linux/tc_act/tc_vlan.h |  35 ++++++
 net/sched/Kconfig                   |  11 ++
 net/sched/Makefile                  |   1 +
 net/sched/act_vlan.c                | 207 ++++++++++++++++++++++++++++++++++++
 5 files changed, 281 insertions(+)
 create mode 100644 include/net/tc_act/tc_vlan.h
 create mode 100644 include/uapi/linux/tc_act/tc_vlan.h
 create mode 100644 net/sched/act_vlan.c

diff --git a/include/net/tc_act/tc_vlan.h b/include/net/tc_act/tc_vlan.h
new file mode 100644
index 0000000..c809c1d
--- /dev/null
+++ b/include/net/tc_act/tc_vlan.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __NET_TC_VLAN_H
+#define __NET_TC_VLAN_H
+
+#include <net/act_api.h>
+
+#define VLAN_F_POP		0x1
+#define VLAN_F_PUSH		0x2
+
+struct tcf_vlan {
+	struct tcf_common	common;
+	int			tcfv_action;
+	__be16			tcfv_push_vid;
+	__be16			tcfv_push_proto;
+};
+#define to_vlan(a) \
+	container_of(a->priv, struct tcf_vlan, common)
+
+#endif /* __NET_TC_VLAN_H */
diff --git a/include/uapi/linux/tc_act/tc_vlan.h b/include/uapi/linux/tc_act/tc_vlan.h
new file mode 100644
index 0000000..f7b8d44
--- /dev/null
+++ b/include/uapi/linux/tc_act/tc_vlan.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __LINUX_TC_VLAN_H
+#define __LINUX_TC_VLAN_H
+
+#include <linux/pkt_cls.h>
+
+#define TCA_ACT_VLAN 12
+
+#define TCA_VLAN_ACT_POP	1
+#define TCA_VLAN_ACT_PUSH	2
+
+struct tc_vlan {
+	tc_gen;
+	int v_action;
+};
+
+enum {
+	TCA_VLAN_UNSPEC,
+	TCA_VLAN_TM,
+	TCA_VLAN_PARMS,
+	TCA_VLAN_PUSH_VLAN_ID,
+	TCA_VLAN_PUSH_VLAN_PROTOCOL,
+	__TCA_VLAN_MAX,
+};
+#define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1)
+
+#endif
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index a1a8e29..88618f8 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -686,6 +686,17 @@ config NET_ACT_CSUM
 	  To compile this code as a module, choose M here: the
 	  module will be called act_csum.
 
+config NET_ACT_VLAN
+        tristate "Vlan manipulation"
+        depends on NET_CLS_ACT
+        ---help---
+	  Say Y here to push or pop vlan headers.
+
+	  If unsure, say N.
+
+	  To compile this code as a module, choose M here: the
+	  module will be called act_vlan.
+
 config NET_CLS_IND
 	bool "Incoming device classification"
 	depends on NET_CLS_U32 || NET_CLS_FW
diff --git a/net/sched/Makefile b/net/sched/Makefile
index 0a869a1..679f24a 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_NET_ACT_PEDIT)	+= act_pedit.o
 obj-$(CONFIG_NET_ACT_SIMP)	+= act_simple.o
 obj-$(CONFIG_NET_ACT_SKBEDIT)	+= act_skbedit.o
 obj-$(CONFIG_NET_ACT_CSUM)	+= act_csum.o
+obj-$(CONFIG_NET_ACT_VLAN)	+= act_vlan.o
 obj-$(CONFIG_NET_SCH_FIFO)	+= sch_fifo.o
 obj-$(CONFIG_NET_SCH_CBQ)	+= sch_cbq.o
 obj-$(CONFIG_NET_SCH_HTB)	+= sch_htb.o
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
new file mode 100644
index 0000000..013b17d
--- /dev/null
+++ b/net/sched/act_vlan.c
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/skbuff.h>
+#include <linux/rtnetlink.h>
+#include <linux/if_vlan.h>
+#include <net/netlink.h>
+#include <net/pkt_sched.h>
+
+#include <linux/tc_act/tc_vlan.h>
+#include <net/tc_act/tc_vlan.h>
+
+#define VLAN_TAB_MASK     15
+
+static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a,
+		    struct tcf_result *res)
+{
+	struct tcf_vlan *v = a->priv;
+	int action;
+	int err;
+
+	spin_lock(&v->tcf_lock);
+	v->tcf_tm.lastuse = jiffies;
+	bstats_update(&v->tcf_bstats, skb);
+	action = v->tcf_action;
+
+	switch (v->tcfv_action) {
+	case TCA_VLAN_ACT_POP:
+		err = skb_vlan_pop(skb);
+		if (err)
+			goto drop;
+		break;
+	case TCA_VLAN_ACT_PUSH:
+		err = skb_vlan_push(skb, v->tcfv_push_proto, v->tcfv_push_vid);
+		if (err)
+			goto drop;
+		break;
+	default:
+		BUG();
+	}
+
+	goto unlock;
+
+drop:
+	action = TC_ACT_SHOT;
+	v->tcf_qstats.drops++;
+unlock:
+	spin_unlock(&v->tcf_lock);
+	return action;
+}
+
+static const struct nla_policy vlan_policy[TCA_VLAN_MAX + 1] = {
+	[TCA_VLAN_PARMS]		= { .len = sizeof(struct tc_vlan) },
+	[TCA_VLAN_PUSH_VLAN_ID]		= { .type = NLA_U16 },
+	[TCA_VLAN_PUSH_VLAN_PROTOCOL]	= { .type = NLA_U16 },
+};
+
+static int tcf_vlan_init(struct net *net, struct nlattr *nla,
+			 struct nlattr *est, struct tc_action *a,
+			 int ovr, int bind)
+{
+	struct nlattr *tb[TCA_VLAN_MAX + 1];
+	struct tc_vlan *parm;
+	struct tcf_vlan *v;
+	int action;
+	__be16 push_vid = 0;
+	__be16 push_proto = 0;
+	int ret = 0;
+	int err;
+
+	if (!nla)
+		return -EINVAL;
+
+	err = nla_parse_nested(tb, TCA_VLAN_MAX, nla, vlan_policy);
+	if (err < 0)
+		return err;
+
+	if (!tb[TCA_VLAN_PARMS])
+		return -EINVAL;
+	parm = nla_data(tb[TCA_VLAN_PARMS]);
+	switch (parm->v_action) {
+	case TCA_VLAN_ACT_POP:
+		break;
+	case TCA_VLAN_ACT_PUSH:
+		if (!tb[TCA_VLAN_PUSH_VLAN_ID])
+			return -EINVAL;
+		push_vid = nla_get_u16(tb[TCA_VLAN_PUSH_VLAN_ID]);
+		if (push_vid >= VLAN_VID_MASK)
+			return -ERANGE;
+
+		if (tb[TCA_VLAN_PUSH_VLAN_PROTOCOL]) {
+			push_proto = nla_get_be16(tb[TCA_VLAN_PUSH_VLAN_PROTOCOL]);
+			switch (push_proto) {
+			case htons(ETH_P_8021Q):
+			case htons(ETH_P_8021AD):
+				break;
+			default:
+				return -EPROTONOSUPPORT;
+			}
+		} else {
+			push_proto = htons(ETH_P_8021Q);
+		}
+		break;
+	default:
+		return -EINVAL;
+	}
+	action = parm->v_action;
+
+	if (!tcf_hash_check(parm->index, a, bind)) {
+		ret = tcf_hash_create(parm->index, est, a, sizeof(*v), bind);
+		if (ret)
+			return ret;
+
+		ret = ACT_P_CREATED;
+	} else {
+		if (bind)
+			return 0;
+		tcf_hash_release(a, bind);
+		if (!ovr)
+			return -EEXIST;
+	}
+
+	v = to_vlan(a);
+
+	spin_lock_bh(&v->tcf_lock);
+
+	v->tcfv_action = action;
+	v->tcfv_push_vid = push_vid;
+	v->tcfv_push_proto = push_proto;
+
+	v->tcf_action = parm->action;
+
+	spin_unlock_bh(&v->tcf_lock);
+
+	if (ret == ACT_P_CREATED)
+		tcf_hash_insert(a);
+	return ret;
+}
+
+static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a,
+			 int bind, int ref)
+{
+	unsigned char *b = skb_tail_pointer(skb);
+	struct tcf_vlan *v = a->priv;
+	struct tc_vlan opt = {
+		.index    = v->tcf_index,
+		.refcnt   = v->tcf_refcnt - ref,
+		.bindcnt  = v->tcf_bindcnt - bind,
+		.action   = v->tcf_action,
+		.v_action = v->tcfv_action,
+	};
+	struct tcf_t t;
+
+	if (nla_put(skb, TCA_VLAN_PARMS, sizeof(opt), &opt))
+		goto nla_put_failure;
+
+	if (v->tcfv_action == TCA_VLAN_ACT_PUSH &&
+	    nla_put_u16(skb, TCA_VLAN_PUSH_VLAN_ID, v->tcfv_push_vid) &&
+	    nla_put_u16(skb, TCA_VLAN_PUSH_VLAN_PROTOCOL, v->tcfv_push_proto))
+		goto nla_put_failure;
+
+	t.install = jiffies_to_clock_t(jiffies - v->tcf_tm.install);
+	t.lastuse = jiffies_to_clock_t(jiffies - v->tcf_tm.lastuse);
+	t.expires = jiffies_to_clock_t(v->tcf_tm.expires);
+	if (nla_put(skb, TCA_VLAN_TM, sizeof(t), &t))
+		goto nla_put_failure;
+	return skb->len;
+
+nla_put_failure:
+	nlmsg_trim(skb, b);
+	return -1;
+}
+
+static struct tc_action_ops act_vlan_ops = {
+	.kind		=	"vlan",
+	.type		=	TCA_ACT_VLAN,
+	.owner		=	THIS_MODULE,
+	.act		=	tcf_vlan,
+	.dump		=	tcf_vlan_dump,
+	.init		=	tcf_vlan_init,
+};
+
+static int __init vlan_init_module(void)
+{
+	return tcf_register_action(&act_vlan_ops, VLAN_TAB_MASK);
+}
+
+static void __exit vlan_cleanup_module(void)
+{
+	tcf_unregister_action(&act_vlan_ops);
+}
+
+module_init(vlan_init_module);
+module_exit(vlan_cleanup_module);
+
+MODULE_AUTHOR("Jiri Pirko <jiri@resnulli.us>");
+MODULE_DESCRIPTION("vlan manipulation actions");
+MODULE_LICENSE("GPL v2");
-- 
1.9.3

^ permalink raw reply related

* [patch net-next 1/2] net: move vlan pop/push functions into common code
From: Jiri Pirko @ 2014-11-11 10:13 UTC (permalink / raw)
  To: netdev
  Cc: davem, jhs, pshelar, therbert, edumazet, willemb, dborkman, mst,
	fw, Paul.Durrant, tgraf

So it can be used from out of openvswitch code.
Did couple of cosmetic changes on the way, namely variable naming and
adding support for 8021AD proto.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 include/linux/skbuff.h    |  2 ++
 net/core/skbuff.c         | 86 +++++++++++++++++++++++++++++++++++++++++++++++
 net/openvswitch/actions.c | 76 ++---------------------------------------
 3 files changed, 90 insertions(+), 74 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 103fbe8..3b0445c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2673,6 +2673,8 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet);
 unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
 struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
 struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
+int skb_vlan_pop(struct sk_buff *skb);
+int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
 
 struct skb_checksum_ops {
 	__wsum (*update)(const void *mem, int len, __wsum wsum);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7001896..75e53d4 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4151,6 +4151,92 @@ err_free:
 }
 EXPORT_SYMBOL(skb_vlan_untag);
 
+/* remove VLAN header from packet and update csum accordingly. */
+static int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci)
+{
+	struct vlan_hdr *vhdr;
+	int err;
+
+	if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
+		return -ENOMEM;
+
+	if (!skb_cloned(skb) || skb_clone_writable(skb, VLAN_ETH_HLEN))
+		return 0;
+
+	err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
+	if (unlikely(err))
+		return err;
+
+	if (skb->ip_summed == CHECKSUM_COMPLETE)
+		skb->csum = csum_sub(skb->csum, csum_partial(skb->data
+					+ (2 * ETH_ALEN), VLAN_HLEN, 0));
+
+	vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);
+	*vlan_tci = ntohs(vhdr->h_vlan_TCI);
+
+	memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN);
+	__skb_pull(skb, VLAN_HLEN);
+
+	vlan_set_encap_proto(skb, vhdr);
+	skb->mac_header += VLAN_HLEN;
+	if (skb_network_offset(skb) < ETH_HLEN)
+		skb_set_network_header(skb, ETH_HLEN);
+	skb_reset_mac_len(skb);
+
+	return 0;
+}
+
+int skb_vlan_pop(struct sk_buff *skb)
+{
+	u16 vlan_tci;
+	__be16 vlan_proto;
+	int err;
+
+	if (likely(vlan_tx_tag_present(skb))) {
+		skb->vlan_tci = 0;
+	} else {
+		if (unlikely((skb->protocol != htons(ETH_P_8021Q) &&
+			      skb->protocol != htons(ETH_P_8021AD)) ||
+			     skb->len < VLAN_ETH_HLEN))
+			return 0;
+
+		err = __skb_vlan_pop(skb, &vlan_tci);
+		if (err)
+			return err;
+	}
+	/* move next vlan tag to hw accel tag */
+	if (likely((skb->protocol != htons(ETH_P_8021Q) &&
+		    skb->protocol != htons(ETH_P_8021AD)) ||
+		   skb->len < VLAN_ETH_HLEN))
+		return 0;
+
+	vlan_proto = skb->protocol;
+	err = __skb_vlan_pop(skb, &vlan_tci);
+	if (unlikely(err))
+		return err;
+
+	__vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
+	return 0;
+}
+EXPORT_SYMBOL(skb_vlan_pop);
+
+int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci)
+{
+	if (vlan_tx_tag_present(skb)) {
+		/* push down current VLAN tag */
+		if (!__vlan_put_tag(skb, skb->vlan_proto,
+				    vlan_tx_tag_get(skb)))
+			return -ENOMEM;
+
+		if (skb->ip_summed == CHECKSUM_COMPLETE)
+			skb->csum = csum_add(skb->csum, csum_partial(skb->data
+					+ (2 * ETH_ALEN), VLAN_HLEN, 0));
+	}
+	__vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
+	return 0;
+}
+EXPORT_SYMBOL(skb_vlan_push);
+
 /**
  * alloc_skb_with_frags - allocate skb with page frags
  *
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index f7e5891..1b28110 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -206,86 +206,14 @@ static int set_mpls(struct sk_buff *skb, const __be32 *mpls_lse)
 	return 0;
 }
 
-/* remove VLAN header from packet and update csum accordingly. */
-static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci)
-{
-	struct vlan_hdr *vhdr;
-	int err;
-
-	err = make_writable(skb, VLAN_ETH_HLEN);
-	if (unlikely(err))
-		return err;
-
-	if (skb->ip_summed == CHECKSUM_COMPLETE)
-		skb->csum = csum_sub(skb->csum, csum_partial(skb->data
-					+ (2 * ETH_ALEN), VLAN_HLEN, 0));
-
-	vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);
-	*current_tci = vhdr->h_vlan_TCI;
-
-	memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN);
-	__skb_pull(skb, VLAN_HLEN);
-
-	vlan_set_encap_proto(skb, vhdr);
-	skb->mac_header += VLAN_HLEN;
-
-	if (skb_network_offset(skb) < ETH_HLEN)
-		skb_set_network_header(skb, ETH_HLEN);
-
-	/* Update mac_len for subsequent MPLS actions */
-	skb_reset_mac_len(skb);
-	return 0;
-}
-
 static int pop_vlan(struct sk_buff *skb)
 {
-	__be16 tci;
-	int err;
-
-	if (likely(vlan_tx_tag_present(skb))) {
-		skb->vlan_tci = 0;
-	} else {
-		if (unlikely(skb->protocol != htons(ETH_P_8021Q) ||
-			     skb->len < VLAN_ETH_HLEN))
-			return 0;
-
-		err = __pop_vlan_tci(skb, &tci);
-		if (err)
-			return err;
-	}
-	/* move next vlan tag to hw accel tag */
-	if (likely(skb->protocol != htons(ETH_P_8021Q) ||
-		   skb->len < VLAN_ETH_HLEN))
-		return 0;
-
-	err = __pop_vlan_tci(skb, &tci);
-	if (unlikely(err))
-		return err;
-
-	__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(tci));
-	return 0;
+	return skb_vlan_pop(skb);
 }
 
 static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vlan)
 {
-	if (unlikely(vlan_tx_tag_present(skb))) {
-		u16 current_tag;
-
-		/* push down current VLAN tag */
-		current_tag = vlan_tx_tag_get(skb);
-
-		if (!__vlan_put_tag(skb, skb->vlan_proto, current_tag))
-			return -ENOMEM;
-		/* Update mac_len for subsequent MPLS actions */
-		skb->mac_len += VLAN_HLEN;
-
-		if (skb->ip_summed == CHECKSUM_COMPLETE)
-			skb->csum = csum_add(skb->csum, csum_partial(skb->data
-					+ (2 * ETH_ALEN), VLAN_HLEN, 0));
-
-	}
-	__vlan_hwaccel_put_tag(skb, vlan->vlan_tpid, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
-	return 0;
+	return skb_vlan_push(skb, vlan->vlan_tpid, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
 }
 
 static int set_eth_addr(struct sk_buff *skb,
-- 
1.9.3

^ permalink raw reply related

* Re: How to make stack send broadcast ARP request when entry is STALE?
From: Ulf samuelsson @ 2014-11-11 10:08 UTC (permalink / raw)
  To: Brian Haley; +Cc: Netdev
In-Reply-To: <54614198.7010306@hp.com>

If I set ucast_solicit to '0', then I always send broadcast, which is not desirable.

In the PROBE state of the ARP state machine, "probes" count from 0 .. ucast_probes.

I can see the following arguments for letting "probes" count from 
  
   0.. (ucast_probes + app_probes + mcast_probes)
   

A: This is how the IPv6 is doing it. 
     It is not standardized in IPv4, but why should the IPv4 have a different behaviour?

B: If you do not send out broadcast if unicast fails, then a broadcast will be sent out 
     anyway, once the ARP entry is removed by the garbage collector.
     You get an annoyingly long delay before that happens.

C: If a large data centre does not want broadcasts to be sent out, 
     then they can set mcast_probes to 0, in which case no broadcasts will be sent
     out in PROBE state.

D:  When in other states, the counter runs until it a reply is had, or the counter wraps around.
      It is sending broadcast all the time.


Best Regards
Ulf Samuelsson
ulf@emagii.com
+46  (722) 427 437


> 10 nov 2014 kl. 23:52 skrev Brian Haley <brian.haley@hp.com>:
> 
>> On 11/07/2014 05:11 AM, Ulf samuelsson wrote:
>> The HP router is configured by a customer, and they intentionally limit replies
>> to broadcast, and that is how they want it.
> 
> So this is the crux of the problem - the customer has configured the router so
> that it doesn't play well with most modern network stacks that try and use
> unicast so they don't send unnecessary broadcast packets.  I don't know why I
> thought this was something wrong with the router software.
> 
> Did you try this?
> 
> $ sudo sysctl net.ipv4.neigh.eth0.ucast_solicit=0
> 
> It works for me.
> 
> And they really should re-think their decision on that configuration setting.
> 
> -Brian
> 
> 
>> In the previous version of the build system, the Interpeak stack was used
>> and this would in PROBE state send unicast ARP request, and if that failed
>> send broadcast ARP.
>> 
>> The native linux stack, when in PROBE state sends only unicast until it decides
>> that it should enter FAILED state.
>> 
>> The 'mcast_probes' variable seems to be totally ignored, except the first  time,
>> so I do not see why it is there.
>> 
>> Best Regards
>> Ulf Samuelsson
>> ulf@emagii.com
>> +46  (722) 427 437
>> 
>> 
>>>> 7 nov 2014 kl. 10:54 skrev Brian Haley <brian.haley@hp.com>:
>>>> 
>>>> On 11/05/2014 07:48 AM, Ulf samuelsson wrote:
>>>> Have a problem with an HP router at a certain location, which
>>>> is configured to only answer to broadcast ARP requests.
>>>> That cannot be changed.
>>> 
>>> Sorry to hear about the problem, but my only suggestions would be to try the latest firmware and/or put a call in to support.  I don't happen work in the division that makes routers...
>>> 
>>>> The first ARP request the kernel sends out, is a broadcast request,
>>>> which is fine, but after the reply, the kernel sends unicast requests,
>>>> which will not get any replies.
>>> 
>>> You might be able to hack this by inserting an ebtables rule - check the dnat target section of the man page - don't know the exact syntax but it would probably end in '-j dnat --to-destination ff:ff:ff:ff:ff:ff'
>>> 
>>> -Brian
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> 
> 

^ permalink raw reply

* Re: [patch net-next v2 02/10] net: introduce generic switch devices support
From: Jiri Pirko @ 2014-11-11 10:04 UTC (permalink / raw)
  To: M. Braun
  Cc: netdev, davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse,
	pshelar, azhou, ben, stephen, jeffrey.t.kirsher, vyasevic,
	xiyou.wangcong, john.r.fastabend, edumazet, jhs, sfeldma,
	f.fainelli, roopa, linville, jasowang, ebiederm, nicolas.dichtel,
	ryazanov.s.a, buytenh, aviadr, nbd, alexei.starovoitov,
	Neil.Jerram, ronye, simon.horman, alexander.h.duyck, john.ronciak,
	mleitner, shrijeet, gospo, bcrl
In-Reply-To: <5461DBB0.5090107@fami-braun.de>

Tue, Nov 11, 2014 at 10:49:36AM CET, michael-dev@fami-braun.de wrote:
>
>
>Am 09.11.2014 um 11:51 schrieb Jiri Pirko:
>> diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt
>> +	ndo_sw_parent_get_id - ...
>
>here the ndo is called get_id
>
>but
>
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> + *
>> + * int (*ndo_sw_parent_id_get)(struct net_device *dev,
>> + *			       struct netdev_phys_item_id *psid);
>> @@ -1168,6 +1174,10 @@ struct net_device_ops {
>> +	int			(*ndo_sw_parent_id_get)(struct net_device *dev,
>> +							struct netdev_phys_item_id *psid);
>
>here it is call id_get, which is similar but not the same.


Will fix the docs, thanks.

>
>Regards,
> M. Braun

^ permalink raw reply

* Re: [PATCH 1/1] linux-wireless: Added psk in struct cfg80211_connect_params needed for offloading 4way handshake to driver
From: Johannes Berg @ 2014-11-11 10:03 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Gautam (Gautam Kumar) Shukla, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org, davem@davemloft.net,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, Jithu Jance, Sreenath S
In-Reply-To: <5461DCC9.5050702@broadcom.com>

On Tue, 2014-11-11 at 10:54 +0100, Arend van Spriel wrote:

> > Also, there's a competing approach from QCA that's far more suited.
> 
> I probably was not paying attention to it, but would you have a
> reference to this.

... digs around in email ...

http://mid.gmane.org/1343907187-6686-1-git-send-email-qca_vkondrat@qca.qualcomm.com

Anyway, looking back at that, it wasn't really all that different, just
a bit more complete maybe.

johannes

^ permalink raw reply

* Re: [patch net-next v2 02/10] net: introduce generic switch devices support
From: M. Braun @ 2014-11-11  9:49 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, nhorman, andy, tgraf, dborkman, ogerlitz, jesse, pshelar,
	azhou, ben, stephen, jeffrey.t.kirsher, vyasevic, xiyou.wangcong,
	john.r.fastabend, edumazet, jhs, sfeldma, f.fainelli, roopa,
	linville, jasowang, ebiederm, nicolas.dichtel, ryazanov.s.a,
	buytenh, aviadr, nbd, alexei.starovoitov, Neil.Jerram, ronye,
	simon.horman, alexander.h.duyck, john.ronciak, mleitner, shrijeet,
	gospo, bcrl
In-Reply-To: <1415530280-9190-3-git-send-email-jiri@resnulli.us>



Am 09.11.2014 um 11:51 schrieb Jiri Pirko:
> diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt
> +	ndo_sw_parent_get_id - ...

here the ndo is called get_id

but

> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> + *
> + * int (*ndo_sw_parent_id_get)(struct net_device *dev,
> + *			       struct netdev_phys_item_id *psid);
> @@ -1168,6 +1174,10 @@ struct net_device_ops {
> +	int			(*ndo_sw_parent_id_get)(struct net_device *dev,
> +							struct netdev_phys_item_id *psid);

here it is call id_get, which is similar but not the same.

Regards,
 M. Braun

^ permalink raw reply

* Re: [PATCH 1/1] linux-wireless: Added psk in struct cfg80211_connect_params needed for offloading 4way handshake to driver
From: Arend van Spriel @ 2014-11-11  9:54 UTC (permalink / raw)
  To: Johannes Berg, Gautam (Gautam Kumar) Shukla
  Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	davem@davemloft.net, linux-api@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Jithu Jance,
	Sreenath S
In-Reply-To: <1415698161.2163.0.camel@sipsolutions.net>

On 11-11-14 10:29, Johannes Berg wrote:
> On Tue, 2014-11-11 at 05:56 +0000, Gautam (Gautam Kumar) Shukla wrote:
>> For offloading 4 way handshake to driver, currently we don't have any
>> member  of struct cfg80211_connect_params to pass PSK from supplicant
>> to driver. I have added psk for the same and added rest of the code
>> needed in nl80211.h and nl80211.c to parse and make it available to
>> driver.
>> From supplicant, we already have psk member field in assoc_params to
>> use .
>>
>> Tested on x86 linux.
> 
> Your commit message needs serious work.
> 
> Also, there's a competing approach from QCA that's far more suited.

I probably was not paying attention to it, but would you have a
reference to this.

> In either case though, I'm going to ask which driver is going to use
> this and when it's going to land in mainline.

I had the same question ;-)

> johannes
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* [PATCH] ping mdev rounding issue
From: David Buckley @ 2014-11-11  9:16 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 2110 bytes --]

ping has a rounding issue in standard deviation computation.

It stores all values as integer micros, and computes standard deviation
as:

sqrt(SUM(time*time)/count - (SUM(time)/count)*(SUM(time)/count))

Because the second 'count' divide is performed before the multiply, a
rounding error results of the order O(sqrt(SUM(time)/count)).

Example: I ping my server twice. One takes 1000us, the second takes
1001us.

Standard deviation computed by ping is:

  sqrt((1000000+1002001)/2 - ((1000+1001)/2)*((1000+1001)/2))
= sqrt(1001000 - 1000*1000) = sqrt(1000) = 31

So we got a 1us difference and report a 31 us standard deviation.

If the samples are 999 and 1001
  sqrt((998001+1002001)/2 - ((999+1001)/2)*((999+1001)/2))
= sqrt(1000001 - 1000*1000) = sqrt(1) = 0

So more deviation makes for less /reported/ deviation.

This is reduced slightly in this case by more samples (100*1000+1001
reports deviation of 4us, for instance), but really it's caused by the
rounding error ((float)SUM(time)/count) - (SUM(time)/count) being
/multiplied/ by the average time. The expected error is of the order
sqrt(mean).

Example real-world bad computation:

PING 74.125.230.238 (74.125.230.238) 56(84) bytes of data.
64 bytes from 74.125.230.238: icmp_seq=1 ttl=51 time=16.1 ms
64 bytes from 74.125.230.238: icmp_seq=2 ttl=51 time=16.1 ms
64 bytes from 74.125.230.238: icmp_seq=3 ttl=51 time=16.2 ms
64 bytes from 74.125.230.238: icmp_seq=4 ttl=51 time=16.1 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 16.132/16.170/16.246/0.161 ms


With patch (attached):

PING 74.125.230.238 (74.125.230.238) 56(84) bytes of data.
64 bytes from 74.125.230.238: icmp_seq=1 ttl=51 time=16.0 ms
64 bytes from 74.125.230.238: icmp_seq=2 ttl=51 time=16.1 ms
64 bytes from 74.125.230.238: icmp_seq=3 ttl=51 time=16.1 ms
64 bytes from 74.125.230.238: icmp_seq=4 ttl=51 time=16.1 ms
^C
--- 74.125.230.238 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 16.045/16.128/16.197/0.054 ms

-- 
David Buckley

[-- Attachment #2: fix_rounding.patch --]
[-- Type: text/x-diff, Size: 793 bytes --]

--- a/ping_common.c	2014-11-11 00:02:07.000000000 +0000
+++ b/ping_common.c	2014-11-11 09:04:06.699021939 +0000
@@ -1016,14 +1016,17 @@
 	}
 	putchar('\n');
 
 	if (nreceived && timing) {
 		long tmdev;
+		long count = nreceived + nrepeats;
 
-		tsum /= nreceived + nrepeats;
-		tsum2 /= nreceived + nrepeats;
-		tmdev = llsqrt(tsum2 - tsum * tsum);
+		// mdev = sqrt((tsum2/count) - (tsum/count)*(tsum2/count))
+		// However, we must be careful about rounding!
+		tmdev = llsqrt((tsum2 * count - tsum * tsum) / (count * count));
+		tsum2 /= count;
+		tsum /= count;
 
 		printf("rtt min/avg/max/mdev = %ld.%03ld/%lu.%03ld/%ld.%03ld/%ld.%03ld ms",
 		       (long)tmin/1000, (long)tmin%1000,
 		       (unsigned long)(tsum/1000), (long)(tsum%1000),
 		       (long)tmax/1000, (long)tmax%1000,

^ permalink raw reply

* Re: [PATCH 2/2] linux-wireless:Added wiphy capability flag for offloading 4way handshake to driver
From: Arend van Spriel @ 2014-11-11  9:49 UTC (permalink / raw)
  To: Gautam (Gautam Kumar) Shukla,
	linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jithu Jance,
	Sreenath S
In-Reply-To: <DF163EE1A432BF4BBE6B2088220663A6743890-HXj2mutaA2pmqaqore1TH5r/X4hKkxxPpWgKQ6/u3Fg@public.gmane.org>

On 11-11-14 07:27, Gautam (Gautam Kumar) Shukla wrote:
> 
> For offloading 4 way handshake to driver , currently we don't have WIPHY capability flag to communicate same to supplicant.
> I have added the flag NL80211_ATTR_4WAY_KEY_HANDSHAKE  and rest of the code for the same.
> 
> Tested on x86 linux machine
> 
> Signed-off-by: Gautam kumar shukla <gautams-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> ---
>  include/net/cfg80211.h       | 4 ++++
>  include/uapi/linux/nl80211.h | 5 ++++-
>  net/wireless/nl80211.c       | 4 ++++
>  3 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 6f744e0..b37de0a 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -2629,7 +2629,10 @@ struct cfg80211_ops {
>   *	TSPEC sessions (TID aka TSID 0-7) with the NL80211_CMD_ADD_TX_TS
>   *	command. Standard IEEE 802.11 TSPEC setup is not yet supported, it
>   *	needs to be able to handle Block-Ack agreements and other things.
> + *	@WIPHY_FLAG_SUPPORTS_4WAY_HANDHSHAKE:the device supports 4way handshake

Indentation seems wrong here. Also add space after the colon sign.

> + *	in the driver/firmware.
>   */
> +
>  enum wiphy_flags {
>  	WIPHY_FLAG_SUPPORTS_WMM_ADMISSION	= BIT(0),
>  	/* use hole at 1 */
> @@ -2654,6 +2657,7 @@ enum wiphy_flags {
>  	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
>  	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
>  	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
> +	WIPHY_FLAG_SUPPORTS_4WAY_HANDSHAKE	= BIT(24),
>  };
>  
>  /**
> diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
> index b01d5dd..2c474a3 100644
> --- a/include/uapi/linux/nl80211.h
> +++ b/include/uapi/linux/nl80211.h
> @@ -1640,9 +1640,11 @@ enum nl80211_commands {
>   *
>   *	@NL80211_ATTR_PSK: a PSK value (u8 attribute).This is 32-octet (256-bit)
>   *	PSK.
> + * @NL80211_ATTR_4WAY_KEY_HANDSHAKE: Indicates whether the driver is capable
> + * of 4way key handshake

convention is to have a tab in the continuing line.

>   *
>   *
> - * @NL80211_ATTR_MAX: highest attribute number currently defined
> + * * @NL80211_ATTR_MAX: highest attribute number currently defined

huh?

>   * @__NL80211_ATTR_AFTER_LAST: internal use
>   */
>  enum nl80211_attrs {
> @@ -1995,6 +1997,7 @@ enum nl80211_attrs {
>  	NL80211_ATTR_SMPS_MODE,
>  
>  	NL80211_ATTR_PSK,
> +	NL80211_ATTR_4WAY_KEY_HANDSHAKE,
>  
>  	/* add attributes here, update the policy in nl80211.c */
>  
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index 91c24b1..5f85c41 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -396,6 +396,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
>  	[NL80211_ATTR_ADMITTED_TIME] = { .type = NLA_U16 },
>  	[NL80211_ATTR_SMPS_MODE] = { .type = NLA_U8 },
>  	[NL80211_ATTR_PSK] = { .type = NLA_BINARY, .len = 32 },
> +	[NL80211_ATTR_4WAY_KEY_HANDSHAKE] = { .type = NLA_FLAG },
>  };
>  
>  /* policy for the key attributes */
> @@ -1303,6 +1304,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
>  		if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) &&
>  		    nla_put_flag(msg, NL80211_ATTR_ROAM_SUPPORT))
>  			goto nla_put_failure;
> +		if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_4WAY_HANDSHAKE) &&
> +			nla_put_flag(msg,NL80211_ATTR_4WAY_KEY_HANDSHAKE))
> +			goto nla_put_failure;
>  		if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) &&
>  		    nla_put_flag(msg, NL80211_ATTR_TDLS_SUPPORT))
>  			goto nla_put_failure;
> 

^ 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