Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] net: phy: marvell: Add Marvell 88E1548P support
From: Florian Fainelli @ 2020-06-19 18:09 UTC (permalink / raw)
  To: Maxim Kochetkov, netdev
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski
In-Reply-To: <20200619084904.95432-4-fido_max@inbox.ru>



On 6/19/2020 1:49 AM, Maxim Kochetkov wrote:
> Add support for this new phy ID.
> 
> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>

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

^ permalink raw reply

* Re: [PATCH 2/3] net: phy: marvell: Add Marvell 88E1340S support
From: Florian Fainelli @ 2020-06-19 18:09 UTC (permalink / raw)
  To: Maxim Kochetkov, netdev
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski
In-Reply-To: <20200619084904.95432-3-fido_max@inbox.ru>



On 6/19/2020 1:49 AM, Maxim Kochetkov wrote:
> Add support for this new phy ID.
> > Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>

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

^ permalink raw reply

* Re: [PATCH 1/3] net: phy: marvell: use a single style for referencing functions
From: Florian Fainelli @ 2020-06-19 18:08 UTC (permalink / raw)
  To: Maxim Kochetkov, netdev
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski
In-Reply-To: <20200619084904.95432-2-fido_max@inbox.ru>



On 6/19/2020 1:49 AM, Maxim Kochetkov wrote:
> The kernel in general does not use &func referencing format.
> 
> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>

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

^ permalink raw reply

* Re: [PATCH RFC v8 02/11] vhost: use batched get_vq_desc version
From: Eugenio Perez Martin @ 2020-06-19 18:07 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Michael S. Tsirkin, linux-kernel, kvm list, virtualization,
	netdev, Jason Wang
In-Reply-To: <CAJaqyWdwXMX0JGhmz6soH2ZLNdaH6HEdpBM8ozZzX9WUu8jGoQ@mail.gmail.com>

On Mon, Jun 15, 2020 at 2:28 PM Eugenio Perez Martin
<eperezma@redhat.com> wrote:
>
> On Thu, Jun 11, 2020 at 5:22 PM Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com> wrote:
> >
> > On Thu, Jun 11, 2020 at 07:34:19AM -0400, Michael S. Tsirkin wrote:
> > > As testing shows no performance change, switch to that now.
> >
> > What kind of testing? 100GiB? Low latency?
> >
>
> Hi Konrad.
>
> I tested this version of the patch:
> https://lkml.org/lkml/2019/10/13/42
>
> It was tested for throughput with DPDK's testpmd (as described in
> http://doc.dpdk.org/guides/howto/virtio_user_as_exceptional_path.html)
> and kernel pktgen. No latency tests were performed by me. Maybe it is
> interesting to perform a latency test or just a different set of tests
> over a recent version.
>
> Thanks!

I have repeated the tests with v9, and results are a little bit different:
* If I test opening it with testpmd, I see no change between versions
* If I forward packets between two vhost-net interfaces in the guest
using a linux bridge in the host:
  - netperf UDP_STREAM shows a performance increase of 1.8, almost
doubling performance. This gets lower as frame size increase.
  - rests of the test goes noticeably worse: UDP_RR goes from ~6347
transactions/sec to 5830
  - TCP_STREAM goes from ~10.7 gbps to ~7Gbps
  - TCP_RR from 6223.64 transactions/sec to 5739.44


^ permalink raw reply

* [PATCH][next] net: dsa: sja1105: Use struct_size() in kzalloc()
From: Gustavo A. R. Silva @ 2020-06-19 18:10 UTC (permalink / raw)
  To: Vladimir Oltean, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S. Miller, Jakub Kicinski
  Cc: linux-kernel, netdev, Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/dsa/sja1105/sja1105_tas.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dsa/sja1105/sja1105_tas.c b/drivers/net/dsa/sja1105/sja1105_tas.c
index 3aa1a8b5f766..31d8acff1f01 100644
--- a/drivers/net/dsa/sja1105/sja1105_tas.c
+++ b/drivers/net/dsa/sja1105/sja1105_tas.c
@@ -475,8 +475,7 @@ bool sja1105_gating_check_conflicts(struct sja1105_private *priv, int port,
 	if (list_empty(&gating_cfg->entries))
 		return false;
 
-	dummy = kzalloc(sizeof(struct tc_taprio_sched_entry) * num_entries +
-			sizeof(struct tc_taprio_qopt_offload), GFP_KERNEL);
+	dummy = kzalloc(struct_size(dummy, entries, num_entries), GFP_KERNEL);
 	if (!dummy) {
 		NL_SET_ERR_MSG_MOD(extack, "Failed to allocate memory");
 		return true;
-- 
2.27.0


^ permalink raw reply related

* [PATCH net 3/3] net: ethtool: sync netdev_features_strings order with enum netdev_features
From: Alexander Lobakin @ 2020-06-19 17:58 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Michal Kubecek, Florian Fainelli, Andrew Lunn, Jiri Pirko,
	Antoine Tenart, Steffen Klassert, Aya Levin, Tom Herbert,
	Alexander Lobakin, netdev, linux-kernel, Alexander Lobakin

The ordering of netdev_features_strings[] makes no sense when it comes
to user interaction, as list of features in `ethtool -k` input is sorted
according to the corresponding bit's position.
Instead, it *does* make sense when it comes to adding new netdev_features
or modifying existing ones. We have at least 2 occasions of forgetting to
add the strings for newly introduced features, and one of them existed
since 3.1x times till now.

Let's keep this stringtable sorted according to bit's position in enum
netdev_features, as this simplifies both reading and modification of the
source code and can help not to miss or forget anything.

Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 net/ethtool/common.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index c8e3fce6e48d..24f35d47832d 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -8,25 +8,25 @@
 const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
 	[NETIF_F_SG_BIT]			= "tx-scatter-gather",
 	[NETIF_F_IP_CSUM_BIT]			= "tx-checksum-ipv4",
+
+	/* __UNUSED_NETIF_F_1 - deprecated */
+
 	[NETIF_F_HW_CSUM_BIT]			= "tx-checksum-ip-generic",
 	[NETIF_F_IPV6_CSUM_BIT]			= "tx-checksum-ipv6",
 	[NETIF_F_HIGHDMA_BIT]			= "highdma",
 	[NETIF_F_FRAGLIST_BIT]			= "tx-scatter-gather-fraglist",
 	[NETIF_F_HW_VLAN_CTAG_TX_BIT]		= "tx-vlan-hw-insert",
-
 	[NETIF_F_HW_VLAN_CTAG_RX_BIT]		= "rx-vlan-hw-parse",
 	[NETIF_F_HW_VLAN_CTAG_FILTER_BIT]	= "rx-vlan-filter",
-	[NETIF_F_HW_VLAN_STAG_TX_BIT]		= "tx-vlan-stag-hw-insert",
-	[NETIF_F_HW_VLAN_STAG_RX_BIT]		= "rx-vlan-stag-hw-parse",
-	[NETIF_F_HW_VLAN_STAG_FILTER_BIT]	= "rx-vlan-stag-filter",
 	[NETIF_F_VLAN_CHALLENGED_BIT]		= "vlan-challenged",
 	[NETIF_F_GSO_BIT]			= "tx-generic-segmentation",
 	[NETIF_F_LLTX_BIT]			= "tx-lockless",
 	[NETIF_F_NETNS_LOCAL_BIT]		= "netns-local",
 	[NETIF_F_GRO_BIT]			= "rx-gro",
-	[NETIF_F_GRO_HW_BIT]			= "rx-gro-hw",
 	[NETIF_F_LRO_BIT]			= "rx-lro",
 
+	/* NETIF_F_GSO_SHIFT = NETIF_F_TSO_BIT */
+
 	[NETIF_F_TSO_BIT]			= "tx-tcp-segmentation",
 	[NETIF_F_GSO_ROBUST_BIT]		= "tx-gso-robust",
 	[NETIF_F_TSO_ECN_BIT]			= "tx-tcp-ecn-segmentation",
@@ -43,9 +43,14 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
 	[NETIF_F_GSO_TUNNEL_REMCSUM_BIT]	= "tx-tunnel-remcsum-segmentation",
 	[NETIF_F_GSO_SCTP_BIT]			= "tx-sctp-segmentation",
 	[NETIF_F_GSO_ESP_BIT]			= "tx-esp-segmentation",
+
+	/* NETIF_F_GSO_UDP_BIT - deprecated */
+
 	[NETIF_F_GSO_UDP_L4_BIT]		= "tx-udp-segmentation",
 	[NETIF_F_GSO_FRAGLIST_BIT]		= "tx-gso-list",
 
+	/* NETIF_F_GSO_LAST = NETIF_F_GSO_FRAGLIST_BIT */
+
 	[NETIF_F_FCOE_CRC_BIT]			= "tx-checksum-fcoe-crc",
 	[NETIF_F_SCTP_CRC_BIT]			= "tx-checksum-sctp",
 	[NETIF_F_FCOE_MTU_BIT]			= "fcoe-mtu",
@@ -56,16 +61,25 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
 	[NETIF_F_LOOPBACK_BIT]			= "loopback",
 	[NETIF_F_RXFCS_BIT]			= "rx-fcs",
 	[NETIF_F_RXALL_BIT]			= "rx-all",
+	[NETIF_F_HW_VLAN_STAG_TX_BIT]		= "tx-vlan-stag-hw-insert",
+	[NETIF_F_HW_VLAN_STAG_RX_BIT]		= "rx-vlan-stag-hw-parse",
+	[NETIF_F_HW_VLAN_STAG_FILTER_BIT]	= "rx-vlan-stag-filter",
 	[NETIF_F_HW_L2FW_DOFFLOAD_BIT]		= "l2-fwd-offload",
+
 	[NETIF_F_HW_TC_BIT]			= "hw-tc-offload",
 	[NETIF_F_HW_ESP_BIT]			= "esp-hw-offload",
 	[NETIF_F_HW_ESP_TX_CSUM_BIT]		= "esp-tx-csum-hw-offload",
 	[NETIF_F_RX_UDP_TUNNEL_PORT_BIT]	= "rx-udp_tunnel-port-offload",
-	[NETIF_F_HW_TLS_RECORD_BIT]		= "tls-hw-record",
 	[NETIF_F_HW_TLS_TX_BIT]			= "tls-hw-tx-offload",
 	[NETIF_F_HW_TLS_RX_BIT]			= "tls-hw-rx-offload",
+
+	[NETIF_F_GRO_HW_BIT]			= "rx-gro-hw",
+	[NETIF_F_HW_TLS_RECORD_BIT]		= "tls-hw-record",
 	[NETIF_F_GRO_FRAGLIST_BIT]		= "rx-gro-list",
+
 	[NETIF_F_HW_MACSEC_BIT]			= "macsec-hw-offload",
+
+	/* NETDEV_FEATURE_COUNT */
 };
 
 const char
-- 
2.27.0


^ permalink raw reply related

* Re: [v2,net-next] net: qos offload add flow status with dropped count
From: Vlad Buslov @ 2020-06-19 18:00 UTC (permalink / raw)
  To: Po Liu
  Cc: davem, linux-kernel, netdev, jiri, vinicius.gomes, vlad,
	claudiu.manoil, vladimir.oltean, alexandru.marginean,
	michael.chan, vishal, saeedm, leon, jiri, idosch,
	alexandre.belloni, UNGLinuxDriver, kuba, jhs, xiyou.wangcong,
	simon.horman, pablo, moshe, m-karicheri2, andre.guedes, stephen
In-Reply-To: <20200619060107.6325-1-po.liu@nxp.com>

On Fri 19 Jun 2020 at 09:01, Po Liu <po.liu@nxp.com> wrote:
> From: Po Liu <Po.Liu@nxp.com>
>
> This patch adds a drop frames counter to tc flower offloading.
> Reporting h/w dropped frames is necessary for some actions.
> Some actions like police action and the coming introduced stream gate
> action would produce dropped frames which is necessary for user. Status
> update shows how many filtered packets increasing and how many dropped
> in those packets.
>
> v2: Changes
>  - Update commit comments suggest by Jiri Pirko.
>
> Signed-off-by: Po Liu <Po.Liu@nxp.com>
> ---

Reviewed-by: Vlad Buslov <vladbu@mellanox.com>

^ permalink raw reply

* Re: [PATCH RFC v8 02/11] vhost: use batched get_vq_desc version
From: Eugenio Perez Martin @ 2020-06-19 17:56 UTC (permalink / raw)
  To: Jason Wang
  Cc: Michael S. Tsirkin, linux-kernel, kvm list, virtualization,
	netdev
In-Reply-To: <0332b0cf-cf00-9216-042c-e870efa33626@redhat.com>

On Wed, Jun 17, 2020 at 5:19 AM Jason Wang <jasowang@redhat.com> wrote:
>
>
> On 2020/6/11 下午7:34, Michael S. Tsirkin wrote:
> >   static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq)
> >   {
> >       kfree(vq->descs);
> > @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
> >       for (i = 0; i < dev->nvqs; ++i) {
> >               vq = dev->vqs[i];
> >               vq->max_descs = dev->iov_limit;
> > +             if (vhost_vq_num_batch_descs(vq) < 0) {
> > +                     return -EINVAL;
> > +             }
>
>
> This check breaks vdpa which set iov_limit to zero. Consider iov_limit
> is meaningless to vDPA, I wonder we can skip the test when device
> doesn't use worker.

I tested as

if (dev->use_worker && vhost_vq_num_batch_descs(vq) < 0)

In v9. Please let me know if that is ok for you.

Thanks!

>
> Thanks
>


^ permalink raw reply

* [PATCH][next] cxgb4: Use struct_size() helper
From: Gustavo A. R. Silva @ 2020-06-19 18:01 UTC (permalink / raw)
  To: Vishal Kulkarni, David S. Miller, Jakub Kicinski
  Cc: netdev, linux-kernel, Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/ethernet/chelsio/cxgb4/sge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 1359158652b7..b3da3d05aa2d 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2431,7 +2431,7 @@ int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
 	struct sk_buff *skb;
 	int ret = 0;
 
-	len = sizeof(*flowc) + sizeof(struct fw_flowc_mnemval) * nparams;
+	len = struct_size(flowc, mnemval, nparams);
 	len16 = DIV_ROUND_UP(len, 16);
 
 	entry = cxgb4_lookup_eotid(&adap->tids, eotid);
-- 
2.27.0


^ permalink raw reply related

* [PATCH][next] ice: Use struct_size() helper
From: Gustavo A. R. Silva @ 2020-06-19 17:56 UTC (permalink / raw)
  To: Jeff Kirsher, David S. Miller, Jakub Kicinski
  Cc: intel-wired-lan, netdev, linux-kernel, Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/ethernet/intel/ice/ice_flex_pipe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
index 4420fc02f7e7..d92c4d70dbcd 100644
--- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
+++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
@@ -1121,8 +1121,7 @@ static enum ice_status ice_get_pkg_info(struct ice_hw *hw)
 	u16 size;
 	u32 i;
 
-	size = sizeof(*pkg_info) + (sizeof(pkg_info->pkg_info[0]) *
-				    (ICE_PKG_CNT - 1));
+	size = struct_size(pkg_info, pkg_info, ICE_PKG_CNT - 1);
 	pkg_info = kzalloc(size, GFP_KERNEL);
 	if (!pkg_info)
 		return ICE_ERR_NO_MEMORY;
-- 
2.27.0


^ permalink raw reply related

* Re: [PATCH] bpf: Allow small structs to be type of function argument
From: John Fastabend @ 2020-06-19 17:44 UTC (permalink / raw)
  To: Yonghong Song, Alexei Starovoitov, John Fastabend
  Cc: Andrii Nakryiko, Jiri Olsa, Andrii Nakryiko, Jiri Olsa,
	Alexei Starovoitov, Daniel Borkmann, Networking, bpf,
	Martin KaFai Lau, Jakub Kicinski, David Miller,
	Jesper Dangaard Brouer, KP Singh, Masanori Misono
In-Reply-To: <4aec5fb8-9f9d-d01b-dd58-f15d50c5e827@fb.com>

Yonghong Song wrote:
> 
> 
> On 6/18/20 7:04 PM, Alexei Starovoitov wrote:
> > On Thu, Jun 18, 2020 at 5:26 PM John Fastabend <john.fastabend@gmail.com> wrote:
> >>
> >>   foo(int a, __int128 b)
> >>
> >> would put a in r0 and b in r2 and r3 leaving a hole in r1. But that
> >> was some old reference manual and  might no longer be the case
> 
> This should not happen if clang compilation with -target bpf.
> This MAY happen if they compile with 'clang -target riscv' as the IR
> could change before coming to bpf backend.

I guess this means in order to handle __int128 and structs in
btf_ctx_access we would have to know this did not happen. Otherwise
the arg to type mappings are off because we simply do

 arg = off / 8

> 
> >> in reality. Perhaps just spreading hearsay, but the point is we
> >> should say something about what the BPF backend convention
> >> is and write it down. We've started to bump into these things
> >> lately.
> > 
> > calling convention for int128 in bpf is _undefined_.
> > calling convention for struct by value in bpf is also _undefined_.
> 
> Just to clarify a little bit. bpf backend did not do anything
> special about int128 and struct type. It is using llvm default.
> That is, int128 using two argument registers and struct passed
> by address. But I do see some other architectures having their
> own ways to handle these parameters like X86, AARCH64, AMDGPU, MIPS.
> 
> int128 is not widely used. passing struct as the argument is not
> a good practice. So Agree with Alexei is not really worthwhile to
> handle them in the place of arguments.

Agree as well I'll just add a small fix to check btf_type_is_int()
size is <= u64 and that should be sufficient to skip handling the
int128 case.

> 
> > 
> > In many cases the compiler has to have the backend code
> > so other parts of the compiler can function.
> > I didn't bother explicitly disabling every undefined case.
> > Please don't read too much into llvm generated code.
> > 



^ permalink raw reply

* [PATCH net 2/3] net: ethtool: fix indentation of netdev_features_strings
From: Alexander Lobakin @ 2020-06-19 17:35 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Michal Kubecek, Florian Fainelli, Andrew Lunn, Jiri Pirko,
	Antoine Tenart, Steffen Klassert, Aya Levin, Tom Herbert,
	Alexander Lobakin, netdev, linux-kernel

The current indentation is an absolute mess of tabs, spaces and their
mixes in different proportions. Convert it all to plain tabs and move
assignment operation char to the right, which is the most commonly
used style in Linux code.

Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 net/ethtool/common.c | 120 +++++++++++++++++++++----------------------
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index aaecfc916a4d..c8e3fce6e48d 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -6,66 +6,66 @@
 #include "common.h"
 
 const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
-	[NETIF_F_SG_BIT] =               "tx-scatter-gather",
-	[NETIF_F_IP_CSUM_BIT] =          "tx-checksum-ipv4",
-	[NETIF_F_HW_CSUM_BIT] =          "tx-checksum-ip-generic",
-	[NETIF_F_IPV6_CSUM_BIT] =        "tx-checksum-ipv6",
-	[NETIF_F_HIGHDMA_BIT] =          "highdma",
-	[NETIF_F_FRAGLIST_BIT] =         "tx-scatter-gather-fraglist",
-	[NETIF_F_HW_VLAN_CTAG_TX_BIT] =  "tx-vlan-hw-insert",
-
-	[NETIF_F_HW_VLAN_CTAG_RX_BIT] =  "rx-vlan-hw-parse",
-	[NETIF_F_HW_VLAN_CTAG_FILTER_BIT] = "rx-vlan-filter",
-	[NETIF_F_HW_VLAN_STAG_TX_BIT] =  "tx-vlan-stag-hw-insert",
-	[NETIF_F_HW_VLAN_STAG_RX_BIT] =  "rx-vlan-stag-hw-parse",
-	[NETIF_F_HW_VLAN_STAG_FILTER_BIT] = "rx-vlan-stag-filter",
-	[NETIF_F_VLAN_CHALLENGED_BIT] =  "vlan-challenged",
-	[NETIF_F_GSO_BIT] =              "tx-generic-segmentation",
-	[NETIF_F_LLTX_BIT] =             "tx-lockless",
-	[NETIF_F_NETNS_LOCAL_BIT] =      "netns-local",
-	[NETIF_F_GRO_BIT] =              "rx-gro",
-	[NETIF_F_GRO_HW_BIT] =           "rx-gro-hw",
-	[NETIF_F_LRO_BIT] =              "rx-lro",
-
-	[NETIF_F_TSO_BIT] =              "tx-tcp-segmentation",
-	[NETIF_F_GSO_ROBUST_BIT] =       "tx-gso-robust",
-	[NETIF_F_TSO_ECN_BIT] =          "tx-tcp-ecn-segmentation",
-	[NETIF_F_TSO_MANGLEID_BIT] =	 "tx-tcp-mangleid-segmentation",
-	[NETIF_F_TSO6_BIT] =             "tx-tcp6-segmentation",
-	[NETIF_F_FSO_BIT] =              "tx-fcoe-segmentation",
-	[NETIF_F_GSO_GRE_BIT] =		 "tx-gre-segmentation",
-	[NETIF_F_GSO_GRE_CSUM_BIT] =	 "tx-gre-csum-segmentation",
-	[NETIF_F_GSO_IPXIP4_BIT] =	 "tx-ipxip4-segmentation",
-	[NETIF_F_GSO_IPXIP6_BIT] =	 "tx-ipxip6-segmentation",
-	[NETIF_F_GSO_UDP_TUNNEL_BIT] =	 "tx-udp_tnl-segmentation",
-	[NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
-	[NETIF_F_GSO_PARTIAL_BIT] =	 "tx-gso-partial",
-	[NETIF_F_GSO_TUNNEL_REMCSUM_BIT] = "tx-tunnel-remcsum-segmentation",
-	[NETIF_F_GSO_SCTP_BIT] =	 "tx-sctp-segmentation",
-	[NETIF_F_GSO_ESP_BIT] =		 "tx-esp-segmentation",
-	[NETIF_F_GSO_UDP_L4_BIT] =	 "tx-udp-segmentation",
-	[NETIF_F_GSO_FRAGLIST_BIT] =	 "tx-gso-list",
-
-	[NETIF_F_FCOE_CRC_BIT] =         "tx-checksum-fcoe-crc",
-	[NETIF_F_SCTP_CRC_BIT] =        "tx-checksum-sctp",
-	[NETIF_F_FCOE_MTU_BIT] =         "fcoe-mtu",
-	[NETIF_F_NTUPLE_BIT] =           "rx-ntuple-filter",
-	[NETIF_F_RXHASH_BIT] =           "rx-hashing",
-	[NETIF_F_RXCSUM_BIT] =           "rx-checksum",
-	[NETIF_F_NOCACHE_COPY_BIT] =     "tx-nocache-copy",
-	[NETIF_F_LOOPBACK_BIT] =         "loopback",
-	[NETIF_F_RXFCS_BIT] =            "rx-fcs",
-	[NETIF_F_RXALL_BIT] =            "rx-all",
-	[NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload",
-	[NETIF_F_HW_TC_BIT] =		 "hw-tc-offload",
-	[NETIF_F_HW_ESP_BIT] =		 "esp-hw-offload",
-	[NETIF_F_HW_ESP_TX_CSUM_BIT] =	 "esp-tx-csum-hw-offload",
-	[NETIF_F_RX_UDP_TUNNEL_PORT_BIT] =	 "rx-udp_tunnel-port-offload",
-	[NETIF_F_HW_TLS_RECORD_BIT] =	"tls-hw-record",
-	[NETIF_F_HW_TLS_TX_BIT] =	 "tls-hw-tx-offload",
-	[NETIF_F_HW_TLS_RX_BIT] =	 "tls-hw-rx-offload",
-	[NETIF_F_GRO_FRAGLIST_BIT] =	 "rx-gro-list",
-	[NETIF_F_HW_MACSEC_BIT] =	 "macsec-hw-offload",
+	[NETIF_F_SG_BIT]			= "tx-scatter-gather",
+	[NETIF_F_IP_CSUM_BIT]			= "tx-checksum-ipv4",
+	[NETIF_F_HW_CSUM_BIT]			= "tx-checksum-ip-generic",
+	[NETIF_F_IPV6_CSUM_BIT]			= "tx-checksum-ipv6",
+	[NETIF_F_HIGHDMA_BIT]			= "highdma",
+	[NETIF_F_FRAGLIST_BIT]			= "tx-scatter-gather-fraglist",
+	[NETIF_F_HW_VLAN_CTAG_TX_BIT]		= "tx-vlan-hw-insert",
+
+	[NETIF_F_HW_VLAN_CTAG_RX_BIT]		= "rx-vlan-hw-parse",
+	[NETIF_F_HW_VLAN_CTAG_FILTER_BIT]	= "rx-vlan-filter",
+	[NETIF_F_HW_VLAN_STAG_TX_BIT]		= "tx-vlan-stag-hw-insert",
+	[NETIF_F_HW_VLAN_STAG_RX_BIT]		= "rx-vlan-stag-hw-parse",
+	[NETIF_F_HW_VLAN_STAG_FILTER_BIT]	= "rx-vlan-stag-filter",
+	[NETIF_F_VLAN_CHALLENGED_BIT]		= "vlan-challenged",
+	[NETIF_F_GSO_BIT]			= "tx-generic-segmentation",
+	[NETIF_F_LLTX_BIT]			= "tx-lockless",
+	[NETIF_F_NETNS_LOCAL_BIT]		= "netns-local",
+	[NETIF_F_GRO_BIT]			= "rx-gro",
+	[NETIF_F_GRO_HW_BIT]			= "rx-gro-hw",
+	[NETIF_F_LRO_BIT]			= "rx-lro",
+
+	[NETIF_F_TSO_BIT]			= "tx-tcp-segmentation",
+	[NETIF_F_GSO_ROBUST_BIT]		= "tx-gso-robust",
+	[NETIF_F_TSO_ECN_BIT]			= "tx-tcp-ecn-segmentation",
+	[NETIF_F_TSO_MANGLEID_BIT]		= "tx-tcp-mangleid-segmentation",
+	[NETIF_F_TSO6_BIT]			= "tx-tcp6-segmentation",
+	[NETIF_F_FSO_BIT]			= "tx-fcoe-segmentation",
+	[NETIF_F_GSO_GRE_BIT]			= "tx-gre-segmentation",
+	[NETIF_F_GSO_GRE_CSUM_BIT]		= "tx-gre-csum-segmentation",
+	[NETIF_F_GSO_IPXIP4_BIT]		= "tx-ipxip4-segmentation",
+	[NETIF_F_GSO_IPXIP6_BIT]		= "tx-ipxip6-segmentation",
+	[NETIF_F_GSO_UDP_TUNNEL_BIT]		= "tx-udp_tnl-segmentation",
+	[NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT]	= "tx-udp_tnl-csum-segmentation",
+	[NETIF_F_GSO_PARTIAL_BIT]		= "tx-gso-partial",
+	[NETIF_F_GSO_TUNNEL_REMCSUM_BIT]	= "tx-tunnel-remcsum-segmentation",
+	[NETIF_F_GSO_SCTP_BIT]			= "tx-sctp-segmentation",
+	[NETIF_F_GSO_ESP_BIT]			= "tx-esp-segmentation",
+	[NETIF_F_GSO_UDP_L4_BIT]		= "tx-udp-segmentation",
+	[NETIF_F_GSO_FRAGLIST_BIT]		= "tx-gso-list",
+
+	[NETIF_F_FCOE_CRC_BIT]			= "tx-checksum-fcoe-crc",
+	[NETIF_F_SCTP_CRC_BIT]			= "tx-checksum-sctp",
+	[NETIF_F_FCOE_MTU_BIT]			= "fcoe-mtu",
+	[NETIF_F_NTUPLE_BIT]			= "rx-ntuple-filter",
+	[NETIF_F_RXHASH_BIT]			= "rx-hashing",
+	[NETIF_F_RXCSUM_BIT]			= "rx-checksum",
+	[NETIF_F_NOCACHE_COPY_BIT]		= "tx-nocache-copy",
+	[NETIF_F_LOOPBACK_BIT]			= "loopback",
+	[NETIF_F_RXFCS_BIT]			= "rx-fcs",
+	[NETIF_F_RXALL_BIT]			= "rx-all",
+	[NETIF_F_HW_L2FW_DOFFLOAD_BIT]		= "l2-fwd-offload",
+	[NETIF_F_HW_TC_BIT]			= "hw-tc-offload",
+	[NETIF_F_HW_ESP_BIT]			= "esp-hw-offload",
+	[NETIF_F_HW_ESP_TX_CSUM_BIT]		= "esp-tx-csum-hw-offload",
+	[NETIF_F_RX_UDP_TUNNEL_PORT_BIT]	= "rx-udp_tunnel-port-offload",
+	[NETIF_F_HW_TLS_RECORD_BIT]		= "tls-hw-record",
+	[NETIF_F_HW_TLS_TX_BIT]			= "tls-hw-tx-offload",
+	[NETIF_F_HW_TLS_RX_BIT]			= "tls-hw-rx-offload",
+	[NETIF_F_GRO_FRAGLIST_BIT]		= "rx-gro-list",
+	[NETIF_F_HW_MACSEC_BIT]			= "macsec-hw-offload",
 };
 
 const char
-- 
2.27.0



^ permalink raw reply related

* [PATCH][next] net: stmmac: selftests: Use struct_size() in kzalloc()
From: Gustavo A. R. Silva @ 2020-06-19 17:41 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David S. Miller,
	Jakub Kicinski, Maxime Coquelin
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
	Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index e6696495f126..e113b1376fdd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -1094,7 +1094,7 @@ static int stmmac_test_rxp(struct stmmac_priv *priv)
 	if (!priv->dma_cap.frpsel)
 		return -EOPNOTSUPP;
 
-	sel = kzalloc(sizeof(*sel) + nk * sizeof(struct tc_u32_key), GFP_KERNEL);
+	sel = kzalloc(struct_size(sel, keys, nk), GFP_KERNEL);
 	if (!sel)
 		return -ENOMEM;
 
-- 
2.27.0


^ permalink raw reply related

* [PATCH net 0/3] net: ethtool: netdev_features_strings[] cleanup
From: Alexander Lobakin @ 2020-06-19 17:35 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Michal Kubecek, Florian Fainelli, Andrew Lunn, Jiri Pirko,
	Antoine Tenart, Steffen Klassert, Aya Levin, Tom Herbert,
	Alexander Lobakin, netdev, linux-kernel

This little series adds the last forgotten feature string for
NETIF_F_GSO_TUNNEL_REMCSUM and attempts to prevent such losses
in future.

Patches 2-3 seem more like net-next candidates rather than net-fixes,
but if we don't stop it now, no guarantees that it won't happen again
soon.

I was thinking about some kind of static assertion to have an early
prevention mechanism for this, but the existing of 2 intended holes
(former NO_CSUM and UFO) makes this problematic, at least at first
sight.

Alexander Lobakin (3):
  net: ethtool: add missing string for NETIF_F_GSO_TUNNEL_REMCSUM
  net: ethtool: fix indentation of netdev_features_strings
  net: ethtool: sync netdev_features_strings order with enum
    netdev_features

 net/ethtool/common.c | 133 ++++++++++++++++++++++++-------------------
 1 file changed, 74 insertions(+), 59 deletions(-)

-- 
2.27.0



^ permalink raw reply

* [PATCH net 1/3] net: ethtool: add missing string for NETIF_F_GSO_TUNNEL_REMCSUM
From: Alexander Lobakin @ 2020-06-19 17:35 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Michal Kubecek, Florian Fainelli, Andrew Lunn, Jiri Pirko,
	Antoine Tenart, Steffen Klassert, Aya Levin, Tom Herbert,
	Alexander Lobakin, netdev, linux-kernel

Commit e585f2363637 ("udp: Changes to udp_offload to support remote
checksum offload") added new GSO type and a corresponding netdev
feature, but missed Ethtool's 'netdev_features_strings' table.
Give it a name so it will be exposed to userspace and become available
for manual configuration.

Fixes: e585f2363637 ("udp: Changes to udp_offload to support remote
checksum offload")
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 net/ethtool/common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 47f63526818e..aaecfc916a4d 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -40,6 +40,7 @@ const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
 	[NETIF_F_GSO_UDP_TUNNEL_BIT] =	 "tx-udp_tnl-segmentation",
 	[NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
 	[NETIF_F_GSO_PARTIAL_BIT] =	 "tx-gso-partial",
+	[NETIF_F_GSO_TUNNEL_REMCSUM_BIT] = "tx-tunnel-remcsum-segmentation",
 	[NETIF_F_GSO_SCTP_BIT] =	 "tx-sctp-segmentation",
 	[NETIF_F_GSO_ESP_BIT] =		 "tx-esp-segmentation",
 	[NETIF_F_GSO_UDP_L4_BIT] =	 "tx-udp-segmentation",
-- 
2.27.0



^ permalink raw reply related

* [PATCH][next] ethernet: ti: am65-cpsw-qos: Use struct_size() in devm_kzalloc()
From: Gustavo A. R. Silva @ 2020-06-19 17:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski; +Cc: netdev, linux-kernel, Gustavo A. R. Silva

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes. Also, remove unnecessary
variable _size_.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/ethernet/ti/am65-cpsw-qos.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/ti/am65-cpsw-qos.c b/drivers/net/ethernet/ti/am65-cpsw-qos.c
index 32eac04468bb..3bdd4dbcd2ff 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-qos.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-qos.c
@@ -505,7 +505,6 @@ static int am65_cpsw_set_taprio(struct net_device *ndev, void *type_data)
 	struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
 	struct tc_taprio_qopt_offload *taprio = type_data;
 	struct am65_cpsw_est *est_new;
-	size_t size;
 	int ret = 0;
 
 	if (taprio->cycle_time_extension) {
@@ -513,10 +512,9 @@ static int am65_cpsw_set_taprio(struct net_device *ndev, void *type_data)
 		return -EOPNOTSUPP;
 	}
 
-	size = sizeof(struct tc_taprio_sched_entry) * taprio->num_entries +
-	       sizeof(struct am65_cpsw_est);
-
-	est_new = devm_kzalloc(&ndev->dev, size, GFP_KERNEL);
+	est_new = devm_kzalloc(&ndev->dev,
+			       struct_size(est_new, taprio.entries, taprio->num_entries),
+			       GFP_KERNEL);
 	if (!est_new)
 		return -ENOMEM;
 
-- 
2.27.0


^ permalink raw reply related

* [PATCH net-next] ipv6: icmp6: avoid indirect call for icmpv6_send()
From: Eric Dumazet @ 2020-06-19 17:27 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Jakub Kicinski

If IPv6 is builtin, we do not need an expensive indirect call
to reach cmp6_send().

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/linux/icmpv6.h | 22 +++++++++++++++++++++-
 net/ipv6/icmp.c        |  5 +++--
 net/ipv6/ip6_icmp.c    | 10 +++++-----
 3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 33d37960231441d63a1d7a3d611da916734fc2cd..adeb4c6ae5affc2390db4faa02d95820eac4f70a 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -13,12 +13,32 @@ static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
 #include <linux/netdevice.h>
 
 #if IS_ENABLED(CONFIG_IPV6)
-extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info);
 
 typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 			     const struct in6_addr *force_saddr);
+#if IS_BUILTIN(CONFIG_IPV6)
+void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
+		const struct in6_addr *force_saddr);
+static void inline icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
+{
+	icmp6_send(skb, type, code, info, NULL);
+}
+static int inline inet6_register_icmp_sender(ip6_icmp_send_t *fn)
+{
+	BUILD_BUG_ON(fn != icmp6_send);
+	return 0;
+}
+static int inline inet6_unregister_icmp_sender(ip6_icmp_send_t *fn)
+{
+	BUILD_BUG_ON(fn != icmp6_send);
+	return 0;
+}
+#else
+extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info);
 extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn);
 extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
+#endif
+
 int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
 			       unsigned int data_len);
 
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index fc5000370030d67094ba11f15aaaaaa7ba519cde..91e0f2fd2523e6fb7d47c5a92e997c90ad53b9fc 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -439,8 +439,8 @@ static int icmp6_iif(const struct sk_buff *skb)
 /*
  *	Send an ICMP message in response to a packet in error
  */
-static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
-		       const struct in6_addr *force_saddr)
+void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
+		const struct in6_addr *force_saddr)
 {
 	struct inet6_dev *idev = NULL;
 	struct ipv6hdr *hdr = ipv6_hdr(skb);
@@ -625,6 +625,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 out_bh_enable:
 	local_bh_enable();
 }
+EXPORT_SYMBOL(icmp6_send);
 
 /* Slightly more convenient version of icmp6_send.
  */
diff --git a/net/ipv6/ip6_icmp.c b/net/ipv6/ip6_icmp.c
index e0086758b6ee3c3e91568e59028838c770fac795..70c8c2f36c980cd95db10380a1702a6d08e8c223 100644
--- a/net/ipv6/ip6_icmp.c
+++ b/net/ipv6/ip6_icmp.c
@@ -9,6 +9,8 @@
 
 #if IS_ENABLED(CONFIG_IPV6)
 
+#if !IS_BUILTIN(CONFIG_IPV6)
+
 static ip6_icmp_send_t __rcu *ip6_icmp_send;
 
 int inet6_register_icmp_sender(ip6_icmp_send_t *fn)
@@ -37,14 +39,12 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
 
 	rcu_read_lock();
 	send = rcu_dereference(ip6_icmp_send);
-
-	if (!send)
-		goto out;
-	send(skb, type, code, info, NULL);
-out:
+	if (send)
+		send(skb, type, code, info, NULL);
 	rcu_read_unlock();
 }
 EXPORT_SYMBOL(icmpv6_send);
+#endif
 
 #if IS_ENABLED(CONFIG_NF_NAT)
 #include <net/netfilter/nf_conntrack.h>
-- 
2.27.0.111.gc72c7da667-goog


^ permalink raw reply related

* Re: [PATCH net-next 1/3] net/sched: Introduce action hash
From: Davide Caratti @ 2020-06-19 14:39 UTC (permalink / raw)
  To: Ariel Levkovich, netdev
  Cc: jiri, kuba, jhs, xiyou.wangcong, ast, daniel, Jiri Pirko
In-Reply-To: <20200618221548.3805-2-lariel@mellanox.com>

hello Ariel,

thanks for the patch,

On Fri, 2020-06-19 at 01:15 +0300, Ariel Levkovich wrote:
> Allow setting a hash value to a packet for a future match.
> 
> The action will determine the packet's hash result according to
> the selected hash type.

> The first option is to select a basic asymmetric l4 hash calculation
> on the packet headers which will either use the skb->hash value as
> if such was already calculated and set by the device driver, or it
> will perform the kernel jenkins hash function on the packet which will
> generate the result otherwise.

If I understand correctly, this action is going to change a metadata of
the skb based on some operation done on the packet. Linux has already a
module that does this job, it's act_skbedit.

## proposal ##

Wouldn't it be possible to extend act_skbedit instead of adding a new tc
action? that would save us from some bugs we already encountered in the
past (maybe I saw a couple of them below), and we would also leverage on
the existing tests.

> The other option is for user to provide an BPF program which is
> dedicated to calculate the hash. In such case the program is loaded
> and used by tc to perform the hash calculation and provide it to
> the hash action to be stored in skb->hash field.
> 
> The BPF option can be useful for future HW offload support of the hash
> calculation by emulating the HW hash function when it's different than
> the kernel's but yet we want to maintain consistency between the SW and
> the HW.

Like Daniel noticed, this can be done by act_bpf. Using 'jump' or
'goto_chain' control actions we should get to the same result combining
act_skbedit and act_bpf, wdyt?

> Usage is as follows:
> 
> $ tc filter add dev ens1f0_0 ingress \
> prio 1 chain 0 proto ip \
> flower ip_proto tcp \
> action hash bpf object-file <bpf file> \
> action goto chain 2
> 
> $ tc filter add dev ens1f0_0 ingress \
> prio 1 chain 0 proto ip \
> flower ip_proto udp \
> action hash asym_l4 basis <basis> \
> action goto chain 2
> 
> Matching on the result:
> $ tc filter add dev ens1f0_0 ingress \
> prio 1 chain 2 proto ip \
> flower hash 0x0/0xf  \
> action mirred egress redirect dev ens1f0_1
> 
> $ tc filter add dev ens1f0_0 ingress \
> prio 1 chain 2 proto ip \
> flower hash 0x1/0xf  \
> action mirred egress redirect dev ens1f0_2
> 
> Signed-off-by: Ariel Levkovich <lariel@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  include/net/act_api.h               |   2 +
>  include/net/tc_act/tc_hash.h        |  22 ++
>  include/uapi/linux/pkt_cls.h        |   1 +
>  include/uapi/linux/tc_act/tc_hash.h |  32 +++
>  net/sched/Kconfig                   |  11 +
>  net/sched/Makefile                  |   1 +
>  net/sched/act_hash.c                | 376 ++++++++++++++++++++++++++++
>  net/sched/cls_api.c                 |   1 +
>  8 files changed, 446 insertions(+)
>  create mode 100644 include/net/tc_act/tc_hash.h
>  create mode 100644 include/uapi/linux/tc_act/tc_hash.h
>  create mode 100644 net/sched/act_hash.c
> 
> diff --git a/include/net/act_api.h b/include/net/act_api.h
> index 8c3934880670..b7e5d060bd2f 100644
> --- a/include/net/act_api.h
> +++ b/include/net/act_api.h
> @@ -12,6 +12,8 @@
>  #include <net/net_namespace.h>
>  #include <net/netns/generic.h>
>  
> +#define ACT_BPF_NAME_LEN	256
> +

(BTW, line above seems to be a leftover)

>  struct tcf_idrinfo {
>  	struct mutex	lock;
>  	struct idr	action_idr;
> 
[...]

> new file mode 100644
> index 000000000000..40a5c34f8745
> --- /dev/null
> +++ b/net/sched/act_hash.c
> @@ -0,0 +1,376 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/* -
> + * net/sched/act_hash.c  Hash calculation action
> + *
> + * Author:   Ariel Levkovich <lariel@mellanox.com>
> + */
> +
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/rtnetlink.h>
> +#include <linux/skbuff.h>
> +#include <linux/filter.h>
> +#include <net/netlink.h>
> +#include <net/pkt_sched.h>
> +#include <net/pkt_cls.h>
> +#include <linux/tc_act/tc_hash.h>
> +#include <net/tc_act/tc_hash.h>
> +
> +#define ACT_HASH_BPF_NAME_LEN	256
> +
> +static unsigned int hash_net_id;
> +static struct tc_action_ops act_hash_ops;
> +
> +static int tcf_hash_act(struct sk_buff *skb, const struct tc_action *a,
> +			struct tcf_result *res)
> +{
> +	struct tcf_hash *h = to_hash(a);
> +	struct tcf_hash_params *p;
> +	int action;
> +	u32 hash;
> +
> +	tcf_lastuse_update(&h->tcf_tm);
> +	tcf_action_update_bstats(&h->common, skb);
> +
> +	p = rcu_dereference_bh(h->hash_p);
> +
> +	action = READ_ONCE(h->tcf_action);
> +
> +	switch (p->alg) {
> +	case TCA_HASH_ALG_L4:
> +		hash = skb_get_hash(skb);
> +		/* If a hash basis was provided, add it into
> +		 * hash calculation here and re-set skb->hash
> +		 * to the new result with sw_hash indication
> +		 * and keeping the l4 hash indication.
> +		 */
> +		hash = jhash_1word(hash, p->basis);
> +		__skb_set_sw_hash(skb, hash, skb->l4_hash);

my proposal is to move the above line to the data path of act_skbedit, and
extend the control plane accordingly.

> +		break;
> +	case TCA_HASH_ALG_BPF:

here the code is assuming that the action is at tc ingress. But
theoretically we could install this action also on egress, nobody is
forbidding that.  whouldn't it be better to add proper checks (or using
directly act_bpf with appropriate control action, that already does this
job)?

> +		__skb_push(skb, skb->mac_len);
> +		bpf_compute_data_pointers(skb);
> +		hash = BPF_PROG_RUN(p->prog, skb);
> +		__skb_pull(skb, skb->mac_len);
> +		/* The BPF program hash function type is
> +		 * unknown so only the sw hash bit is set.
> +		 */
> +		__skb_set_sw_hash(skb, hash, false);
> +		break;
> +	}
> +	return action;
> +}
> +
> +static const struct nla_policy hash_policy[TCA_HASH_MAX + 1] = {
> +	[TCA_HASH_PARMS]	= { .type = NLA_EXACT_LEN, .len = sizeof(struct tc_hash) },
> +	[TCA_HASH_ALG]		= { .type = NLA_U32 },
> +	[TCA_HASH_BASIS]	= { .type = NLA_U32 },
> +	[TCA_HASH_BPF_FD]	= { .type = NLA_U32 },
> +	[TCA_HASH_BPF_NAME]	= { .type = NLA_NUL_STRING,
> +				    .len = ACT_HASH_BPF_NAME_LEN },
> +};
> +
> +static int tcf_hash_bpf_init(struct nlattr **tb, struct tcf_hash_params *params)
> +{
> +	struct bpf_prog *fp;
> +	char *name = NULL;
> +	u32 bpf_fd;
> +
> +	bpf_fd = nla_get_u32(tb[TCA_HASH_BPF_FD]);

shouldn't we check for non-NULL tb[TCA_HASH_BPF_FD] to avoid a crash here?
please note, act_bpf does it:

https://elixir.bootlin.com/linux/v5.8-rc1/source/net/sched/act_bpf.c#L337

> +
> +	fp = bpf_prog_get_type(bpf_fd, BPF_PROG_TYPE_SCHED_ACT);
> +	if (IS_ERR(fp))
> +		return PTR_ERR(fp);
> +
> +	if (tb[TCA_HASH_BPF_NAME]) {
> +		name = nla_memdup(tb[TCA_HASH_BPF_NAME], GFP_KERNEL);
> +		if (!name) {
> +			bpf_prog_put(fp);
> +			return -ENOMEM;
> +		}
> +	}
> +
> +	params->bpf_name = name;
> +	params->prog = fp;
> +
> +	return 0;
> +}
> +
> +static void tcf_hash_bpf_cleanup(struct tcf_hash_params *params)
> +{
> +	if (params->prog)
> +		bpf_prog_put(params->prog);
> +
> +	kfree(params->bpf_name);
> +}
> +
> +static int tcf_hash_init(struct net *net, struct nlattr *nla,
> +			 struct nlattr *est, struct tc_action **a,
> +			 int replace, int bind, bool rtnl_held,
> +			 struct tcf_proto *tp, u32 flags,
> +			 struct netlink_ext_ack *extack)
> +{
> +	struct tc_action_net *tn = net_generic(net, hash_net_id);
> +	struct tcf_hash_params *params, old;
> +	struct nlattr *tb[TCA_HASH_MAX + 1];
> +	struct tcf_chain *goto_ch = NULL;
> +	struct tcf_hash_params *p = NULL;
> +	struct tc_hash *parm;
> +	struct tcf_hash *h;
> +	int err, res = 0;
> +	u32 index;
> +
> +	if (!nla) {
> +		NL_SET_ERR_MSG_MOD(extack, "Hash requires attributes to be passed");
> +		return -EINVAL;
> +	}
> +
> +	err = nla_parse_nested(tb, TCA_HASH_MAX, nla, hash_policy, extack);
> +	if (err < 0)
> +		return err;
> +
> +	if (!tb[TCA_HASH_PARMS]) {
> +		NL_SET_ERR_MSG_MOD(extack, "Missing required hash parameters");
> +		return -EINVAL;
> +	}
> +	parm = nla_data(tb[TCA_HASH_PARMS]);
> +	index = parm->index;
> +
> +	err = tcf_idr_check_alloc(tn, &index, a, bind);
> +	if (err < 0)
> +		return err;
> +
> +	if (!err) {
> +		err = tcf_idr_create_from_flags(tn, index, est, a,
> +						&act_hash_ops, bind, flags);
> +		if (err) {
> +			tcf_idr_cleanup(tn, index);
> +			return err;
> +		}
> +		res = ACT_P_CREATED;
> +	} else {
> +		if (bind)
> +			return 0;
> +
> +		if (!replace) {
> +			tcf_idr_release(*a, bind);
> +			return -EEXIST;
> +		}
> +	}
> +	err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
> +	if (err < 0)
> +		goto release_idr;
> +
> +	h = to_hash(*a);
> +
> +	p = kzalloc(sizeof(*p), GFP_KERNEL);
> +	if (unlikely(!p)) {
> +		err = -ENOMEM;
> +		goto cleanup;
> +	}
> +
> +	if (!tb[TCA_HASH_ALG]) {
> +		NL_SET_ERR_MSG_MOD(extack, "Missing hash algorithm selection");
> +		err = -EINVAL;
> +		goto cleanup;
> +	}
> +
> +	p->alg = nla_get_u32(tb[TCA_HASH_ALG]);

I don't understand why of 'p->alg' is assigned and then validated.
Wouldn't it be better to validate it earlier? this would also avoid the
spin_lock unbalance below:

> +	spin_lock_bh(&h->tcf_lock);
> +
> +	switch (p->alg) {
> +	case TCA_HASH_ALG_L4:
> +		break;
> +	case TCA_HASH_ALG_BPF:
> +		if (res != ACT_P_CREATED) {
> +			params = rcu_dereference_protected(h->hash_p, 1);
> +			old.prog = params->prog;
> +			old.bpf_name = params->bpf_name;
> +		}
> +
> +		err = tcf_hash_bpf_init(tb, p);
> +		if (err)
> +			goto cleanup;

shouldn't we spin_unlock_bh() here?
> +
> +		break;
> +	default:
> +		NL_SET_ERR_MSG_MOD(extack, "Hash type not supported");
> +		err = -EINVAL;
> +		goto cleanup;

shouldn't we spin_unlock_bh() here?
> +	}
> +	if (tb[TCA_HASH_BASIS])
> +		p->basis = nla_get_u32(tb[TCA_HASH_BASIS]);
> +
> +	goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
> +	p = rcu_replace_pointer(h->hash_p, p,
> +				lockdep_is_held(&h->tcf_lock));
> +	spin_unlock_bh(&h->tcf_lock);
> +
> +	if (goto_ch)
> +		tcf_chain_put_by_act(goto_ch);
> +	if (p)
> +		kfree_rcu(p, rcu);
> +
> +	if (res == ACT_P_CREATED) {
> +		tcf_idr_insert(tn, *a);
> +	} else {
> +		synchronize_rcu();
> +		tcf_hash_bpf_cleanup(&old);
> +	}
> +
> +	return res;
> +
> +cleanup:
> +	if (goto_ch)
> +		tcf_chain_put_by_act(goto_ch);
> +	kfree(p);
> +
> +release_idr:
> +	tcf_idr_release(*a, bind);
> +	return err;
> +}


thank you in advance for any feedback!
-- 
davide


^ permalink raw reply

* Re: [PATCH 1/3] net: phy: marvell: use a single style for referencing functions
From: Andrew Lunn @ 2020-06-19 14:56 UTC (permalink / raw)
  To: Maxim Kochetkov
  Cc: netdev, Florian Fainelli, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski
In-Reply-To: <20200619084904.95432-2-fido_max@inbox.ru>

On Fri, Jun 19, 2020 at 11:49:02AM +0300, Maxim Kochetkov wrote:
> The kernel in general does not use &func referencing format.
> 
> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply

* Re: [PATCH 0/3] Add Marvell 88E1340S, 88E1548P support
From: Andrew Lunn @ 2020-06-19 14:58 UTC (permalink / raw)
  To: Maxim Kochetkov
  Cc: netdev, Florian Fainelli, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski
In-Reply-To: <20200619084904.95432-1-fido_max@inbox.ru>

On Fri, Jun 19, 2020 at 11:49:01AM +0300, Maxim Kochetkov wrote:
> This patch series add new PHY id support.
> Russell King asked to use single style for referencing functions.

Hi Maxim

In future, please put which tree this patchset is for into the subject
line:

[PATCH net-next v2] ...

       Andrew

^ permalink raw reply

* Re: [PATCH v1 2/3] net/fsl: acpize xgmac_mdio
From: Calvin Johnson @ 2020-06-19 14:59 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Jeremy Linton, Jon, Cristi Sovaiala, Ioana Ciornei, Andrew Lunn,
	Andy Shevchenko, Florian Fainelli, Madalin Bucur, netdev,
	linux.cj
In-Reply-To: <20200617174930.GU1551@shell.armlinux.org.uk>

On Wed, Jun 17, 2020 at 06:49:31PM +0100, Russell King - ARM Linux admin wrote:
> On Wed, Jun 17, 2020 at 10:45:34PM +0530, Calvin Johnson wrote:
> > From: Jeremy Linton <jeremy.linton@arm.com>
> > 
> > Add ACPI support for xgmac MDIO bus registration while maintaining
> > the existing DT support.
> > 
> > The function mdiobus_register() inside of_mdiobus_register(), brings
> > up all the PHYs on the mdio bus and attach them to the bus.
> > 
> > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> > Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
> > ---
> > 
> >  drivers/net/ethernet/freescale/xgmac_mdio.c | 27 +++++++++++++--------
> >  1 file changed, 17 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
> > index c82c85ef5fb3..fb7f8caff643 100644
> > --- a/drivers/net/ethernet/freescale/xgmac_mdio.c
> > +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
> > @@ -245,14 +245,14 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
> >  {
> >  	struct device_node *np = pdev->dev.of_node;
> >  	struct mii_bus *bus;
> > -	struct resource res;
> > +	struct resource *res;
> >  	struct mdio_fsl_priv *priv;
> >  	int ret;
> >  
> > -	ret = of_address_to_resource(np, 0, &res);
> > -	if (ret) {
> > +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +	if (!res) {
> >  		dev_err(&pdev->dev, "could not obtain address\n");
> > -		return ret;
> > +		return -EINVAL;
> >  	}
> 
> I think, as you're completely rewriting the resource handling, it would
> be a good idea to switch over to using devm_* stuff here.
> 
> 	void __iomem *regs;
> 
> 	regs = devm_platform_ioremap_resource(pdev, 0);

I had used devm_ API earlier in this place and ran into a regression.
This mdio driver is used by both DPAA-1 and DPAA-2. In DPAA2 case, this
works fine.

But in DPAA-1 case, the existing device tree describes the memory map in a
hierarchical manner. The FMan of DPAA-1 area include the MDIO, Port, MAC areas.
Therefore, we may have to continue with existing method.

Thanks
Calvin

^ permalink raw reply

* Re: [PATCH 3/3] net: phy: marvell: Add Marvell 88E1548P support
From: Andrew Lunn @ 2020-06-19 14:59 UTC (permalink / raw)
  To: Maxim Kochetkov
  Cc: netdev, Florian Fainelli, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski
In-Reply-To: <20200619084904.95432-4-fido_max@inbox.ru>

On Fri, Jun 19, 2020 at 11:49:04AM +0300, Maxim Kochetkov wrote:
> Add support for this new phy ID.
> 
> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply

* Re: mt7612 suspend/resume issue
From: Oleksandr Natalenko @ 2020-06-19 15:01 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Lorenzo Bianconi, Felix Fietkau, Ryder Lee, Kalle Valo,
	David S. Miller, Jakub Kicinski, Matthias Brugger, linux-wireless,
	netdev, linux-mediatek, linux-kernel
In-Reply-To: <20200618111859.GC698688@lore-desk.lan>

Hello, Lorenzo.

Thanks for the quick reply. Please see my observation below.

On Thu, Jun 18, 2020 at 01:18:59PM +0200, Lorenzo Bianconi wrote:
> I have not reproduced the issue myself yet, but I guess we can try:
> 1- update to latest Felix's tree [1]
> 2- could you please try to apply the patch below? (compile-test only)

I've started with trying your patch first (apllied to v5.7.4). Please
see my comments on it inline.

> [1] https://github.com/nbd168/wireless
> 
> From 400268a0ee5843cf736308504dfbd2f20a291eaf Mon Sep 17 00:00:00 2001
> Message-Id: <400268a0ee5843cf736308504dfbd2f20a291eaf.1592478809.git.lorenzo@kernel.org>
> From: Lorenzo Bianconi <lorenzo@kernel.org>
> Date: Thu, 18 Jun 2020 13:10:11 +0200
> Subject: [PATCH] mt76: mt76x2: fix pci suspend
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  .../net/wireless/mediatek/mt76/mt76x02_dma.h  |  1 +
>  .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 15 +++++
>  .../net/wireless/mediatek/mt76/mt76x2/pci.c   | 58 +++++++++++++++++++
>  3 files changed, 74 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_dma.h b/drivers/net/wireless/mediatek/mt76/mt76x02_dma.h
> index 4aff4f8e87b6..6262f2ecded5 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_dma.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dma.h
> @@ -62,5 +62,6 @@ mt76x02_wait_for_wpdma(struct mt76_dev *dev, int timeout)
>  int mt76x02_dma_init(struct mt76x02_dev *dev);
>  void mt76x02_dma_disable(struct mt76x02_dev *dev);
>  void mt76x02_dma_cleanup(struct mt76x02_dev *dev);
> +void mt76x02_dma_reset(struct mt76x02_dev *dev);
>  
>  #endif /* __MT76x02_DMA_H */
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> index cbbe986655fe..e2631c964331 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
> @@ -348,6 +348,21 @@ void mt76x02_dma_disable(struct mt76x02_dev *dev)
>  }
>  EXPORT_SYMBOL_GPL(mt76x02_dma_disable);
>  
> +void mt76x02_dma_reset(struct mt76x02_dev *dev)
> +{
> +	int i;
> +
> +	mt76x02_dma_disable(dev);
> +	usleep_range(1000, 2000);
> +
> +	for (i = 0; i < __MT_TXQ_MAX; i++)
> +		mt76_queue_tx_cleanup(dev, i, true);
> +	mt76_for_each_q_rx(&dev->mt76, i)

Since v5.7.4 doesn't have this macro, I've pulled it manually.

> +		mt76_queue_rx_reset(dev, i);
> +
> +	mt76x02_dma_enable(dev);
> +}

I had to add EXPORT_SYMBOL_GPL(mt76x02_dma_reset) in order to get the
kernel linked successfully.

> +
>  void mt76x02_mac_start(struct mt76x02_dev *dev)
>  {
>  	mt76x02_mac_reset_counters(dev);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
> index 53ca0cedf026..5543e242fb9b 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
> @@ -103,6 +103,60 @@ mt76pci_remove(struct pci_dev *pdev)
>  	mt76_free_device(mdev);
>  }
>  
> +static int __maybe_unused
> +mt76x2e_suspend(struct pci_dev *pdev, pm_message_t state)
> +{
> +	struct mt76_dev *mdev = pci_get_drvdata(pdev);
> +	struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
> +	int i, err;
> +
> +	napi_disable(&mdev->tx_napi);
> +	tasklet_kill(&mdev->pre_tbtt_tasklet);
> +	tasklet_kill(&mdev->tx_tasklet);
> +
> +	mt76_for_each_q_rx(mdev, i)
> +		napi_disable(&mdev->napi[i]);
> +
> +	mt76x02_dma_reset(dev);
> +
> +	pci_enable_wake(pdev, pci_choose_state(pdev, state), true);
> +	pci_save_state(pdev);
> +	err = pci_set_power_state(pdev, pci_choose_state(pdev, state));
> +	if (err)
> +		goto restore;
> +
> +	return 0;
> +
> +restore:
> +	mt76_for_each_q_rx(mdev, i)
> +		napi_enable(&mdev->napi[i]);
> +	napi_enable(&mdev->tx_napi);
> +
> +	return err;
> +}
> +
> +static int __maybe_unused
> +mt76x2e_resume(struct pci_dev *pdev)
> +{
> +	struct mt76_dev *mdev = pci_get_drvdata(pdev);
> +	int i, err;
> +
> +	err = pci_set_power_state(pdev, PCI_D0);
> +	if (err)
> +		return err;
> +
> +	pci_restore_state(pdev);
> +
> +	mt76_for_each_q_rx(mdev, i) {
> +		napi_enable(&mdev->napi[i]);
> +		napi_schedule(&mdev->napi[i]);
> +	}
> +	napi_enable(&mdev->tx_napi);
> +	napi_schedule(&mdev->tx_napi);
> +
> +	return 0;
> +}
> +
>  MODULE_DEVICE_TABLE(pci, mt76pci_device_table);
>  MODULE_FIRMWARE(MT7662_FIRMWARE);
>  MODULE_FIRMWARE(MT7662_ROM_PATCH);
> @@ -113,6 +167,10 @@ static struct pci_driver mt76pci_driver = {
>  	.id_table	= mt76pci_device_table,
>  	.probe		= mt76pci_probe,
>  	.remove		= mt76pci_remove,
> +#ifdef CONFIG_PM
> +	.suspend	= mt76x2e_suspend,
> +	.resume		= mt76x2e_resume,
> +#endif /* CONFIG_PM */
>  };
>  
>  module_pci_driver(mt76pci_driver);
> -- 
> 2.26.2

Unfortunately, it seems it did little change to my setup. The resume
time shrunk it seems (but is still noticeable), and the system survived
2 suspend/resume cycles, but after the third resume the following
happened:

===
čen 18 23:11:58 spock kernel: mt76x2e 0000:01:00.0: MCU message 2 (seq 11) timed out
čen 18 23:11:58 spock kernel: mt76x2e 0000:01:00.0: MCU message 30 (seq 12) timed out
čen 18 23:11:58 spock kernel: mt76x2e 0000:01:00.0: MCU message 30 (seq 13) timed out
čen 18 23:11:58 spock kernel: mt76x2e 0000:01:00.0: Firmware Version: 0.0.00
čen 18 23:11:58 spock kernel: mt76x2e 0000:01:00.0: Build: 1
čen 18 23:11:58 spock kernel: mt76x2e 0000:01:00.0: Build Time: 201507311614____
čen 18 23:11:58 spock kernel: mt76x2e 0000:01:00.0: Firmware running!
čen 18 23:11:58 spock kernel: ieee80211 phy0: Hardware restart was requested
čen 18 23:11:59 spock kernel: mt76x2e 0000:01:00.0: MCU message 2 (seq 1) timed out
čen 18 23:11:59 spock kernel: mt76x2e 0000:01:00.0: Firmware Version: 0.0.00
čen 18 23:11:59 spock kernel: mt76x2e 0000:01:00.0: Build: 1
čen 18 23:11:59 spock kernel: mt76x2e 0000:01:00.0: Build Time: 201507311614____
čen 18 23:11:59 spock kernel: mt76x2e 0000:01:00.0: Firmware running!
čen 18 23:11:59 spock kernel: ieee80211 phy0: Hardware restart was requested
čen 18 23:12:00 spock kernel: mt76x2e 0000:01:00.0: MCU message 30 (seq 3) timed out
čen 18 23:12:01 spock kernel: mt76x2e 0000:01:00.0: MCU message 30 (seq 4) timed out
čen 18 23:12:01 spock kernel: mt76x2e 0000:01:00.0: Firmware Version: 0.0.00
čen 18 23:12:01 spock kernel: mt76x2e 0000:01:00.0: Build: 1
čen 18 23:12:01 spock kernel: mt76x2e 0000:01:00.0: Build Time: 201507311614____
čen 18 23:12:01 spock kernel: mt76x2e 0000:01:00.0: Firmware running!
čen 18 23:12:01 spock kernel: ieee80211 phy0: Hardware restart was requested
čen 18 23:12:02 spock kernel: ------------[ cut here ]------------
čen 18 23:12:02 spock kernel: WARNING: CPU: 3 PID: 171 at net/mac80211/util.c:2270 ieee80211_reconfig+0x234/0x1700 [mac80211]
čen 18 23:12:02 spock kernel: Modules linked in: cmac ccm bridge stp llc nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables msr tun nfnetlink nls_iso8859_1 nls_cp437 vfat fat mt76x2e mt76x2_common mt76x02_lib mt76 mac80211 intel_rapl_msr snd_hda_codec_hdmi snd_hda_codec_cirrus mei_hdcp snd_hda_codec_generic cfg80211 intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp dell_laptop iTCO_wdt snd_hda_intel kvm_intel iTCO_vendor_support dell_wmi snd_intel_dspcfg sparse_keymap snd_hda_codec ledtrig_audio wmi_bmof dell_smbios snd_hda_core kvm rtsx_usb_ms dell_wmi_descriptor memstick dcdbas snd_hwdep dell_smm_hwmon irqbypass psmouse intel_cstate snd_pcm intel_uncore joydev intel_rapl_perf mousedev mei_me alx rfkill input_leds snd_timer i2c_i801 snd mei lpc_ich libarc4 mdio soundcore battery wmi evdev dell_smo8800 mac_hid ac tcp_bbr crypto_user ip_tables x_tables xfs dm_thin_pool dm_persistent_data dm_bio_prison dm_bufio libcrc32c crc32c_generic dm_crypt hid_logitech_hidpp hid_logitech_dj
čen 18 23:12:02 spock kernel:  hid_generic usbhid hid rtsx_usb_sdmmc mmc_core rtsx_usb dm_mod raid10 serio_raw atkbd libps2 md_mod crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper xhci_pci xhci_hcd ehci_pci ehci_hcd i8042 serio i915 intel_gtt i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec rc_core drm agpgart
čen 18 23:12:02 spock kernel: CPU: 3 PID: 171 Comm: kworker/3:3 Not tainted 5.7.0-pf3 #1
čen 18 23:12:02 spock kernel: Hardware name: Dell Inc.          Vostro 3360/0F5DWF, BIOS A18 09/25/2013
čen 18 23:12:02 spock kernel: Workqueue: events_freezable ieee80211_restart_work [mac80211]
čen 18 23:12:02 spock kernel: RIP: 0010:ieee80211_reconfig+0x234/0x1700 [mac80211]
čen 18 23:12:02 spock kernel: Code: 83 b8 0b 00 00 83 e0 fd 83 f8 04 74 e6 48 8b 83 90 04 00 00 a8 01 74 db 48 89 de 48 89 ef e8 03 dc fb ff 41 89 c7 85 c0 74 c9 <0f> 0b 48 8b 5b 08 4c 8b 24 24 48 3b 1c 24 75 12 e9 51 fe ff ff 48
čen 18 23:12:02 spock kernel: RSP: 0018:ffffa87c40403df0 EFLAGS: 00010286
čen 18 23:12:02 spock kernel: RAX: 00000000fffffff0 RBX: ffff9fe028f6e900 RCX: 0000000000000008
čen 18 23:12:02 spock kernel: RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000000000000100
čen 18 23:12:02 spock kernel: RBP: ffff9fe0283787e0 R08: 0000000000000000 R09: 0000000000000001
čen 18 23:12:02 spock kernel: R10: 0000000000000001 R11: 0000000000000000 R12: ffff9fe0283798d0
čen 18 23:12:02 spock kernel: R13: 00000000ffffffff R14: 0000000000000000 R15: 00000000fffffff0
čen 18 23:12:02 spock kernel: FS:  0000000000000000(0000) GS:ffff9fe02f2c0000(0000) knlGS:0000000000000000
čen 18 23:12:02 spock kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
čen 18 23:12:02 spock kernel: CR2: 00007f313b33a940 CR3: 000000012ea0a002 CR4: 00000000001706e0
čen 18 23:12:02 spock kernel: Call Trace:
čen 18 23:12:02 spock kernel:  ieee80211_restart_work+0xb7/0xe0 [mac80211]
čen 18 23:12:02 spock kernel:  process_one_work+0x1d4/0x3c0
čen 18 23:12:02 spock kernel:  worker_thread+0x228/0x470
čen 18 23:12:02 spock kernel:  ? process_one_work+0x3c0/0x3c0
čen 18 23:12:02 spock kernel:  kthread+0x19c/0x1c0
čen 18 23:12:02 spock kernel:  ? __kthread_init_worker+0x30/0x30
čen 18 23:12:02 spock kernel:  ret_from_fork+0x35/0x40
čen 18 23:12:02 spock kernel: ---[ end trace e017bc3573bd9bf2 ]---
čen 18 23:12:02 spock kernel: ------------[ cut here ]------------
čen 18 23:12:02 spock kernel: wlp1s0:  Failed check-sdata-in-driver check, flags: 0x0
čen 18 23:12:02 spock kernel: WARNING: CPU: 3 PID: 171 at net/mac80211/driver-ops.h:17 drv_remove_interface+0x11f/0x130 [mac80211]
čen 18 23:12:02 spock kernel: Modules linked in: cmac ccm bridge stp llc nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables msr tun nfnetlink nls_iso8859_1 nls_cp437 vfat fat mt76x2e mt76x2_common mt76x02_lib mt76 mac80211 intel_rapl_msr snd_hda_codec_hdmi snd_hda_codec_cirrus mei_hdcp snd_hda_codec_generic cfg80211 intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp dell_laptop iTCO_wdt snd_hda_intel kvm_intel iTCO_vendor_support dell_wmi snd_intel_dspcfg sparse_keymap snd_hda_codec ledtrig_audio wmi_bmof dell_smbios snd_hda_core kvm rtsx_usb_ms dell_wmi_descriptor memstick dcdbas snd_hwdep dell_smm_hwmon irqbypass psmouse intel_cstate snd_pcm intel_uncore joydev intel_rapl_perf mousedev mei_me alx rfkill input_leds snd_timer i2c_i801 snd mei lpc_ich libarc4 mdio soundcore battery wmi evdev dell_smo8800 mac_hid ac tcp_bbr crypto_user ip_tables x_tables xfs dm_thin_pool dm_persistent_data dm_bio_prison dm_bufio libcrc32c crc32c_generic dm_crypt hid_logitech_hidpp hid_logitech_dj
čen 18 23:12:02 spock kernel:  hid_generic usbhid hid rtsx_usb_sdmmc mmc_core rtsx_usb dm_mod raid10 serio_raw atkbd libps2 md_mod crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper xhci_pci xhci_hcd ehci_pci ehci_hcd i8042 serio i915 intel_gtt i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec rc_core drm agpgart
čen 18 23:12:02 spock kernel: CPU: 3 PID: 171 Comm: kworker/3:3 Tainted: G        W         5.7.0-pf3 #1
čen 18 23:12:02 spock kernel: Hardware name: Dell Inc.          Vostro 3360/0F5DWF, BIOS A18 09/25/2013
čen 18 23:12:02 spock kernel: Workqueue: events_freezable ieee80211_restart_work [mac80211]
čen 18 23:12:02 spock kernel: RIP: 0010:drv_remove_interface+0x11f/0x130 [mac80211]
čen 18 23:12:02 spock kernel: Code: a0 57 f0 c2 e9 4b ff ff ff 48 8b 86 78 04 00 00 48 8d b6 98 04 00 00 48 c7 c7 e8 ef f8 c0 48 85 c0 48 0f 45 f0 e8 99 2e fa c2 <0f> 0b 5b 5d 41 5c c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00
čen 18 23:12:02 spock kernel: RSP: 0018:ffffa87c40403c80 EFLAGS: 00010282
čen 18 23:12:02 spock kernel: RAX: 0000000000000000 RBX: ffff9fe028f6e900 RCX: 0000000000000000
čen 18 23:12:02 spock kernel: RDX: 0000000000000001 RSI: 0000000000000082 RDI: 00000000ffffffff
čen 18 23:12:02 spock kernel: RBP: ffff9fe028379930 R08: 00000000000004c9 R09: 0000000000000001
čen 18 23:12:02 spock kernel: R10: 0000000000000001 R11: 0000000000006fc0 R12: ffff9fe028379000
čen 18 23:12:02 spock kernel: R13: ffff9fe028f6f4b8 R14: ffff9fe028378ca0 R15: ffff9fe0283787e0
čen 18 23:12:02 spock kernel: FS:  0000000000000000(0000) GS:ffff9fe02f2c0000(0000) knlGS:0000000000000000
čen 18 23:12:02 spock kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
čen 18 23:12:02 spock kernel: CR2: 00007f313b33a940 CR3: 000000012ea0a002 CR4: 00000000001706e0
čen 18 23:12:02 spock kernel: Call Trace:
čen 18 23:12:02 spock kernel:  ieee80211_do_stop+0x5af/0x8c0 [mac80211]
čen 18 23:12:02 spock kernel:  ieee80211_stop+0x16/0x20 [mac80211]
čen 18 23:12:02 spock kernel:  __dev_close_many+0xaa/0x120
čen 18 23:12:02 spock kernel:  dev_close_many+0xa1/0x2b0
čen 18 23:12:02 spock kernel:  dev_close+0x6d/0x90
čen 18 23:12:02 spock kernel:  cfg80211_shutdown_all_interfaces+0x71/0xd0 [cfg80211]
čen 18 23:12:02 spock kernel:  ieee80211_reconfig+0xa2/0x1700 [mac80211]
čen 18 23:12:02 spock kernel:  ieee80211_restart_work+0xb7/0xe0 [mac80211]
čen 18 23:12:02 spock kernel:  process_one_work+0x1d4/0x3c0
čen 18 23:12:02 spock kernel:  worker_thread+0x228/0x470
čen 18 23:12:02 spock kernel:  ? process_one_work+0x3c0/0x3c0
čen 18 23:12:02 spock kernel:  kthread+0x19c/0x1c0
čen 18 23:12:02 spock kernel:  ? __kthread_init_worker+0x30/0x30
čen 18 23:12:02 spock kernel:  ret_from_fork+0x35/0x40
čen 18 23:12:02 spock kernel: ---[ end trace e017bc3573bd9bf3 ]---
===

Do you still want me to try Felix's tree, or there's something else I
can try?

Thank you.

-- 
  Best regards,
    Oleksandr Natalenko (post-factum)
    Principal Software Maintenance Engineer


^ permalink raw reply

* [PATCH net-next v9 0/5] RGMII Internal delay common property
From: Dan Murphy @ 2020-06-19 16:18 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1, davem, robh
  Cc: netdev, linux-kernel, devicetree, Dan Murphy

Hello

The RGMII internal delay is a common setting found in most RGMII capable PHY
devices.  It was found that many vendor specific device tree properties exist
to do the same function. This creates a common property to be used for PHY's
that have internal delays for the Rx and Tx paths.

If the internal delay is tunable then the caller needs to pass the internal
delay array and the return will be the index in the array that was found in
the firmware node.

If the internal delay is fixed then the caller only needs to indicate which
delay to return.  There is no need for a fixed delay to add device properties
since the value is not configurable. Per the ethernet-controller.yaml the
interface type indicates that the PHY should provide the delay.

This series contains examples of both a configurable delay and a fixed delay.

Dan Murphy (5):
  dt-bindings: net: Add tx and rx internal delays
  net: phy: Add a helper to return the index for of the internal delay
  dt-bindings: net: Add RGMII internal delay for DP83869
  net: dp83869: Add RGMII internal delay configuration
  net: phy: DP83822: Add setting the fixed internal delay

 .../devicetree/bindings/net/ethernet-phy.yaml |  13 +++
 .../devicetree/bindings/net/ti,dp83869.yaml   |  16 ++-
 drivers/net/phy/dp83822.c                     |  79 ++++++++++++--
 drivers/net/phy/dp83869.c                     |  53 +++++++++-
 drivers/net/phy/phy_device.c                  | 100 ++++++++++++++++++
 include/linux/phy.h                           |   4 +
 6 files changed, 251 insertions(+), 14 deletions(-)

-- 
2.26.2


^ permalink raw reply

* [PATCH net-next v9 3/5] dt-bindings: net: Add RGMII internal delay for DP83869
From: Dan Murphy @ 2020-06-19 16:18 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1, davem, robh
  Cc: netdev, linux-kernel, devicetree, Dan Murphy
In-Reply-To: <20200619161813.2716-1-dmurphy@ti.com>

Add the internal delay values into the header and update the binding
with the internal delay properties.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 .../devicetree/bindings/net/ti,dp83869.yaml      | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/ti,dp83869.yaml b/Documentation/devicetree/bindings/net/ti,dp83869.yaml
index 5b69ef03bbf7..71e90a3e4652 100644
--- a/Documentation/devicetree/bindings/net/ti,dp83869.yaml
+++ b/Documentation/devicetree/bindings/net/ti,dp83869.yaml
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: TI DP83869 ethernet PHY
 
 allOf:
-  - $ref: "ethernet-controller.yaml#"
+  - $ref: "ethernet-phy.yaml#"
 
 maintainers:
   - Dan Murphy <dmurphy@ti.com>
@@ -64,6 +64,18 @@ properties:
        Operational mode for the PHY.  If this is not set then the operational
        mode is set by the straps. see dt-bindings/net/ti-dp83869.h for values
 
+  rx-internal-delay-ps:
+    description: Delay is in pico seconds
+    enum: [ 250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500, 2750, 3000,
+            3250, 3500, 3750, 4000 ]
+    default: 2000
+
+  tx-internal-delay-ps:
+    description: Delay is in pico seconds
+    enum: [ 250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500, 2750, 3000,
+            3250, 3500, 3750, 4000 ]
+    default: 2000
+
 required:
   - reg
 
@@ -80,5 +92,7 @@ examples:
         ti,op-mode = <DP83869_RGMII_COPPER_ETHERNET>;
         ti,max-output-impedance = "true";
         ti,clk-output-sel = <DP83869_CLK_O_SEL_CHN_A_RCLK>;
+        rx-internal-delay-ps = <2000>;
+        tx-internal-delay-ps = <2000>;
       };
     };
-- 
2.26.2


^ 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