Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/1] ax25: Fix segfault after sock connection timeout
From: Basil Gunn @ 2017-01-14 20:18 UTC (permalink / raw)
  To: Joerg Reuter, Ralf Baechle, David S. Miller, linux-hams, netdev,
	linux-kernel
  Cc: stable, Jeremy McDermond, f6bvp

The ax.25 socket connection timed out & the sock struct has been
previously taken down ie. sock struct is now a NULL pointer. Checking
the sock_flag causes the segfault.  Check if the socket struct pointer
is NULL before checking sock_flag. This segfault is seen in
timed out netrom connections.

Please submit to -stable.

Signed-off-by: Basil Gunn <basil@pacabunga.com>
---

diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index 4855d18..038b109 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -264,7 +264,7 @@ void ax25_disconnect(ax25_cb *ax25, int reason)
 {
 	ax25_clear_queues(ax25);

-	if (!sock_flag(ax25->sk, SOCK_DESTROY))
+	if (!ax25->sk || !sock_flag(ax25->sk, SOCK_DESTROY))
 		ax25_stop_heartbeat(ax25);
 	ax25_stop_t1timer(ax25);
 	ax25_stop_t2timer(ax25);

^ permalink raw reply related

* Re: [PATCH net-next 1/1] net sched actions: Add support for user cookies
From: John Fastabend @ 2017-01-14 20:18 UTC (permalink / raw)
  To: Jiri Pirko, Jamal Hadi Salim
  Cc: davem, netdev, jiri, paulb, simon.horman, mrv, hadarh, ogerlitz,
	roid, xiyou.wangcong, daniel, Jamal Hadi Salim
In-Reply-To: <20170114154915.GD1886@nanopsycho.orion>

On 17-01-14 07:49 AM, Jiri Pirko wrote:
> Sat, Jan 14, 2017 at 04:39:24PM CET, jhs@mojatatu.com wrote:
>> On 17-01-14 10:22 AM, Jiri Pirko wrote:
>>
>>>> .. create an accept action with cookie 0xA:0xa0a0a0a0a0a0a0
>>>> sudo $TC actions add action ok index 1 cookie 0xA 0xa0a0a0a0a0a0a0
>>>
>>> 2x 64bit values? Why can't this have variable length, according to what
>>> user needs:
>>
>>
>> You can intepret it however you wish. It is 128 bits. You can make it
>> 2x64, 4x32, 8x16, 16x8
>>
>>>
>>> sudo $TC actions add action ok index 1 cookie a0
>>> sudo $TC actions add action ok index 1 cookie a01122
>>> sudo $TC actions add action ok index 1 cookie a01122334455
>>> sudo $TC actions add action ok index 1 cookie a01122334455aabbccddeeff
>>>
>>
>> Sure you can do that too..
>> I will add add 16 8b fields to the union.
>>
>>
>>>>
>>>> .. dump all gact actions..
>>>> sudo $TC -s actions ls action gact
>>>>
>>>> 	action order 0: gact action pass
>>>> 	 random type none pass val 0
>>>> 	 index 1 ref 2 bind 1 installed 1221 sec used 27 sec
>>>> 	Action statistics:
>>>> 	Sent 373248 bytes 5056 pkt (dropped 0, overlimits 0 requeues 0)
>>>> 	backlog 0b 0p requeues 0
>>>> 	 cookie(0000000a:00000000:a0a0a0a0:00a0a0a0)
>>>
>>> Input is 2x64 and dump is 4x32? That is confusing. With my suggested
>>> example, this would be:
>>>
>>> 	 cookie a0
>>> 	 cookie a01122
>>> 	 cookie a01122334455
>>> 	 cookie a01122334455aabbccddeeff
>>>
>>
>> Your suggestion is more sensible for a user space cli tool like tc.
>> I will add a uchar cku8[16] field and make changes to iproute2.
>>
>>>> struct tc_action_ops;
>>>>
>>>> +union act_cookie {
>>>> +	u16 ck16[8];
>>>> +	u32 ck32[4];
>>>> +	u64 ck64[2];
>>>
>>> Since this should be never interpreted by kernel, I don't understand why
>>> this union is needed. Why just don't pass a char array?
>>>
>>
>> programmatic usability.
> 
> I don't see why. In userspace you can map whatever struct you need to the
> mem with chararray. It's totally up to you as an app developer. There is
> no need to make that part of kernel api. Really.
> 
> 
>>
>>> Also, whatever format this is, could we make is shared with cls cookie?
>>>
>>>
>>
>> The structure could be shared (and because it is in pkt_cls.h
>> that makes it easier). But the TLVs are domain specific. We need another
>> one for classifiers.
>>
>>>> +};
>>>> +
>>>> struct tc_action {
>>>> 	const struct tc_action_ops	*ops;
>>>> 	__u32				type; /* for backward compat(TCA_OLD_COMPAT) */
>>>> @@ -41,6 +47,7 @@ struct tc_action {
>>>> 	struct rcu_head			tcfa_rcu;
>>>> 	struct gnet_stats_basic_cpu __percpu *cpu_bstats;
>>>> 	struct gnet_stats_queue __percpu *cpu_qstats;
>>>> +	union act_cookie	*ck;
>>>> };
>>>> #define tcf_head	common.tcfa_head
>>>> #define tcf_index	common.tcfa_index
>>>> diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
>>>> index 1e5e1dd..6379af3 100644
>>>> --- a/include/uapi/linux/pkt_cls.h
>>>> +++ b/include/uapi/linux/pkt_cls.h
>>>> @@ -4,6 +4,12 @@
>>>> #include <linux/types.h>
>>>> #include <linux/pkt_sched.h>
>>>>
>>>> +union u_act_cookie {
>>>> +	__u16 ck16[8];
>>>> +	__u32 ck32[4];
>>>> +	__u64 ck64[2];
>>>> +};
>>>
>>> Again, the same struct? I don't understand why twice.
>>
>> Just old habits.
>> user vs kernel api? Standard action approach one says
>> __u32 other says u32; hanging off the user variant to kernel
>> didnt feel right.
> 
> Just have it in uapi and use it from within kernel. But did you see what
> I suggested in the other thread (regarding IFLA_PHYS_PORT_ID and
> IFLA_PHYS_SWITCH_ID)? If you do it what way, you don't need no struct.
> 

+1 on using something like MAX_PHYS_ITEM_ID_LEN seems much nicer to me
and easy to extend later as Jiri notes.

^ permalink raw reply

* Re: [PATCH net-next v2 08/10] net: dsa: Add support for platform data
From: Florian Fainelli @ 2017-01-14 19:12 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Jason Cooper, Sebastian Hesselbarth, Gregory Clement,
	Russell King, Vivien Didelot, David S. Miller,
	moderated list:ARM SUB-ARCHITECTURES, open list, gregkh
In-Reply-To: <173cffe2-f407-ac43-c5ee-85a70576dd36@gmail.com>

On 01/13/2017 02:37 PM, Florian Fainelli wrote:
> On 01/13/2017 06:04 AM, Andrew Lunn wrote:
>>> index cd91070b5467..d326fc4afad7 100644
>>> --- a/net/dsa/dsa2.c
>>> +++ b/net/dsa/dsa2.c
>>> @@ -81,17 +81,23 @@ static void dsa_dst_del_ds(struct dsa_switch_tree *dst,
>>>  
>>>  static bool dsa_port_is_valid(struct dsa_port *port)
>>>  {
>>> -	return !!port->dn;
>>> +	return !!(port->dn || port->name);
>>>  }
>>   
>> Does this clash with Viviens recent change to make names optional and
>> have the kernel assign it?
> 
> So there were two ways to look at this, one was that could check here
> that ds->pd is assigned and port->name is assigned, which means that
> platform data has to provide valid port name. We can also eliminate this
> check entirely because we now support NULL names just fines.

Considering that the comment above struct dsa_chip_data::port_names in
net/dsa/dsa.h is pretty clear about the port_names usage, I am tempted
to keep the code as-is since without a name, for platform data, we would
not have a way to tell if a port is disabled or not.

Does that work for you?
-- 
Florian

^ permalink raw reply

* Re: [PATCH v5 01/13] net: ethernet: aquantia: Make and configuration files.
From: David VomLehn @ 2017-01-14 19:04 UTC (permalink / raw)
  To: Florian Fainelli, Alexander Loktionov, netdev
  Cc: David S . Miller, Simon Edelhaus, Dmitrii Tarakanov, Pavel Belous,
	Dmitry Bezrukov
In-Reply-To: <6aa256dd-dae4-60f2-ef7c-ef8b8e5b81e2@gmail.com>

On 01/14/2017 10:48 AM, Florian Fainelli wrote:
> On 01/14/2017 10:42 AM, David VomLehn wrote:
>> Yes, we did have it that way at one point. But...there is also the
>> kernel philosophy of not putting in something for future expansion; you
>> can always do it later... Honestly, I've vacillated on this particular one.
> (please don't top post). There are several threads at the moment talking
> about renaming driver directory (synopsys/stmmac, mlx5), doing it later
> is certainly a possibility but is really frowned upon, since it will
> later on make the life of people backporting -stable changes a lot harder.
About that top-posting...I agree, but Microsoft has the entire planet 
doing it the other way. They find bottom posting confusing and often 
can't even figure out that you replied. One more reason I've hated 
Microsoft since 1976. So, I suspect I'm not the only one who 
occasionally slips up. My apologies.
>
> Even if there is just one driver at the moment, I would go with a
> dedicated directory for it, there are enough object files that justify
> this choice IMHO.
Good argument.

-- 
David VL

^ permalink raw reply

* Re: [PATCH net-next v2 05/10] drivers: base: Add device_find_class()
From: Florian Fainelli @ 2017-01-14 19:01 UTC (permalink / raw)
  To: David Laight, David Miller
  Cc: netdev@vger.kernel.org, jason@lakedaemon.net, andrew@lunn.ch,
	sebastian.hesselbarth@gmail.com,
	gregory.clement@free-electrons.com, linux@armlinux.org.uk,
	vivien.didelot@savoirfairelinux.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB02620D3@AcuExch.aculab.com>



On 01/13/2017 02:55 AM, David Laight wrote:
> From: Florian Fainelli
>> Sent: 12 January 2017 22:51
>> On 01/12/2017 01:21 PM, David Miller wrote:
>>> From: Florian Fainelli <f.fainelli@gmail.com>
>>> Date: Wed, 11 Jan 2017 19:41:16 -0800
>>>
>>>> Add a helper function to lookup a device reference given a class name.
>>>> This is a preliminary patch to remove adhoc code from net/dsa/dsa.c and
>>>> make it more generic.
> ...
>>>> +static int dev_is_class(struct device *dev, void *class)
>>>
>>> I know you are just moving code, but this class argumnet is a string
>>> and thus should be "char *" or even "const char *".
>>
>> Well, this is really so that we don't need to cast the arguments passed
>> to device_find_child(), which takes a void *data as well. If we made
>> that a const char *class, we'd get warnings that look like these:
>>
>> drivers/base/core.c: In function 'device_find_class':
>> drivers/base/core.c:2083:2: warning: passing argument 2 of
>> 'device_find_child' discards 'const' qualifier from pointer target type
>> [enabled by default]
>>   return device_find_child(parent, class, dev_is_class);
>>   ^
>> drivers/base/core.c:2050:16: note: expected 'void *' but argument is of
>> type 'const char *'
>>  struct device *device_find_child(struct device *parent, void *data,
>>                 ^
> ...
> 
> Maybe device_find_child() needs changing to take 'const void *' ?

As a separate patch set, sure, I will add that to my TODO. Thanks!
-- 
Florian

^ permalink raw reply

* Re: [PATCH v5 01/13] net: ethernet: aquantia: Make and configuration files.
From: Florian Fainelli @ 2017-01-14 18:48 UTC (permalink / raw)
  To: David VomLehn, Alexander Loktionov, netdev
  Cc: David S . Miller, Simon Edelhaus, Dmitrii Tarakanov, Pavel Belous,
	Dmitry Bezrukov
In-Reply-To: <5a7c1fcc-2bb7-f41f-e136-8072efca7307@texas.net>

On 01/14/2017 10:42 AM, David VomLehn wrote:
> Yes, we did have it that way at one point. But...there is also the
> kernel philosophy of not putting in something for future expansion; you
> can always do it later... Honestly, I've vacillated on this particular one.

(please don't top post). There are several threads at the moment talking
about renaming driver directory (synopsys/stmmac, mlx5), doing it later
is certainly a possibility but is really frowned upon, since it will
later on make the life of people backporting -stable changes a lot harder.

Even if there is just one driver at the moment, I would go with a
dedicated directory for it, there are enough object files that justify
this choice IMHO.
-- 
Florian

^ permalink raw reply

* Re: [PATCH v5 01/13] net: ethernet: aquantia: Make and configuration files.
From: David VomLehn @ 2017-01-14 18:42 UTC (permalink / raw)
  To: Florian Fainelli, Alexander Loktionov, netdev
  Cc: David S . Miller, Simon Edelhaus, Dmitrii Tarakanov, Pavel Belous,
	Dmitry Bezrukov
In-Reply-To: <f98434b6-1ff5-6959-6591-b28e24307557@gmail.com>

Yes, we did have it that way at one point. But...there is also the 
kernel philosophy of not putting in something for future expansion; you 
can always do it later... Honestly, I've vacillated on this particular one.

On 01/14/2017 10:39 AM, Florian Fainelli wrote:
>
> On 01/12/2017 09:02 PM, Alexander Loktionov wrote:
>> From: David VomLehn <vomlehn@texas.net>
>>
>> Patches to create the make and configuration files.
>>
>> Signed-off-by: Alexander Loktionov <Alexander.Loktionov@aquantia.com>
>> Signed-off-by: Dmitrii Tarakanov <Dmitrii.Tarakanov@aquantia.com>
>> Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
>> Signed-off-by: Dmitry Bezrukov <Dmitry.Bezrukov@aquantia.com>
>> Signed-off-by: David M. VomLehn <vomlehn@texas.net>
>> ---
>>   drivers/net/ethernet/aquantia/Kconfig  | 24 +++++++++++++++++++
>>   drivers/net/ethernet/aquantia/Makefile | 42 ++++++++++++++++++++++++++++++++++
>>   drivers/net/ethernet/aquantia/ver.h    | 18 +++++++++++++++
>>   3 files changed, 84 insertions(+)
>>   create mode 100644 drivers/net/ethernet/aquantia/Kconfig
>>   create mode 100644 drivers/net/ethernet/aquantia/Makefile
>>   create mode 100644 drivers/net/ethernet/aquantia/ver.h
>>
>> diff --git a/drivers/net/ethernet/aquantia/Kconfig b/drivers/net/ethernet/aquantia/Kconfig
>> new file mode 100644
>> index 0000000..a74a4c0
>> --- /dev/null
>> +++ b/drivers/net/ethernet/aquantia/Kconfig
>> @@ -0,0 +1,24 @@
>> +#
>> +# aQuantia device configuration
>> +#
>> +
>> +config NET_VENDOR_AQUANTIA
>> +	bool "aQuantia devices"
>> +	default y
>> +	---help---
>> +	  Set this to y if you have an Ethernet network cards that uses the aQuantia
>> +	  chipset.
>> +
>> +	  This option does not build any drivers; it casues the aQuantia
>> +	  drivers that can be built to appear in the list of Ethernet drivers.
>> +
>> +
>> +if NET_VENDOR_AQUANTIA
>> +
>> +config AQTION
>> +	tristate "aQuantia AQtion Support"
>> +	depends on PCI
>> +	---help---
>> +	  This enables the support for the aQuantia AQtion Ethernet card.
>> +
>> +endif # NET_VENDOR_AQUANTIA
>> diff --git a/drivers/net/ethernet/aquantia/Makefile b/drivers/net/ethernet/aquantia/Makefile
>> new file mode 100644
>> index 0000000..e4ae696
>> --- /dev/null
>> +++ b/drivers/net/ethernet/aquantia/Makefile
>> @@ -0,0 +1,42 @@
>> +################################################################################
>> +#
>> +# aQuantia Ethernet Controller AQtion Linux Driver
>> +# Copyright(c) 2014-2017 aQuantia Corporation.
>> +#
>> +# This program is free software; you can redistribute it and/or modify it
>> +# under the terms and conditions of the GNU General Public License,
>> +# version 2, as published by the Free Software Foundation.
>> +#
>> +# This program is distributed in the hope it will be useful, but WITHOUT
>> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>> +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
>> +# more details.
>> +#
>> +# You should have received a copy of the GNU General Public License along
>> +# with this program. If not, see <http://www.gnu.org/licenses/>.
>> +#
>> +# The full GNU General Public License is included in this distribution in
>> +# the file called "COPYING".
>> +#
>> +# Contact Information: <rdc-drv@aquantia.com>
>> +# aQuantia Corporation, 105 E. Tasman Dr. San Jose, CA 95134, USA
>> +#
>> +################################################################################
>> +
>> +#
>> +# Makefile for the AQtion(tm) Ethernet driver
>> +#
>> +
>> +obj-$(CONFIG_AQTION) += atlantic.o
>> +
>> +atlantic-objs := aq_main.o \
>> +	aq_nic.o \
>> +	aq_pci_func.o \
>> +	aq_vec.o \
>> +	aq_ring.o \
>> +	aq_hw_utils.o \
>> +	aq_ethtool.o \
>> +	hw_atl/hw_atl_a0.o \
>> +	hw_atl/hw_atl_b0.o \
>> +	hw_atl/hw_atl_utils.o \
>> +	hw_atl/hw_atl_llh.o
> You might want to create an aqtion or atlantic folder just in case you
> later on submit a driver for another aquantia NIC. That would keep the
> directory structure clean.


-- 
David VL

^ permalink raw reply

* Re: [PATCH net] openvswitch: maintain correct checksum state in conntrack actions
From: Pravin Shelar @ 2017-01-14 18:42 UTC (permalink / raw)
  To: Lance Richardson; +Cc: Linux Kernel Network Developers, ovs dev
In-Reply-To: <1484267598-4493-1-git-send-email-lrichard@redhat.com>

On Thu, Jan 12, 2017 at 4:33 PM, Lance Richardson <lrichard@redhat.com> wrote:
> When executing conntrack actions on skbuffs with checksum mode
> CHECKSUM_COMPLETE, the checksum must be updated to account for
> header pushes and pulls. Otherwise we get "hw csum failure"
> logs similar to this (ICMP packet received on geneve tunnel
> via ixgbe NIC):
>
> [  405.740065] genev_sys_6081: hw csum failure
> [  405.740106] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G          I     4.10.0-rc3+ #1
> [  405.740108] Call Trace:
> [  405.740110]  <IRQ>
> [  405.740113]  dump_stack+0x63/0x87
> [  405.740116]  netdev_rx_csum_fault+0x3a/0x40
> [  405.740118]  __skb_checksum_complete+0xcf/0xe0
> [  405.740120]  nf_ip_checksum+0xc8/0xf0
> [  405.740124]  icmp_error+0x1de/0x351 [nf_conntrack_ipv4]
> [  405.740132]  nf_conntrack_in+0xe1/0x550 [nf_conntrack]
> [  405.740137]  ? find_bucket.isra.2+0x62/0x70 [openvswitch]
> [  405.740143]  __ovs_ct_lookup+0x95/0x980 [openvswitch]
> [  405.740145]  ? netif_rx_internal+0x44/0x110
> [  405.740149]  ovs_ct_execute+0x147/0x4b0 [openvswitch]
> [  405.740153]  do_execute_actions+0x22e/0xa70 [openvswitch]
> [  405.740157]  ovs_execute_actions+0x40/0x120 [openvswitch]
> [  405.740161]  ovs_dp_process_packet+0x84/0x120 [openvswitch]
> [  405.740166]  ovs_vport_receive+0x73/0xd0 [openvswitch]
> [  405.740168]  ? udp_rcv+0x1a/0x20
> [  405.740170]  ? ip_local_deliver_finish+0x93/0x1e0
> [  405.740172]  ? ip_local_deliver+0x6f/0xe0
> [  405.740174]  ? ip_rcv_finish+0x3a0/0x3a0
> [  405.740176]  ? ip_rcv_finish+0xdb/0x3a0
> [  405.740177]  ? ip_rcv+0x2a7/0x400
> [  405.740180]  ? __netif_receive_skb_core+0x970/0xa00
> [  405.740185]  netdev_frame_hook+0xd3/0x160 [openvswitch]
> [  405.740187]  __netif_receive_skb_core+0x1dc/0xa00
> [  405.740194]  ? ixgbe_clean_rx_irq+0x46d/0xa20 [ixgbe]
> [  405.740197]  __netif_receive_skb+0x18/0x60
> [  405.740199]  netif_receive_skb_internal+0x40/0xb0
> [  405.740201]  napi_gro_receive+0xcd/0x120
> [  405.740204]  gro_cell_poll+0x57/0x80 [geneve]
> [  405.740206]  net_rx_action+0x260/0x3c0
> [  405.740209]  __do_softirq+0xc9/0x28c
> [  405.740211]  irq_exit+0xd9/0xf0
> [  405.740213]  do_IRQ+0x51/0xd0
> [  405.740215]  common_interrupt+0x93/0x93
>
> Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
> Signed-off-by: Lance Richardson <lrichard@redhat.com>

Looks good.
Acked-by: Pravin B Shelar <pshelar@ovn.org>

Thanks.

^ permalink raw reply

* Re: [PATCH v5 01/13] net: ethernet: aquantia: Make and configuration files.
From: Florian Fainelli @ 2017-01-14 18:39 UTC (permalink / raw)
  To: Alexander Loktionov, netdev, David VomLehn
  Cc: David S . Miller, Simon Edelhaus, Dmitrii Tarakanov, Pavel Belous,
	Dmitry Bezrukov
In-Reply-To: <fe1664e502d28bcb6a5689787b8000e6c9288307.1484283610.git.vomlehn@texas.net>



On 01/12/2017 09:02 PM, Alexander Loktionov wrote:
> From: David VomLehn <vomlehn@texas.net>
> 
> Patches to create the make and configuration files.
> 
> Signed-off-by: Alexander Loktionov <Alexander.Loktionov@aquantia.com>
> Signed-off-by: Dmitrii Tarakanov <Dmitrii.Tarakanov@aquantia.com>
> Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
> Signed-off-by: Dmitry Bezrukov <Dmitry.Bezrukov@aquantia.com>
> Signed-off-by: David M. VomLehn <vomlehn@texas.net>
> ---
>  drivers/net/ethernet/aquantia/Kconfig  | 24 +++++++++++++++++++
>  drivers/net/ethernet/aquantia/Makefile | 42 ++++++++++++++++++++++++++++++++++
>  drivers/net/ethernet/aquantia/ver.h    | 18 +++++++++++++++
>  3 files changed, 84 insertions(+)
>  create mode 100644 drivers/net/ethernet/aquantia/Kconfig
>  create mode 100644 drivers/net/ethernet/aquantia/Makefile
>  create mode 100644 drivers/net/ethernet/aquantia/ver.h
> 
> diff --git a/drivers/net/ethernet/aquantia/Kconfig b/drivers/net/ethernet/aquantia/Kconfig
> new file mode 100644
> index 0000000..a74a4c0
> --- /dev/null
> +++ b/drivers/net/ethernet/aquantia/Kconfig
> @@ -0,0 +1,24 @@
> +#
> +# aQuantia device configuration
> +#
> +
> +config NET_VENDOR_AQUANTIA
> +	bool "aQuantia devices"
> +	default y
> +	---help---
> +	  Set this to y if you have an Ethernet network cards that uses the aQuantia
> +	  chipset.
> +
> +	  This option does not build any drivers; it casues the aQuantia
> +	  drivers that can be built to appear in the list of Ethernet drivers.
> +
> +
> +if NET_VENDOR_AQUANTIA
> +
> +config AQTION
> +	tristate "aQuantia AQtion Support"
> +	depends on PCI
> +	---help---
> +	  This enables the support for the aQuantia AQtion Ethernet card.
> +
> +endif # NET_VENDOR_AQUANTIA
> diff --git a/drivers/net/ethernet/aquantia/Makefile b/drivers/net/ethernet/aquantia/Makefile
> new file mode 100644
> index 0000000..e4ae696
> --- /dev/null
> +++ b/drivers/net/ethernet/aquantia/Makefile
> @@ -0,0 +1,42 @@
> +################################################################################
> +#
> +# aQuantia Ethernet Controller AQtion Linux Driver
> +# Copyright(c) 2014-2017 aQuantia Corporation.
> +#
> +# This program is free software; you can redistribute it and/or modify it
> +# under the terms and conditions of the GNU General Public License,
> +# version 2, as published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope it will be useful, but WITHOUT
> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> +# more details.
> +#
> +# You should have received a copy of the GNU General Public License along
> +# with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +# The full GNU General Public License is included in this distribution in
> +# the file called "COPYING".
> +#
> +# Contact Information: <rdc-drv@aquantia.com>
> +# aQuantia Corporation, 105 E. Tasman Dr. San Jose, CA 95134, USA
> +#
> +################################################################################
> +
> +#
> +# Makefile for the AQtion(tm) Ethernet driver
> +#
> +
> +obj-$(CONFIG_AQTION) += atlantic.o
> +
> +atlantic-objs := aq_main.o \
> +	aq_nic.o \
> +	aq_pci_func.o \
> +	aq_vec.o \
> +	aq_ring.o \
> +	aq_hw_utils.o \
> +	aq_ethtool.o \
> +	hw_atl/hw_atl_a0.o \
> +	hw_atl/hw_atl_b0.o \
> +	hw_atl/hw_atl_utils.o \
> +	hw_atl/hw_atl_llh.o

You might want to create an aqtion or atlantic folder just in case you
later on submit a driver for another aquantia NIC. That would keep the
directory structure clean.
-- 
Florian

^ permalink raw reply

* Re: [PATCH] net: add regs attribute to phy device for user diagnose
From: Florian Fainelli @ 2017-01-14 18:35 UTC (permalink / raw)
  To: Andrew Lunn, yuan linyu; +Cc: David S . Miller, netdev, yuan linyu
In-Reply-To: <20170114162453.GB1072@lunn.ch>

On 01/14/2017 08:24 AM, Andrew Lunn wrote:
> On Sat, Jan 14, 2017 at 10:46:31AM +0800, yuan linyu wrote:
>> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
>>
>> if phy device have register(s) configuration problem,
>> user can use this attribute to diagnose.
>> this feature need phy driver maintainer implement.
> 
> what is wrong with mii-tool -vv ?

Agreed, and without an actual user of this API (ethtool?), nor a PHY
driver implementing it, we cannot quite see how you want to make use of
this.

Thank you
-- 
Florian

^ permalink raw reply

* Re: [PATCH] net: korina: use new api ethtool_{get|set}_link_ksettings
From: Florian Fainelli @ 2017-01-14 18:34 UTC (permalink / raw)
  To: Philippe Reynes, davem, mugunthanvnm, a, fw, jarod; +Cc: netdev, linux-kernel
In-Reply-To: <1484393599-1547-1-git-send-email-tremyfr@gmail.com>

On 01/14/2017 03:33 AM, Philippe Reynes wrote:
> The ethtool api {get|set}_settings is deprecated.
> We move this driver to new api {get|set}_link_ksettings.
> 
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next] net/sched: cls_flower: Add user specified data
From: Jamal Hadi Salim @ 2017-01-14 17:46 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: John Fastabend, Paul Blakey, David S. Miller, netdev, Jiri Pirko,
	Hadar Hen Zion, Or Gerlitz, Roi Dayan, Roman Mashak, Simon Horman
In-Reply-To: <20170114152918.GC1886@nanopsycho.orion>

On 17-01-14 10:29 AM, Jiri Pirko wrote:
> Sat, Jan 14, 2017 at 04:03:17PM CET, jhs@mojatatu.com wrote:

> Fair. So could this be done like IFLA_PHYS_SWITCH_ID and
> IFLA_PHYS_PORT_ID. They can have variable size, max is MAX_PHYS_ITEM_ID_LEN
>
> We can let user to pass arbitrary len up to 16 bytes. This has benefit in
> fact that if in future this needs to be extended to say 32 bytes, it is
> backward compatible. We just change the check in kernel.
>

Sure. Ive run out of time for now; but will work on a new version later.

cheers,
jamal

^ permalink raw reply

* Re: [pull request][for-next] Mellanox mlx5 Reorganize core driver directory layout
From: Tom Herbert @ 2017-01-14 17:37 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Leon Romanovsky, David Miller, Saeed Mahameed, Doug Ledford,
	Linux Kernel Network Developers,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CALzJLG_RsvgszVxGZ7+VgYjET9w=XTjq36Z72diOQFNJWz9tQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, Jan 13, 2017 at 2:45 PM, Saeed Mahameed
<saeedm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote:
> On Sat, Jan 14, 2017 at 12:06 AM, Tom Herbert <tom-BjP2VixgY4xUbtYUoyoikg@public.gmane.org> wrote:
>> On Fri, Jan 13, 2017 at 12:29 PM, Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>>> On Fri, Jan 13, 2017 at 12:14:07PM -0500, David Miller wrote:
>>>> From: Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>>>> Date: Thu, 12 Jan 2017 19:22:34 +0200
>>>>
>>>> > This pull request includes one patch from Leon, this patch as described
>>>> > below will change the driver directory structure and layout for better,
>>>> > logical and modular driver files separation.
>>>> >
>>>> > This change is important to both rdma and net maintainers in order to
>>>> > have smoother management of driver patches for different mlx5 sub modules
>>>> > and smoother rdma-next vs. net-next features submissions.
>>>> >
>>>> > Please find more info below -in the tag commit message-,
>>>> > review and let us know if there's any problem.
>>>> >
>>>> > This change doesn't introduce any conflicts with the current mlx5
>>>> > fixes and cleanups posted on 2017-01-10 to net branch, and merge tests
>>>> > worked flawlessly with no issues.
>>>> >
>>>> > This is the last pull request meant for both rdma-next and net-next.
>>>> > Once pulled, this will be the base shared code for both trees.
>>>>
>>>> This is pretty crazy, it will make all bug fix backporting to -stable
>>>> a complete nightmare for myself, Doug, various distribution maintainers
>>>> and many other people who quietly have to maintain their own trees and
>>>> do backporting.
>>>
>>> Hi Dave,
>>>
>>> I understand your worries, but our case is similar to various other
>>> drivers, for example hfi1 which was in staging for years while
>>> supported in RedHat and moved from there to IB. The Chelsio drivers did
>>> similar reorg in 2016 (drivers/net/ethernet/chelsio/libcxgb) while their
>>> drivers were in the tree for long time before.
>>>
>>> Additionally, Doug doesn't need to maintain -stable queue and it is done
>>> by relevant submaintainers who are adding stable tags by themselves. In
>>> the IB case, the burden will continue to be on me and not on Doug.
>>>
>> Recently I had to backport the mlx5 driver from 4.9 to 4.6 in order to
>> get support for XDP. The biggest issue I faced was the lack of
>> modularity in the many driver features that are now supported. The
>> problem with backporting these new features is the spider web of
>> dependencies that they bring in from the rest of the kernel. I ended
>> up taking out en_rep, vxlan, en_tc, eswitch, and dcbnl. The result was
>> ~340 patches which is still a lot but at least this was constrained to
>> patches in the mlx5 directories and are relevant to what we want to
>> do.
>>
>> In lieu of restructuring the directories, I would much rather see more
>> config options so that we can build drivers that don't unnecessarily
>> complicate our lives with features we don't use. This is not just true
>> for Mellanox, but I would say it would be true of any driver that
>> someone is trying to deploy and maintain at large scale.
>>
>
> I think we should have both, if the restructuring made right,
> new whole features (e.g eswitch and eswitch offlaods or any independent module),
> can sit in their own directory and keep their own logic concentrated
> in one place, and only touch the
> main driver code with simple entry points in the main flow,  this way
> you can simply compile their whole directories
> out with a config flag directly from the Makefile.
>
That would be nice, but that is not what your new layout gives us yet.
The starting point for this structure should be to discern what the
minimum set of files is to build a functional and good performance
driver with the basic functionality including only the most common
offloads. These I would think constitute the core files for the driver
and hence make sense to be in the "core" directory. Personally I would
drop the en_ file prefix and not make an en directory, we're already
in the ethernet driver part of the tree so I don't know what this name
is supposed to convey. For reference I gave you this list of
components I disabled to do the backport, some we're not split out in
your directory layout. A good example is the VXLAN offload support,
the changes in that area we're mostly due to Alexander's patch set to
redo the interface for these accelerations-- so to back port driver
from 4.9 to 4.6 I would need to pull those in and whatever else those
depend on. It was way easier to just ifdef out the relevant calls and
not compile the vxlan files to do the backport.

Tom

>> Btw, we did hit one issue in the backport. We started to get rx csum
>> faults (checksum complete value indicates TCP checksum is bad, but
>> host computation says checksum is good). I ran against 4.9 upstream
>> kernel and do see these, however don't see them in 4.10. I haven't
>> bisected yet. Is this a known issue?
>>
>
> Not to me, I don't recall any csum related fixes or feature submitted
> lately to mlx5,
> Maybe something changed in the stack ?
>
> what configuration are you running ? what traffic ?
>
>> Thanks,
>> Tom
>>
>>>>
>>>> I really don't think you can justify this rearrangement based upon the
>>>> consequences and how much activity happens in this driver.
>>>>
>>>> You should have thought long and hard about the layout a long time ago
>>>> rather than after the driver has been in the tree for many years.
>>>>
>>>> Sorry.
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb
From: Eric Dumazet @ 2017-01-14 17:30 UTC (permalink / raw)
  To: Oliver Hartkopp
  Cc: Liu Shuo, linux-kernel, yanmin_zhang, shuox.liu, Zhang Yanmin,
	He, Bo, Marc Kleine-Budde, David S. Miller,
	open list:CAN NETWORK LAYER, open list:NETWORKING [GENERAL]
In-Reply-To: <6dc1d111-9aa4-5771-0283-6408567e47c2@hartkopp.net>

On Sat, 2017-01-14 at 14:53 +0100, Oliver Hartkopp wrote:
> Hello Eric,
> 
> On 01/14/2017 04:43 AM, Liu Shuo wrote:
> > On Thu 12.Jan'17 at 17:33:38 +0100, Oliver Hartkopp wrote:
> >> On 01/12/2017 02:01 PM, Eric Dumazet wrote:
> 
> >>> The main problem seems that the sockets themselves are not RCU
> >>> protected.
> >>>
> >>> If CAN uses RCU for delivery, then sockets should be freed only after
> >>> one RCU grace period.
> >>>
> >>> On recent kernels, following patch could help :
> >>>
> >>
> >> Thanks Eric!
> >>
> >> @Liu ShuoX: Can you check if Eric's suggestion fixes the issue in your
> >> setup?
> > Sorry for late reply. I was OOO yesterday.
> > With Eric's hint, i just found his patch that "net: add SOCK_RCU_FREE
> > socket flag" in the latest kernel. With backporting this one plus Eric's
> > following patch, it fixs my failure.
> 
> what would be the best approach to fix this issue - even in stable kernels?
> 
> E.g. would this change be ok for a stable as a quick fix?
> 
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index 1108079d934f..6b974c2b66ef 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -112,6 +112,7 @@ EXPORT_SYMBOL(can_ioctl);
> 
>   static void can_sock_destruct(struct sock *sk)
>   {
> +       synchronize_rcu();
>          skb_queue_purge(&sk->sk_receive_queue);
>   }

Adding a synchronize_rcu() at socket close time might have side effects,
if say an application had 1000 such sockets and dies.

This might add 20 seconds of exit time and have serious implications.

I will submit the second patch : It is working for all linux versions.

> 
> And once this arrived in the mainline tree your suggested patch could be 
> applied?
> 
> In any case we should not forget to give Reported-by credits to Liu.

Sure



^ permalink raw reply

* Re: pull-request: mac80211-next 2017-01-13
From: David Miller @ 2017-01-14 17:04 UTC (permalink / raw)
  To: johannes-cdvu00un1VgdHxzADdlk8Q
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20170113102933.8246-1-johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>

From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
Date: Fri, 13 Jan 2017 11:29:32 +0100

> This is my first pull request for net-next, and it seems a bit
> bigger than the past few releases. Detailed information below,
> as usual.
> 
> Please pull and let me know if there's any problem.

Pulled, thanks Johannes.

^ permalink raw reply

* Re: [PATCH] cxgb4: Remove redundant memset before memcpy
From: David Miller @ 2017-01-14 17:00 UTC (permalink / raw)
  To: mayhs11saini; +Cc: hariprasad, tklauser, netdev, linux-kernel
In-Reply-To: <1484356660-19082-1-git-send-email-mayhs11saini@gmail.com>

From: Shyam Saini <mayhs11saini@gmail.com>
Date: Sat, 14 Jan 2017 06:47:40 +0530

> The region set by the call to memset, immediately overwritten by
> the subsequent call to memcpy and thus makes the  memset redundant.
> 
> Also remove the memset((&info, 0, sizeof(info)) on line 398 because
> info is memcpy()'ed to before being used in the loop and it isn't
> used outside of the loop.
> 
> Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>

Applied to net-next, thanks.

^ permalink raw reply

* Re: [PATCH v3 1/2] bpf: add a longest prefix match trie map implementation
From: Alexei Starovoitov @ 2017-01-14 16:55 UTC (permalink / raw)
  To: Daniel Mack; +Cc: dh.herrmann, daniel, netdev, davem
In-Reply-To: <20170114121727.14784-2-daniel@zonque.org>

On 1/14/17 4:17 AM, Daniel Mack wrote:
> +static struct bpf_map *trie_alloc(union bpf_attr *attr)
> +{
> +	size_t cost, cost_per_node;
> +	struct lpm_trie *trie;
> +	int ret;
> +
> +	/* check sanity of attributes */
> +	if (attr->max_entries == 0 ||
> +	    attr->map_flags != BPF_F_NO_PREALLOC ||
> +	    attr->key_size < sizeof(struct bpf_lpm_trie_key) + 1   ||
> +	    attr->key_size > sizeof(struct bpf_lpm_trie_key) + 256 ||
> +	    attr->value_size == 0)
> +		return ERR_PTR(-EINVAL);

could you also make it root only for now ?
Like we did for lru map:
         if (lru && !capable(CAP_SYS_ADMIN))
                 /* LRU implementation is much complicated than other
                  * maps.  Hence, limit to CAP_SYS_ADMIN for now.
                  */
                 return ERR_PTR(-EPERM);

trie is not that complicated, but I think socket_filters
(the only unpriv prog type today) can live a release or
two without ability to use it.

In patch 2/2 there are some comments not in networking style:
+	/*
+	 * Perform longest prefix-match on @key/@n_bits. That is,

As far as performance it has to be measured from datapath.
Like create tc+cls_bpf prog that does a dozen of trie lookups,
attach it to veth or tap and use
samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
to send traffic into it.
Like: samples/bpf/test_cls_bpf.sh does.

Another alternative is to extend samples/bpf/map_perf_test
It has perf tests for most map types today (including lru)
and trie would be natural addition there.
I would prefer this latter option.

Thanks!

^ permalink raw reply

* (unknown), 
From: pooks005 @ 2017-01-14 16:34 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: EMAIL_25645_netdev.zip --]
[-- Type: application/zip, Size: 45410 bytes --]

^ permalink raw reply

* Re: [PATCH] net: add regs attribute to phy device for user diagnose
From: Andrew Lunn @ 2017-01-14 16:24 UTC (permalink / raw)
  To: yuan linyu; +Cc: Florian Fainelli, David S . Miller, netdev, yuan linyu
In-Reply-To: <1484361992-30591-1-git-send-email-cugyly@163.com>

On Sat, Jan 14, 2017 at 10:46:31AM +0800, yuan linyu wrote:
> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> 
> if phy device have register(s) configuration problem,
> user can use this attribute to diagnose.
> this feature need phy driver maintainer implement.

what is wrong with mii-tool -vv ?

     Andrew

^ permalink raw reply

* Re: [PATCH net-next 1/1] net sched actions: Add support for user cookies
From: Jiri Pirko @ 2017-01-14 15:49 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: davem, netdev, jiri, paulb, john.fastabend, simon.horman, mrv,
	hadarh, ogerlitz, roid, xiyou.wangcong, daniel, Jamal Hadi Salim
In-Reply-To: <09bf24f3-7080-341d-a332-a2042e7fc34b@mojatatu.com>

Sat, Jan 14, 2017 at 04:39:24PM CET, jhs@mojatatu.com wrote:
>On 17-01-14 10:22 AM, Jiri Pirko wrote:
>
>> > .. create an accept action with cookie 0xA:0xa0a0a0a0a0a0a0
>> > sudo $TC actions add action ok index 1 cookie 0xA 0xa0a0a0a0a0a0a0
>> 
>> 2x 64bit values? Why can't this have variable length, according to what
>> user needs:
>
>
>You can intepret it however you wish. It is 128 bits. You can make it
>2x64, 4x32, 8x16, 16x8
>
>> 
>> sudo $TC actions add action ok index 1 cookie a0
>> sudo $TC actions add action ok index 1 cookie a01122
>> sudo $TC actions add action ok index 1 cookie a01122334455
>> sudo $TC actions add action ok index 1 cookie a01122334455aabbccddeeff
>> 
>
>Sure you can do that too..
>I will add add 16 8b fields to the union.
>
>
>> > 
>> > .. dump all gact actions..
>> > sudo $TC -s actions ls action gact
>> > 
>> > 	action order 0: gact action pass
>> > 	 random type none pass val 0
>> > 	 index 1 ref 2 bind 1 installed 1221 sec used 27 sec
>> > 	Action statistics:
>> > 	Sent 373248 bytes 5056 pkt (dropped 0, overlimits 0 requeues 0)
>> > 	backlog 0b 0p requeues 0
>> > 	 cookie(0000000a:00000000:a0a0a0a0:00a0a0a0)
>> 
>> Input is 2x64 and dump is 4x32? That is confusing. With my suggested
>> example, this would be:
>> 
>> 	 cookie a0
>> 	 cookie a01122
>> 	 cookie a01122334455
>> 	 cookie a01122334455aabbccddeeff
>> 
>
>Your suggestion is more sensible for a user space cli tool like tc.
>I will add a uchar cku8[16] field and make changes to iproute2.
>
>> > struct tc_action_ops;
>> > 
>> > +union act_cookie {
>> > +	u16 ck16[8];
>> > +	u32 ck32[4];
>> > +	u64 ck64[2];
>> 
>> Since this should be never interpreted by kernel, I don't understand why
>> this union is needed. Why just don't pass a char array?
>> 
>
>programmatic usability.

I don't see why. In userspace you can map whatever struct you need to the
mem with chararray. It's totally up to you as an app developer. There is
no need to make that part of kernel api. Really.


>
>> Also, whatever format this is, could we make is shared with cls cookie?
>> 
>> 
>
>The structure could be shared (and because it is in pkt_cls.h
>that makes it easier). But the TLVs are domain specific. We need another
>one for classifiers.
>
>> > +};
>> > +
>> > struct tc_action {
>> > 	const struct tc_action_ops	*ops;
>> > 	__u32				type; /* for backward compat(TCA_OLD_COMPAT) */
>> > @@ -41,6 +47,7 @@ struct tc_action {
>> > 	struct rcu_head			tcfa_rcu;
>> > 	struct gnet_stats_basic_cpu __percpu *cpu_bstats;
>> > 	struct gnet_stats_queue __percpu *cpu_qstats;
>> > +	union act_cookie	*ck;
>> > };
>> > #define tcf_head	common.tcfa_head
>> > #define tcf_index	common.tcfa_index
>> > diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
>> > index 1e5e1dd..6379af3 100644
>> > --- a/include/uapi/linux/pkt_cls.h
>> > +++ b/include/uapi/linux/pkt_cls.h
>> > @@ -4,6 +4,12 @@
>> > #include <linux/types.h>
>> > #include <linux/pkt_sched.h>
>> > 
>> > +union u_act_cookie {
>> > +	__u16 ck16[8];
>> > +	__u32 ck32[4];
>> > +	__u64 ck64[2];
>> > +};
>> 
>> Again, the same struct? I don't understand why twice.
>
>Just old habits.
>user vs kernel api? Standard action approach one says
>__u32 other says u32; hanging off the user variant to kernel
>didnt feel right.

Just have it in uapi and use it from within kernel. But did you see what
I suggested in the other thread (regarding IFLA_PHYS_PORT_ID and
IFLA_PHYS_SWITCH_ID)? If you do it what way, you don't need no struct.

^ permalink raw reply

* Re: [PATCH net-next 1/1] net sched actions: Add support for user cookies
From: Jamal Hadi Salim @ 2017-01-14 15:39 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: davem, netdev, jiri, paulb, john.fastabend, simon.horman, mrv,
	hadarh, ogerlitz, roid, xiyou.wangcong, daniel, Jamal Hadi Salim
In-Reply-To: <20170114152248.GB1886@nanopsycho.orion>

On 17-01-14 10:22 AM, Jiri Pirko wrote:

>> .. create an accept action with cookie 0xA:0xa0a0a0a0a0a0a0
>> sudo $TC actions add action ok index 1 cookie 0xA 0xa0a0a0a0a0a0a0
>
> 2x 64bit values? Why can't this have variable length, according to what
> user needs:


You can intepret it however you wish. It is 128 bits. You can make it
2x64, 4x32, 8x16, 16x8

>
> sudo $TC actions add action ok index 1 cookie a0
> sudo $TC actions add action ok index 1 cookie a01122
> sudo $TC actions add action ok index 1 cookie a01122334455
> sudo $TC actions add action ok index 1 cookie a01122334455aabbccddeeff
>

Sure you can do that too..
I will add add 16 8b fields to the union.


>>
>> .. dump all gact actions..
>> sudo $TC -s actions ls action gact
>>
>> 	action order 0: gact action pass
>> 	 random type none pass val 0
>> 	 index 1 ref 2 bind 1 installed 1221 sec used 27 sec
>> 	Action statistics:
>> 	Sent 373248 bytes 5056 pkt (dropped 0, overlimits 0 requeues 0)
>> 	backlog 0b 0p requeues 0
>> 	 cookie(0000000a:00000000:a0a0a0a0:00a0a0a0)
>
> Input is 2x64 and dump is 4x32? That is confusing. With my suggested
> example, this would be:
>
> 	 cookie a0
> 	 cookie a01122
> 	 cookie a01122334455
> 	 cookie a01122334455aabbccddeeff
>

Your suggestion is more sensible for a user space cli tool like tc.
I will add a uchar cku8[16] field and make changes to iproute2.

>> struct tc_action_ops;
>>
>> +union act_cookie {
>> +	u16 ck16[8];
>> +	u32 ck32[4];
>> +	u64 ck64[2];
>
> Since this should be never interpreted by kernel, I don't understand why
> this union is needed. Why just don't pass a char array?
>

programmatic usability.

> Also, whatever format this is, could we make is shared with cls cookie?
>
>

The structure could be shared (and because it is in pkt_cls.h
that makes it easier). But the TLVs are domain specific. We need another
one for classifiers.

>> +};
>> +
>> struct tc_action {
>> 	const struct tc_action_ops	*ops;
>> 	__u32				type; /* for backward compat(TCA_OLD_COMPAT) */
>> @@ -41,6 +47,7 @@ struct tc_action {
>> 	struct rcu_head			tcfa_rcu;
>> 	struct gnet_stats_basic_cpu __percpu *cpu_bstats;
>> 	struct gnet_stats_queue __percpu *cpu_qstats;
>> +	union act_cookie	*ck;
>> };
>> #define tcf_head	common.tcfa_head
>> #define tcf_index	common.tcfa_index
>> diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
>> index 1e5e1dd..6379af3 100644
>> --- a/include/uapi/linux/pkt_cls.h
>> +++ b/include/uapi/linux/pkt_cls.h
>> @@ -4,6 +4,12 @@
>> #include <linux/types.h>
>> #include <linux/pkt_sched.h>
>>
>> +union u_act_cookie {
>> +	__u16 ck16[8];
>> +	__u32 ck32[4];
>> +	__u64 ck64[2];
>> +};
>
> Again, the same struct? I don't understand why twice.

Just old habits.
user vs kernel api? Standard action approach one says
__u32 other says u32; hanging off the user variant to kernel
didnt feel right.

cheers,
jamal

^ permalink raw reply

* Re: [PATCH net-next] net/sched: cls_flower: Add user specified data
From: Jiri Pirko @ 2017-01-14 15:29 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: John Fastabend, Paul Blakey, David S. Miller, netdev, Jiri Pirko,
	Hadar Hen Zion, Or Gerlitz, Roi Dayan, Roman Mashak, Simon Horman
In-Reply-To: <de59c019-8a7d-6747-ddc1-9a21f40d3e04@mojatatu.com>

Sat, Jan 14, 2017 at 04:03:17PM CET, jhs@mojatatu.com wrote:
>On 17-01-14 09:48 AM, Jiri Pirko wrote:
>> Sat, Jan 14, 2017 at 01:56:35PM CET, jhs@mojatatu.com wrote:
>
>
>> > I think the feature makes a lot of sense (as is the action variant).
>> > But can we make it:
>> > a) fixed size
>> 
>> Can you elaborate on why is this needed?
>> 
>
>My experience with the action bits its easier to debug
>and enforces some discipline to not abuse the amount of RAM used.
>If you have 1M rules, one extra 128M is easier on the system than
>a few Gigs.

Fair. So could this be done like IFLA_PHYS_SWITCH_ID and
IFLA_PHYS_PORT_ID. They can have variable size, max is MAX_PHYS_ITEM_ID_LEN

We can let user to pass arbitrary len up to 16 bytes. This has benefit in
fact that if in future this needs to be extended to say 32 bytes, it is
backward compatible. We just change the check in kernel.


>
>> 
>> > b) apply to all classifiers
>> > c) please post a usage example via iproute2/tc
>> > 
>> > I am going to post the action variant in the next while - will do some more
>> > testing first.
>> 
>> I believe we have to make the cls and ats cookies exactly the same.
>> 
>
>Probably - they are both needed. See the patch I just posted.
>
>cheers,
>jamal
>

^ permalink raw reply

* Re: [PATCH net-next 1/1] net sched actions: Add support for user cookies
From: Jiri Pirko @ 2017-01-14 15:22 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: davem, netdev, jiri, paulb, john.fastabend, simon.horman, mrv,
	hadarh, ogerlitz, roid, xiyou.wangcong, daniel, Jamal Hadi Salim
In-Reply-To: <1484405958-24591-1-git-send-email-jhs@emojatatu.com>

Sat, Jan 14, 2017 at 03:59:18PM CET, jhs@mojatatu.com wrote:
>From: Jamal Hadi Salim <hadi@mojatatu.com>
>
>Introduce optional 128-bit action cookie.
>Like all other cookie schemes in the networking world (eg in protocols
>like http or existing kernel fib protocol field, etc) the idea is to save
>user state that when retrieved serves as a correlator. The kernel
>_should not_ intepret it.  The user can store whatever they wish in the
>128 bits.
>
>Sample exercise(using two 64bit values to represent the 128 bits):
>
>.. create an accept action with cookie 0xA:0xa0a0a0a0a0a0a0
>sudo $TC actions add action ok index 1 cookie 0xA 0xa0a0a0a0a0a0a0

2x 64bit values? Why can't this have variable length, according to what
user needs:

sudo $TC actions add action ok index 1 cookie a0
sudo $TC actions add action ok index 1 cookie a01122
sudo $TC actions add action ok index 1 cookie a01122334455
sudo $TC actions add action ok index 1 cookie a01122334455aabbccddeeff


>
>.. dump all gact actions..
>sudo $TC -s actions ls action gact
>
>	action order 0: gact action pass
>	 random type none pass val 0
>	 index 1 ref 2 bind 1 installed 1221 sec used 27 sec
> 	Action statistics:
>	Sent 373248 bytes 5056 pkt (dropped 0, overlimits 0 requeues 0)
>	backlog 0b 0p requeues 0
>	 cookie(0000000a:00000000:a0a0a0a0:00a0a0a0)

Input is 2x64 and dump is 4x32? That is confusing. With my suggested
example, this would be:

	 cookie a0
	 cookie a01122
	 cookie a01122334455
	 cookie a01122334455aabbccddeeff


>
>.. bind the accept action to a filter..
>sudo $TC filter add dev lo parent ffff: protocol ip prio 1 \
>u32 match ip dst 127.0.0.1/32 flowid 1:1 action gact index 1
>
>... send some traffic..
>$ ping 127.0.0.1 -c 3
>PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
>64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.020 ms
>64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.027 ms
>64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.038 ms
>
>--- 127.0.0.1 ping statistics ---
>3 packets transmitted, 3 received, 0% packet loss, time 2109ms
>rtt min/avg/max/mdev = 0.020/0.028/0.038/0.008 ms 1
>
>... show some stats
>$ sudo $TC -s actions get  action gact index 1
>
>	action order 1: gact action pass
>	 random type none pass val 0
>	 index 1 ref 3 bind 1 installed 2182 sec used 1 sec
> 	Action statistics:
>	Sent 700344 bytes 9486 pkt (dropped 0, overlimits 0 requeues 0)
>	backlog 0b 0p requeues 0
>
>Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
>---
> include/net/act_api.h        |  7 +++++++
> include/uapi/linux/pkt_cls.h |  7 +++++++
> net/sched/act_api.c          | 27 +++++++++++++++++++++++++--
> 3 files changed, 39 insertions(+), 2 deletions(-)
>
>diff --git a/include/net/act_api.h b/include/net/act_api.h
>index 1d71644..b948db9 100644
>--- a/include/net/act_api.h
>+++ b/include/net/act_api.h
>@@ -20,6 +20,12 @@ struct tcf_hashinfo {
> 
> struct tc_action_ops;
> 
>+union act_cookie {
>+	u16 ck16[8];
>+	u32 ck32[4];
>+	u64 ck64[2];

Since this should be never interpreted by kernel, I don't understand why
this union is needed. Why just don't pass a char array?

Also, whatever format this is, could we make is shared with cls cookie?


>+};
>+
> struct tc_action {
> 	const struct tc_action_ops	*ops;
> 	__u32				type; /* for backward compat(TCA_OLD_COMPAT) */
>@@ -41,6 +47,7 @@ struct tc_action {
> 	struct rcu_head			tcfa_rcu;
> 	struct gnet_stats_basic_cpu __percpu *cpu_bstats;
> 	struct gnet_stats_queue __percpu *cpu_qstats;
>+	union act_cookie	*ck;
> };
> #define tcf_head	common.tcfa_head
> #define tcf_index	common.tcfa_index
>diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
>index 1e5e1dd..6379af3 100644
>--- a/include/uapi/linux/pkt_cls.h
>+++ b/include/uapi/linux/pkt_cls.h
>@@ -4,6 +4,12 @@
> #include <linux/types.h>
> #include <linux/pkt_sched.h>
> 
>+union u_act_cookie {
>+	__u16 ck16[8];
>+	__u32 ck32[4];
>+	__u64 ck64[2];
>+};

Again, the same struct? I don't understand why twice.


>+
> /* Action attributes */
> enum {
> 	TCA_ACT_UNSPEC,
>@@ -12,6 +18,7 @@ enum {
> 	TCA_ACT_INDEX,
> 	TCA_ACT_STATS,
> 	TCA_ACT_PAD,
>+	TCA_ACT_COOKIE,
> 	__TCA_ACT_MAX
> };
> 
>diff --git a/net/sched/act_api.c b/net/sched/act_api.c
>index f04715a..85e77181 100644
>--- a/net/sched/act_api.c
>+++ b/net/sched/act_api.c
>@@ -33,6 +33,7 @@ static void free_tcf(struct rcu_head *head)
> 
> 	free_percpu(p->cpu_bstats);
> 	free_percpu(p->cpu_qstats);
>+	kfree(p->ck);
> 	kfree(p);
> }
> 
>@@ -464,8 +465,8 @@ int tcf_action_destroy(struct list_head *actions, int bind)
> 	return a->ops->dump(skb, a, bind, ref);
> }
> 
>-int
>-tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
>+int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind,
>+		      int ref)
> {
> 	int err = -EINVAL;
> 	unsigned char *b = skb_tail_pointer(skb);
>@@ -475,6 +476,12 @@ int tcf_action_destroy(struct list_head *actions, int bind)
> 		goto nla_put_failure;
> 	if (tcf_action_copy_stats(skb, a, 0))
> 		goto nla_put_failure;
>+	if (a->ck) {
>+		if (nla_put(skb, TCA_ACT_COOKIE, sizeof(union act_cookie),
>+			    a->ck))
>+			goto nla_put_failure;
>+	}
>+
> 	nest = nla_nest_start(skb, TCA_OPTIONS);
> 	if (nest == NULL)
> 		goto nla_put_failure;
>@@ -575,6 +582,22 @@ struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
> 	if (err < 0)
> 		goto err_mod;
> 
>+	if (tb[TCA_ACT_COOKIE]) {
>+		if (nla_len(tb[TCA_ACT_COOKIE]) != sizeof(union act_cookie)) {
>+			err = -EINVAL;
>+			goto err_mod;
>+		}
>+
>+		a->ck = kzalloc(sizeof(union act_cookie), GFP_KERNEL);
>+		if (unlikely(!a->ck)) {
>+			err = -ENOMEM;
>+			goto err_mod;
>+		}
>+
>+		memcpy((void *)a->ck, nla_data(tb[TCA_ACT_COOKIE]),
>+		       sizeof(union act_cookie));
>+	}
>+
> 	/* module count goes up only when brand new policy is created
> 	 * if it exists and is only bound to in a_o->init() then
> 	 * ACT_P_CREATED is not returned (a zero is).
>-- 
>1.9.1
>

^ permalink raw reply

* Re: [PATCH net-next] net/sched: cls_flower: Add user specified data
From: Jamal Hadi Salim @ 2017-01-14 15:03 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: John Fastabend, Paul Blakey, David S. Miller, netdev, Jiri Pirko,
	Hadar Hen Zion, Or Gerlitz, Roi Dayan, Roman Mashak, Simon Horman
In-Reply-To: <20170114144855.GA1886@nanopsycho.orion>

On 17-01-14 09:48 AM, Jiri Pirko wrote:
> Sat, Jan 14, 2017 at 01:56:35PM CET, jhs@mojatatu.com wrote:


>> I think the feature makes a lot of sense (as is the action variant).
>> But can we make it:
>> a) fixed size
>
> Can you elaborate on why is this needed?
>

My experience with the action bits its easier to debug
and enforces some discipline to not abuse the amount of RAM used.
If you have 1M rules, one extra 128M is easier on the system than
a few Gigs.

>
>> b) apply to all classifiers
>> c) please post a usage example via iproute2/tc
>>
>> I am going to post the action variant in the next while - will do some more
>> testing first.
>
> I believe we have to make the cls and ats cookies exactly the same.
>

Probably - they are both needed. See the patch I just posted.

cheers,
jamal

^ permalink raw reply

* [PATCH net-next 1/1] net sched actions: Add support for user cookies
From: Jamal Hadi Salim @ 2017-01-14 14:59 UTC (permalink / raw)
  To: davem
  Cc: netdev, jiri, paulb, john.fastabend, simon.horman, mrv, hadarh,
	ogerlitz, roid, xiyou.wangcong, daniel, Jamal Hadi Salim,
	Jamal Hadi Salim

From: Jamal Hadi Salim <hadi@mojatatu.com>

Introduce optional 128-bit action cookie.
Like all other cookie schemes in the networking world (eg in protocols
like http or existing kernel fib protocol field, etc) the idea is to save
user state that when retrieved serves as a correlator. The kernel
_should not_ intepret it.  The user can store whatever they wish in the
128 bits.

Sample exercise(using two 64bit values to represent the 128 bits):

.. create an accept action with cookie 0xA:0xa0a0a0a0a0a0a0
sudo $TC actions add action ok index 1 cookie 0xA 0xa0a0a0a0a0a0a0

.. dump all gact actions..
sudo $TC -s actions ls action gact

	action order 0: gact action pass
	 random type none pass val 0
	 index 1 ref 2 bind 1 installed 1221 sec used 27 sec
 	Action statistics:
	Sent 373248 bytes 5056 pkt (dropped 0, overlimits 0 requeues 0)
	backlog 0b 0p requeues 0
	 cookie(0000000a:00000000:a0a0a0a0:00a0a0a0)

.. bind the accept action to a filter..
sudo $TC filter add dev lo parent ffff: protocol ip prio 1 \
u32 match ip dst 127.0.0.1/32 flowid 1:1 action gact index 1

... send some traffic..
$ ping 127.0.0.1 -c 3
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.027 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.038 ms

--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2109ms
rtt min/avg/max/mdev = 0.020/0.028/0.038/0.008 ms 1

... show some stats
$ sudo $TC -s actions get  action gact index 1

	action order 1: gact action pass
	 random type none pass val 0
	 index 1 ref 3 bind 1 installed 2182 sec used 1 sec
 	Action statistics:
	Sent 700344 bytes 9486 pkt (dropped 0, overlimits 0 requeues 0)
	backlog 0b 0p requeues 0

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 include/net/act_api.h        |  7 +++++++
 include/uapi/linux/pkt_cls.h |  7 +++++++
 net/sched/act_api.c          | 27 +++++++++++++++++++++++++--
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/include/net/act_api.h b/include/net/act_api.h
index 1d71644..b948db9 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -20,6 +20,12 @@ struct tcf_hashinfo {
 
 struct tc_action_ops;
 
+union act_cookie {
+	u16 ck16[8];
+	u32 ck32[4];
+	u64 ck64[2];
+};
+
 struct tc_action {
 	const struct tc_action_ops	*ops;
 	__u32				type; /* for backward compat(TCA_OLD_COMPAT) */
@@ -41,6 +47,7 @@ struct tc_action {
 	struct rcu_head			tcfa_rcu;
 	struct gnet_stats_basic_cpu __percpu *cpu_bstats;
 	struct gnet_stats_queue __percpu *cpu_qstats;
+	union act_cookie	*ck;
 };
 #define tcf_head	common.tcfa_head
 #define tcf_index	common.tcfa_index
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 1e5e1dd..6379af3 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -4,6 +4,12 @@
 #include <linux/types.h>
 #include <linux/pkt_sched.h>
 
+union u_act_cookie {
+	__u16 ck16[8];
+	__u32 ck32[4];
+	__u64 ck64[2];
+};
+
 /* Action attributes */
 enum {
 	TCA_ACT_UNSPEC,
@@ -12,6 +18,7 @@ enum {
 	TCA_ACT_INDEX,
 	TCA_ACT_STATS,
 	TCA_ACT_PAD,
+	TCA_ACT_COOKIE,
 	__TCA_ACT_MAX
 };
 
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index f04715a..85e77181 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -33,6 +33,7 @@ static void free_tcf(struct rcu_head *head)
 
 	free_percpu(p->cpu_bstats);
 	free_percpu(p->cpu_qstats);
+	kfree(p->ck);
 	kfree(p);
 }
 
@@ -464,8 +465,8 @@ int tcf_action_destroy(struct list_head *actions, int bind)
 	return a->ops->dump(skb, a, bind, ref);
 }
 
-int
-tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
+int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind,
+		      int ref)
 {
 	int err = -EINVAL;
 	unsigned char *b = skb_tail_pointer(skb);
@@ -475,6 +476,12 @@ int tcf_action_destroy(struct list_head *actions, int bind)
 		goto nla_put_failure;
 	if (tcf_action_copy_stats(skb, a, 0))
 		goto nla_put_failure;
+	if (a->ck) {
+		if (nla_put(skb, TCA_ACT_COOKIE, sizeof(union act_cookie),
+			    a->ck))
+			goto nla_put_failure;
+	}
+
 	nest = nla_nest_start(skb, TCA_OPTIONS);
 	if (nest == NULL)
 		goto nla_put_failure;
@@ -575,6 +582,22 @@ struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
 	if (err < 0)
 		goto err_mod;
 
+	if (tb[TCA_ACT_COOKIE]) {
+		if (nla_len(tb[TCA_ACT_COOKIE]) != sizeof(union act_cookie)) {
+			err = -EINVAL;
+			goto err_mod;
+		}
+
+		a->ck = kzalloc(sizeof(union act_cookie), GFP_KERNEL);
+		if (unlikely(!a->ck)) {
+			err = -ENOMEM;
+			goto err_mod;
+		}
+
+		memcpy((void *)a->ck, nla_data(tb[TCA_ACT_COOKIE]),
+		       sizeof(union act_cookie));
+	}
+
 	/* module count goes up only when brand new policy is created
 	 * if it exists and is only bound to in a_o->init() then
 	 * ACT_P_CREATED is not returned (a zero is).
-- 
1.9.1

^ permalink raw reply related


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