Netdev List
 help / color / mirror / Atom feed
* [PATCH mlx5-next 02/16] net/mlx5: Add sampler destination type
From: Saeed Mahameed @ 2020-11-20 23:03 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky; +Cc: netdev, linux-rdma, Chris Mi, Oz Shlomo
In-Reply-To: <20201120230339.651609-1-saeedm@nvidia.com>

From: Chris Mi <cmi@nvidia.com>

The flow sampler object is a new destination type. Add a new member
for the flow destination.

Signed-off-by: Chris Mi <cmi@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c | 3 +++
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c             | 3 +++
 include/linux/mlx5/fs.h                                      | 1 +
 include/linux/mlx5/mlx5_ifc.h                                | 1 +
 4 files changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
index a700f3c86899..87d65f6b5310 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
@@ -247,6 +247,9 @@ const char *parse_fs_dst(struct trace_seq *p,
 	case MLX5_FLOW_DESTINATION_TYPE_TIR:
 		trace_seq_printf(p, "tir=%u\n", dst->tir_num);
 		break;
+	case MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER:
+		trace_seq_printf(p, "sampler_id=%u\n", dst->sampler_id);
+		break;
 	case MLX5_FLOW_DESTINATION_TYPE_COUNTER:
 		trace_seq_printf(p, "counter_id=%u\n", counter_id);
 		break;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
index babe3405132a..c2fed9c3d75c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
@@ -515,6 +515,9 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
 						 dst->dest_attr.vport.pkt_reformat->id);
 				}
 				break;
+			case MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER:
+				id = dst->dest_attr.sampler_id;
+				break;
 			default:
 				id = dst->dest_attr.tir_num;
 			}
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 846d94ad04bc..35d2cc1646d3 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -132,6 +132,7 @@ struct mlx5_flow_destination {
 			struct mlx5_pkt_reformat *pkt_reformat;
 			u8		flags;
 		} vport;
+		u32			sampler_id;
 	};
 };
 
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 65ea35af0527..2f2add4bd5e1 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1616,6 +1616,7 @@ enum mlx5_flow_destination_type {
 	MLX5_FLOW_DESTINATION_TYPE_VPORT        = 0x0,
 	MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE   = 0x1,
 	MLX5_FLOW_DESTINATION_TYPE_TIR          = 0x2,
+	MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER = 0x6,
 
 	MLX5_FLOW_DESTINATION_TYPE_PORT         = 0x99,
 	MLX5_FLOW_DESTINATION_TYPE_COUNTER      = 0x100,
-- 
2.26.2


^ permalink raw reply related

* [PATCH mlx5-next 03/16] net/mlx5: Check dr mask size against mlx5_match_param size
From: Saeed Mahameed @ 2020-11-20 23:03 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky
  Cc: netdev, linux-rdma, Muhammad Sammar, Alex Vesker, Mark Bloch
In-Reply-To: <20201120230339.651609-1-saeedm@nvidia.com>

From: Muhammad Sammar <muhammads@nvidia.com>

This is to allow passing misc4 match param from userspace when
function like ib_flow_matcher_create is called.

Signed-off-by: Muhammad Sammar <muhammads@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c    | 3 +--
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h   | 1 +
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
index 7df883686d46..1b3b2acd45c5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
@@ -630,7 +630,7 @@ static int dr_matcher_init(struct mlx5dr_matcher *matcher,
 	}
 
 	if (mask) {
-		if (mask->match_sz > sizeof(struct mlx5dr_match_param)) {
+		if (mask->match_sz > DR_SZ_MATCH_PARAM) {
 			mlx5dr_err(dmn, "Invalid match size attribute\n");
 			return -EINVAL;
 		}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
index b3c9dc032026..6d73719db1f4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
@@ -874,8 +874,7 @@ static bool dr_rule_verify(struct mlx5dr_matcher *matcher,
 	u32 s_idx, e_idx;
 
 	if (!value_size ||
-	    (value_size > sizeof(struct mlx5dr_match_param) ||
-	     (value_size % sizeof(u32)))) {
+	    (value_size > DR_SZ_MATCH_PARAM || (value_size % sizeof(u32)))) {
 		mlx5dr_err(matcher->tbl->dmn, "Rule parameters length is incorrect\n");
 		return false;
 	}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
index f50f3b107aa3..937f469ec678 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
@@ -17,6 +17,7 @@
 #define WIRE_PORT 0xFFFF
 #define DR_STE_SVLAN 0x1
 #define DR_STE_CVLAN 0x2
+#define DR_SZ_MATCH_PARAM (MLX5_ST_SZ_DW_MATCH_PARAM * 4)
 
 #define mlx5dr_err(dmn, arg...) mlx5_core_err((dmn)->mdev, ##arg)
 #define mlx5dr_info(dmn, arg...) mlx5_core_info((dmn)->mdev, ##arg)
-- 
2.26.2


^ permalink raw reply related

* Re: [PATCH bpf-next 4/6] libbpf: add kernel module BTF support for CO-RE relocations
From: Martin KaFai Lau @ 2020-11-20 23:05 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: bpf, netdev, ast, daniel, kernel-team
In-Reply-To: <20201119232244.2776720-5-andrii@kernel.org>

On Thu, Nov 19, 2020 at 03:22:42PM -0800, Andrii Nakryiko wrote:
[ ... ]

> +static int load_module_btfs(struct bpf_object *obj)
> +{
> +	struct bpf_btf_info info;
> +	struct module_btf *mod_btf;
> +	struct btf *btf;
> +	char name[64];
> +	__u32 id, len;
> +	int err, fd;
> +
> +	if (obj->btf_modules_loaded)
> +		return 0;
> +
> +	/* don't do this again, even if we find no module BTFs */
> +	obj->btf_modules_loaded = true;
> +
> +	/* kernel too old to support module BTFs */
> +	if (!kernel_supports(FEAT_MODULE_BTF))
> +		return 0;
> +
> +	while (true) {
> +		err = bpf_btf_get_next_id(id, &id);
> +		if (err && errno == ENOENT)
> +			return 0;
> +		if (err) {
> +			err = -errno;
> +			pr_warn("failed to iterate BTF objects: %d\n", err);
> +			return err;
> +		}
> +
> +		fd = bpf_btf_get_fd_by_id(id);
> +		if (fd < 0) {
> +			if (errno == ENOENT)
> +				continue; /* expected race: BTF was unloaded */
> +			err = -errno;
> +			pr_warn("failed to get BTF object #%d FD: %d\n", id, err);
> +			return err;
> +		}
> +
> +		len = sizeof(info);
> +		memset(&info, 0, sizeof(info));
> +		info.name = ptr_to_u64(name);
> +		info.name_len = sizeof(name);
> +
> +		err = bpf_obj_get_info_by_fd(fd, &info, &len);
> +		if (err) {
> +			err = -errno;
> +			pr_warn("failed to get BTF object #%d info: %d\n", id, err);

			close(fd);

> +			return err;
> +		}
> +
> +		/* ignore non-module BTFs */
> +		if (!info.kernel_btf || strcmp(name, "vmlinux") == 0) {
> +			close(fd);
> +			continue;
> +		}
> +

[ ... ]

> @@ -8656,9 +8815,6 @@ static inline int __find_vmlinux_btf_id(struct btf *btf, const char *name,
>  	else
>  		err = btf__find_by_name_kind(btf, name, BTF_KIND_FUNC);
>  
> -	if (err <= 0)
> -		pr_warn("%s is not found in vmlinux BTF\n", name);
> -
>  	return err;
>  }
>  
> @@ -8675,6 +8831,9 @@ int libbpf_find_vmlinux_btf_id(const char *name,
>  	}
>  
>  	err = __find_vmlinux_btf_id(btf, name, attach_type);
> +	if (err <= 0)
> +		pr_warn("%s is not found in vmlinux BTF\n", name);
> +
Please explain this move in the commit message.

>  	btf__free(btf);
>  	return err;
>  }
> -- 
> 2.24.1
> 

^ permalink raw reply

* Re: [PATCHv3 net-next 0/3] Add devlink and devlink health reporters to
From: Jakub Kicinski @ 2020-11-20 23:06 UTC (permalink / raw)
  To: George Cherian
  Cc: netdev, linux-kernel, davem, sgoutham, lcherian, gakula,
	masahiroy, willemdebruijn.kernel, saeed
In-Reply-To: <20201120062801.2821502-1-george.cherian@marvell.com>

On Fri, 20 Nov 2020 11:57:58 +0530 George Cherian wrote:
> Add basic devlink and devlink health reporters.
> Devlink health reporters are added for NPA and NIX blocks.
> These reporters report the error count in respective blocks.
> 
> Address Jakub's comment to add devlink support for error reporting.
> https://www.spinics.net/lists/netdev/msg670712.html

This series does not apply to net-next, please rebase and repost.

^ permalink raw reply

* Re: [PATCH net-next v2] net: dsa: avoid potential use-after-free error
From: patchwork-bot+netdevbpf @ 2020-11-20 23:10 UTC (permalink / raw)
  To: Christian Eggers
  Cc: andrew, f.fainelli, olteanv, vivien.didelot, davem, kuba, netdev,
	linux-kernel
In-Reply-To: <20201119110906.25558-1-ceggers@arri.de>

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Thu, 19 Nov 2020 12:09:06 +0100 you wrote:
> If dsa_switch_ops::port_txtstamp() returns false, clone will be freed
> immediately. Shouldn't store a pointer to freed memory.
> 
> Signed-off-by: Christian Eggers <ceggers@arri.de>
> Fixes: 146d442c2357 ("net: dsa: Keep a pointer to the skb clone for TX timestamping")
> ---
> Changes since v1:
> - Fixed "Fixes:" tag (and configured my GIT)
> - Adjusted commit description
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: dsa: avoid potential use-after-free error
    https://git.kernel.org/netdev/net-next/c/30abc9cd9c6b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply

* Re: [PATCH net-next 0/3] mvneta: access skb_shared_info only on last frag
From: Jesse Brandeburg @ 2020-11-20 23:10 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, lorenzo.bianconi, davem, kuba, brouer, echaudro,
	john.fastabend
In-Reply-To: <cover.1605889258.git.lorenzo@kernel.org>

Lorenzo Bianconi wrote:

> Build skb_shared_info on mvneta_rx_swbm stack and sync it to xdp_buff
> skb_shared_info area only on the last fragment.
> Avoid avoid unnecessary xdp_buff initialization in mvneta_rx_swbm routine.
> This a preliminary series to complete xdp multi-buff in mvneta driver.
> 
> Lorenzo Bianconi (3):
>   net: mvneta: avoid unnecessary xdp_buff initialization
>   net: mvneta: move skb_shared_info in mvneta_xdp_put_buff
>   net: mvneta: alloc skb_shared_info on the mvneta_rx_swbm stack
> 
>  drivers/net/ethernet/marvell/mvneta.c | 55 +++++++++++++++++----------
>  1 file changed, 35 insertions(+), 20 deletions(-)
> 


For the series:
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>

^ permalink raw reply

* Re: [PATCH net-next] net: don't include ethtool.h from netdevice.h
From: Shannon Nelson @ 2020-11-20 23:10 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, andrew, mkubecek, linux-rdma, linux-wireless
In-Reply-To: <20201120221328.1422925-1-kuba@kernel.org>

On 11/20/20 2:13 PM, Jakub Kicinski wrote:
> linux/netdevice.h is included in very many places, touching any
> of its dependecies causes large incremental builds.
>
> Drop the linux/ethtool.h include, linux/netdevice.h just needs
> a forward declaration of struct ethtool_ops.
>
> Fix all the places which made use of this implicit include.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>   drivers/isdn/capi/capi.c                                 | 1 +
>   drivers/media/pci/ttpci/av7110_av.c                      | 1 +
>   drivers/net/bonding/bond_procfs.c                        | 1 +
>   drivers/net/can/usb/gs_usb.c                             | 1 +
>   drivers/net/ethernet/amazon/ena/ena_ethtool.c            | 1 +
>   drivers/net/ethernet/aquantia/atlantic/aq_nic.h          | 2 ++
>   drivers/net/ethernet/broadcom/bnxt/bnxt.h                | 1 +
>   drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c          | 1 +
>   drivers/net/ethernet/cavium/liquidio/lio_ethtool.c       | 1 +
>   drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c      | 1 +
>   drivers/net/ethernet/chelsio/cxgb4/cxgb4.h               | 1 +
>   drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c           | 1 +
>   drivers/net/ethernet/google/gve/gve_ethtool.c            | 1 +
>   drivers/net/ethernet/hisilicon/hns3/hnae3.h              | 1 +
>   drivers/net/ethernet/huawei/hinic/hinic_port.h           | 1 +
>   drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c         | 1 +
>   drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 1 +
>   drivers/net/ethernet/mellanox/mlx4/mlx4_en.h             | 1 +
>   drivers/net/ethernet/mellanox/mlxsw/spectrum.h           | 1 +
>   drivers/net/ethernet/mellanox/mlxsw/switchx2.c           | 1 +
>   drivers/net/ethernet/pensando/ionic/ionic_lif.c          | 1 +
>   drivers/net/ethernet/pensando/ionic/ionic_stats.c        | 1 +

Acked-by: Shannon Nelson <snelson@pensando.io>

>   drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c          | 1 +
>   drivers/net/geneve.c                                     | 1 +
>   drivers/net/hyperv/netvsc_drv.c                          | 1 +
>   drivers/net/hyperv/rndis_filter.c                        | 1 +
>   drivers/net/ipvlan/ipvlan_main.c                         | 2 ++
>   drivers/net/nlmon.c                                      | 1 +
>   drivers/net/team/team.c                                  | 1 +
>   drivers/net/vrf.c                                        | 1 +
>   drivers/net/vsockmon.c                                   | 1 +
>   drivers/scsi/bnx2fc/bnx2fc_fcoe.c                        | 2 ++
>   drivers/scsi/fcoe/fcoe_transport.c                       | 1 +
>   drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c          | 2 ++
>   drivers/staging/wimax/i2400m/usb.c                       | 1 +
>   include/linux/netdevice.h                                | 2 +-
>   include/linux/qed/qed_if.h                               | 1 +
>   include/net/cfg80211.h                                   | 1 +
>   include/rdma/ib_addr.h                                   | 1 +
>   include/rdma/ib_verbs.h                                  | 1 +
>   net/packet/af_packet.c                                   | 1 +
>   net/sched/sch_cbs.c                                      | 1 +
>   net/sched/sch_taprio.c                                   | 1 +
>   net/socket.c                                             | 1 +
>   44 files changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
> index 85767f52fe3c..fdf87acccd06 100644
> --- a/drivers/isdn/capi/capi.c
> +++ b/drivers/isdn/capi/capi.c
> @@ -11,6 +11,7 @@
>   
>   #include <linux/compiler.h>
>   #include <linux/module.h>
> +#include <linux/ethtool.h>
>   #include <linux/errno.h>
>   #include <linux/kernel.h>
>   #include <linux/major.h>
> diff --git a/drivers/media/pci/ttpci/av7110_av.c b/drivers/media/pci/ttpci/av7110_av.c
> index ea9f7d0058a2..91f4866c7e59 100644
> --- a/drivers/media/pci/ttpci/av7110_av.c
> +++ b/drivers/media/pci/ttpci/av7110_av.c
> @@ -11,6 +11,7 @@
>    * the project's page is at https://linuxtv.org
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/types.h>
>   #include <linux/kernel.h>
>   #include <linux/string.h>
> diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
> index fd5c9cbe45b1..56d34be5e797 100644
> --- a/drivers/net/bonding/bond_procfs.c
> +++ b/drivers/net/bonding/bond_procfs.c
> @@ -1,5 +1,6 @@
>   // SPDX-License-Identifier: GPL-2.0
>   #include <linux/proc_fs.h>
> +#include <linux/ethtool.h>
>   #include <linux/export.h>
>   #include <net/net_namespace.h>
>   #include <net/netns/generic.h>
> diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
> index 3005157059ca..853c7b22aaef 100644
> --- a/drivers/net/can/usb/gs_usb.c
> +++ b/drivers/net/can/usb/gs_usb.c
> @@ -9,6 +9,7 @@
>    * Many thanks to all socketcan devs!
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/init.h>
>   #include <linux/signal.h>
>   #include <linux/module.h>
> diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
> index 3b2cd28f962d..6cdd9efe8df3 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
> @@ -3,6 +3,7 @@
>    * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/pci.h>
>   
>   #include "ena_netdev.h"
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
> index 926cca9a0c83..1a7148041e3d 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
> @@ -10,6 +10,8 @@
>   #ifndef AQ_NIC_H
>   #define AQ_NIC_H
>   
> +#include <linux/ethtool.h>
> +
>   #include "aq_common.h"
>   #include "aq_rss.h"
>   #include "aq_hw.h"
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> index 47b3c3127879..950ea26ae0d2 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> @@ -20,6 +20,7 @@
>   #define DRV_VER_MIN	10
>   #define DRV_VER_UPD	1
>   
> +#include <linux/ethtool.h>
>   #include <linux/interrupt.h>
>   #include <linux/rhashtable.h>
>   #include <linux/crash_dump.h>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
> index 23b80aa171dd..a217316228f4 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
> @@ -8,6 +8,7 @@
>    * the Free Software Foundation.
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/module.h>
>   #include <linux/pci.h>
>   #include <linux/netdevice.h>
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> index 16eebfc52109..66f2c553370c 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
> @@ -15,6 +15,7 @@
>    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
>    * NONINFRINGEMENT.  See the GNU General Public License for more details.
>    ***********************************************************************/
> +#include <linux/ethtool.h>
>   #include <linux/netdevice.h>
>   #include <linux/net_tstamp.h>
>   #include <linux/pci.h>
> diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
> index c7bdac79299a..2f218fbfed06 100644
> --- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
> +++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
> @@ -5,6 +5,7 @@
>   
>   /* ETHTOOL Support for VNIC_VF Device*/
>   
> +#include <linux/ethtool.h>
>   #include <linux/pci.h>
>   #include <linux/net_tstamp.h>
>   
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> index 27308600da15..8e681ce72d62 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> @@ -39,6 +39,7 @@
>   
>   #include <linux/bitops.h>
>   #include <linux/cache.h>
> +#include <linux/ethtool.h>
>   #include <linux/interrupt.h>
>   #include <linux/list.h>
>   #include <linux/netdevice.h>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
> index cd8f9a481d73..d546993bda09 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
> @@ -33,6 +33,7 @@
>    * SOFTWARE.
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/pci.h>
>   
>   #include "t4vf_common.h"
> diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/ethernet/google/gve/gve_ethtool.c
> index 7b44769bd87c..2fb197fd3daf 100644
> --- a/drivers/net/ethernet/google/gve/gve_ethtool.c
> +++ b/drivers/net/ethernet/google/gve/gve_ethtool.c
> @@ -4,6 +4,7 @@
>    * Copyright (C) 2015-2019 Google, Inc.
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/rtnetlink.h>
>   #include "gve.h"
>   #include "gve_adminq.h"
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> index f9d4d234a2af..8cb8f9eb354f 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> @@ -25,6 +25,7 @@
>   #include <linux/dcbnl.h>
>   #include <linux/delay.h>
>   #include <linux/device.h>
> +#include <linux/ethtool.h>
>   #include <linux/module.h>
>   #include <linux/netdevice.h>
>   #include <linux/pci.h>
> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_port.h b/drivers/net/ethernet/huawei/hinic/hinic_port.h
> index 9c3cbe45c9ec..c9ae3d4dc547 100644
> --- a/drivers/net/ethernet/huawei/hinic/hinic_port.h
> +++ b/drivers/net/ethernet/huawei/hinic/hinic_port.h
> @@ -8,6 +8,7 @@
>   #define HINIC_PORT_H
>   
>   #include <linux/types.h>
> +#include <linux/ethtool.h>
>   #include <linux/etherdevice.h>
>   #include <linux/bitops.h>
>   
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
> index 908fefaa6b85..66776ba7bfb6 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
> @@ -1,6 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0
>   /* Copyright(c) 2013 - 2019 Intel Corporation. */
>   
> +#include <linux/ethtool.h>
>   #include <linux/vmalloc.h>
>   
>   #include "fm10k.h"
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> index b18b45d02165..724040743a6d 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> @@ -11,6 +11,7 @@
>   #ifndef OTX2_COMMON_H
>   #define OTX2_COMMON_H
>   
> +#include <linux/ethtool.h>
>   #include <linux/pci.h>
>   #include <linux/iommu.h>
>   #include <linux/net_tstamp.h>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> index a46efe37cfa9..6e02910f7692 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> @@ -36,6 +36,7 @@
>   
>   #include <linux/bitops.h>
>   #include <linux/compiler.h>
> +#include <linux/ethtool.h>
>   #include <linux/list.h>
>   #include <linux/mutex.h>
>   #include <linux/netdevice.h>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
> index 74b3959b36d4..642099fee380 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
> @@ -4,6 +4,7 @@
>   #ifndef _MLXSW_SPECTRUM_H
>   #define _MLXSW_SPECTRUM_H
>   
> +#include <linux/ethtool.h>
>   #include <linux/types.h>
>   #include <linux/netdevice.h>
>   #include <linux/rhashtable.h>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
> index 5023d91269f4..40e2e79d4517 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
> @@ -6,6 +6,7 @@
>   #include <linux/types.h>
>   #include <linux/pci.h>
>   #include <linux/netdevice.h>
> +#include <linux/ethtool.h>
>   #include <linux/etherdevice.h>
>   #include <linux/slab.h>
>   #include <linux/device.h>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index deabd813e3fe..0afec2fa572d 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -1,6 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0
>   /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
>   
> +#include <linux/ethtool.h>
>   #include <linux/printk.h>
>   #include <linux/dynamic_debug.h>
>   #include <linux/netdevice.h>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_stats.c b/drivers/net/ethernet/pensando/ionic/ionic_stats.c
> index ff20a2ac4c2f..6ae75b771a15 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_stats.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_stats.c
> @@ -1,6 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0
>   /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
>   
> +#include <linux/ethtool.h>
>   #include <linux/kernel.h>
>   #include <linux/mutex.h>
>   #include <linux/netdevice.h>
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> index d58b51d277f1..ca1535ebb6e7 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> @@ -5,6 +5,7 @@
>    */
>   
>   #include <linux/etherdevice.h>
> +#include <linux/ethtool.h>
>   #include <linux/if_arp.h>
>   #include <net/pkt_sched.h>
>   #include "rmnet_config.h"
> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> index a3c8ce6deb93..26fd3ab54406 100644
> --- a/drivers/net/geneve.c
> +++ b/drivers/net/geneve.c
> @@ -7,6 +7,7 @@
>   
>   #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>   
> +#include <linux/ethtool.h>
>   #include <linux/kernel.h>
>   #include <linux/module.h>
>   #include <linux/etherdevice.h>
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 261e6e55a907..d17bbc75f5e7 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -10,6 +10,7 @@
>   
>   #include <linux/init.h>
>   #include <linux/atomic.h>
> +#include <linux/ethtool.h>
>   #include <linux/module.h>
>   #include <linux/highmem.h>
>   #include <linux/device.h>
> diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
> index b22e47bcfeca..2c2b55c32a7a 100644
> --- a/drivers/net/hyperv/rndis_filter.c
> +++ b/drivers/net/hyperv/rndis_filter.c
> @@ -6,6 +6,7 @@
>    *   Haiyang Zhang <haiyangz@microsoft.com>
>    *   Hank Janssen  <hjanssen@microsoft.com>
>    */
> +#include <linux/ethtool.h>
>   #include <linux/kernel.h>
>   #include <linux/sched.h>
>   #include <linux/wait.h>
> diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
> index 60b7d93bb834..a707502a0c0f 100644
> --- a/drivers/net/ipvlan/ipvlan_main.c
> +++ b/drivers/net/ipvlan/ipvlan_main.c
> @@ -2,6 +2,8 @@
>   /* Copyright (c) 2014 Mahesh Bandewar <maheshb@google.com>
>    */
>   
> +#include <linux/ethtool.h>
> +
>   #include "ipvlan.h"
>   
>   static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval,
> diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c
> index afb119f38325..5e19a6839dea 100644
> --- a/drivers/net/nlmon.c
> +++ b/drivers/net/nlmon.c
> @@ -1,4 +1,5 @@
>   // SPDX-License-Identifier: GPL-2.0-only
> +#include <linux/ethtool.h>
>   #include <linux/module.h>
>   #include <linux/kernel.h>
>   #include <linux/netdevice.h>
> diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
> index b4092127a92c..c19dac21c468 100644
> --- a/drivers/net/team/team.c
> +++ b/drivers/net/team/team.c
> @@ -4,6 +4,7 @@
>    * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/kernel.h>
>   #include <linux/types.h>
>   #include <linux/module.h>
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index f2793ffde191..f8d711a84763 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -9,6 +9,7 @@
>    * Based on dummy, team and ipvlan drivers
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/module.h>
>   #include <linux/kernel.h>
>   #include <linux/netdevice.h>
> diff --git a/drivers/net/vsockmon.c b/drivers/net/vsockmon.c
> index e8563acf98e8..b1bb1b04b664 100644
> --- a/drivers/net/vsockmon.c
> +++ b/drivers/net/vsockmon.c
> @@ -1,4 +1,5 @@
>   // SPDX-License-Identifier: GPL-2.0-only
> +#include <linux/ethtool.h>
>   #include <linux/module.h>
>   #include <linux/kernel.h>
>   #include <linux/if_arp.h>
> diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> index 6890bbe04a8c..1528ef69a514 100644
> --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> @@ -14,6 +14,8 @@
>    * Written by: Bhanu Prakash Gollapudi (bprakash@broadcom.com)
>    */
>   
> +#include <linux/ethtool.h>
> +
>   #include "bnx2fc.h"
>   
>   static struct list_head adapter_list;
> diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
> index 6e187d0e71fd..b927b3d84523 100644
> --- a/drivers/scsi/fcoe/fcoe_transport.c
> +++ b/drivers/scsi/fcoe/fcoe_transport.c
> @@ -10,6 +10,7 @@
>   #include <linux/kernel.h>
>   #include <linux/list.h>
>   #include <linux/netdevice.h>
> +#include <linux/ethtool.h>
>   #include <linux/errno.h>
>   #include <linux/crc32.h>
>   #include <scsi/libfcoe.h>
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c
> index ace4a6d28562..ad55cd738847 100644
> --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c
> +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c
> @@ -7,6 +7,8 @@
>    *
>    */
>   
> +#include <linux/ethtool.h>
> +
>   #include "ethsw.h"
>   
>   static struct {
> diff --git a/drivers/staging/wimax/i2400m/usb.c b/drivers/staging/wimax/i2400m/usb.c
> index 3b84dd7b5567..f250d03ce7c7 100644
> --- a/drivers/staging/wimax/i2400m/usb.c
> +++ b/drivers/staging/wimax/i2400m/usb.c
> @@ -51,6 +51,7 @@
>   #include "i2400m-usb.h"
>   #include "linux-wimax-i2400m.h"
>   #include <linux/debugfs.h>
> +#include <linux/ethtool.h>
>   #include <linux/slab.h>
>   #include <linux/module.h>
>   
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 03433a4c929e..0049e8fe4905 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -34,7 +34,6 @@
>   #include <linux/workqueue.h>
>   #include <linux/dynamic_queue_limits.h>
>   
> -#include <linux/ethtool.h>
>   #include <net/net_namespace.h>
>   #ifdef CONFIG_DCB
>   #include <net/dcbnl.h>
> @@ -51,6 +50,7 @@
>   
>   struct netpoll_info;
>   struct device;
> +struct ethtool_ops;
>   struct phy_device;
>   struct dsa_port;
>   struct ip_tunnel_parm;
> diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
> index 57fb295ea41a..68d17a4fbf20 100644
> --- a/include/linux/qed/qed_if.h
> +++ b/include/linux/qed/qed_if.h
> @@ -7,6 +7,7 @@
>   #ifndef _QED_IF_H
>   #define _QED_IF_H
>   
> +#include <linux/ethtool.h>
>   #include <linux/types.h>
>   #include <linux/interrupt.h>
>   #include <linux/netdevice.h>
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index ab249ca5d5d1..78c763dfc99a 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -10,6 +10,7 @@
>    * Copyright (C) 2018-2020 Intel Corporation
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/netdevice.h>
>   #include <linux/debugfs.h>
>   #include <linux/list.h>
> diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
> index b0e636ac6690..d808dc3d239e 100644
> --- a/include/rdma/ib_addr.h
> +++ b/include/rdma/ib_addr.h
> @@ -7,6 +7,7 @@
>   #ifndef IB_ADDR_H
>   #define IB_ADDR_H
>   
> +#include <linux/ethtool.h>
>   #include <linux/in.h>
>   #include <linux/in6.h>
>   #include <linux/if_arp.h>
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 9bf6c319a670..3883efd588aa 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -12,6 +12,7 @@
>   #ifndef IB_VERBS_H
>   #define IB_VERBS_H
>   
> +#include <linux/ethtool.h>
>   #include <linux/types.h>
>   #include <linux/device.h>
>   #include <linux/dma-mapping.h>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 62ebfaa7adcb..48a0ed836b46 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -46,6 +46,7 @@
>    *					Copyright (C) 2011, <lokec@ccs.neu.edu>
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/types.h>
>   #include <linux/mm.h>
>   #include <linux/capability.h>
> diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
> index 2eaac2ff380f..459cc240eda9 100644
> --- a/net/sched/sch_cbs.c
> +++ b/net/sched/sch_cbs.c
> @@ -50,6 +50,7 @@
>    *	locredit = max_frame_size * (sendslope / port_transmit_rate)
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/module.h>
>   #include <linux/types.h>
>   #include <linux/kernel.h>
> diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
> index b0ad7687ee2c..26fb8a62996b 100644
> --- a/net/sched/sch_taprio.c
> +++ b/net/sched/sch_taprio.c
> @@ -6,6 +6,7 @@
>    *
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/types.h>
>   #include <linux/slab.h>
>   #include <linux/kernel.h>
> diff --git a/net/socket.c b/net/socket.c
> index 152b1dcf93c6..bfef11ba35b8 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -52,6 +52,7 @@
>    *	Based upon Swansea University Computer Society NET3.039
>    */
>   
> +#include <linux/ethtool.h>
>   #include <linux/mm.h>
>   #include <linux/socket.h>
>   #include <linux/file.h>


^ permalink raw reply

* Re: [PATCH net-next v4 2/5] net/lapb: support netdev events
From: Xie He @ 2020-11-20 23:11 UTC (permalink / raw)
  To: Martin Schiller
  Cc: Andrew Hendry, David S. Miller, Jakub Kicinski, Linux X25,
	Linux Kernel Network Developers, LKML
In-Reply-To: <20201120054036.15199-3-ms@dev.tdt.de>

Should we also handle the NETDEV_UP event here? In previous versions
of this patch series you seemed to want to establish the L2 connection
on device-up. But in this patch, you didn't handle NETDEV_UP.

Maybe on device-up, we need to check if the carrier is up, and if it
is, we do the same thing as we do on carrier-up.

^ permalink raw reply

* Re: [PATCH bpf-next 4/6] libbpf: add kernel module BTF support for CO-RE relocations
From: Andrii Nakryiko @ 2020-11-20 23:12 UTC (permalink / raw)
  To: Martin KaFai Lau
  Cc: Andrii Nakryiko, bpf, Networking, Alexei Starovoitov,
	Daniel Borkmann, Kernel Team
In-Reply-To: <20201120230549.37k4zsjsrxbyjin3@kafai-mbp.dhcp.thefacebook.com>

On Fri, Nov 20, 2020 at 3:06 PM Martin KaFai Lau <kafai@fb.com> wrote:
>
> On Thu, Nov 19, 2020 at 03:22:42PM -0800, Andrii Nakryiko wrote:
> [ ... ]
>
> > +static int load_module_btfs(struct bpf_object *obj)
> > +{
> > +     struct bpf_btf_info info;
> > +     struct module_btf *mod_btf;
> > +     struct btf *btf;
> > +     char name[64];
> > +     __u32 id, len;
> > +     int err, fd;
> > +
> > +     if (obj->btf_modules_loaded)
> > +             return 0;
> > +
> > +     /* don't do this again, even if we find no module BTFs */
> > +     obj->btf_modules_loaded = true;
> > +
> > +     /* kernel too old to support module BTFs */
> > +     if (!kernel_supports(FEAT_MODULE_BTF))
> > +             return 0;
> > +
> > +     while (true) {
> > +             err = bpf_btf_get_next_id(id, &id);
> > +             if (err && errno == ENOENT)
> > +                     return 0;
> > +             if (err) {
> > +                     err = -errno;
> > +                     pr_warn("failed to iterate BTF objects: %d\n", err);
> > +                     return err;
> > +             }
> > +
> > +             fd = bpf_btf_get_fd_by_id(id);
> > +             if (fd < 0) {
> > +                     if (errno == ENOENT)
> > +                             continue; /* expected race: BTF was unloaded */
> > +                     err = -errno;
> > +                     pr_warn("failed to get BTF object #%d FD: %d\n", id, err);
> > +                     return err;
> > +             }
> > +
> > +             len = sizeof(info);
> > +             memset(&info, 0, sizeof(info));
> > +             info.name = ptr_to_u64(name);
> > +             info.name_len = sizeof(name);
> > +
> > +             err = bpf_obj_get_info_by_fd(fd, &info, &len);
> > +             if (err) {
> > +                     err = -errno;
> > +                     pr_warn("failed to get BTF object #%d info: %d\n", id, err);
>
>                         close(fd);
>
> > +                     return err;
> > +             }
> > +
> > +             /* ignore non-module BTFs */
> > +             if (!info.kernel_btf || strcmp(name, "vmlinux") == 0) {
> > +                     close(fd);
> > +                     continue;
> > +             }
> > +
>
> [ ... ]
>
> > @@ -8656,9 +8815,6 @@ static inline int __find_vmlinux_btf_id(struct btf *btf, const char *name,
> >       else
> >               err = btf__find_by_name_kind(btf, name, BTF_KIND_FUNC);
> >
> > -     if (err <= 0)
> > -             pr_warn("%s is not found in vmlinux BTF\n", name);
> > -
> >       return err;
> >  }
> >
> > @@ -8675,6 +8831,9 @@ int libbpf_find_vmlinux_btf_id(const char *name,
> >       }
> >
> >       err = __find_vmlinux_btf_id(btf, name, attach_type);
> > +     if (err <= 0)
> > +             pr_warn("%s is not found in vmlinux BTF\n", name);
> > +
> Please explain this move in the commit message.

ok, I'll add something about that. The short answer is that
__find_vmlinux_btf_id() is now expected to not find a type in vmlinux
BTF, so emitting error would be wrong. So I moved it up a level where
it's not expected.

>
> >       btf__free(btf);
> >       return err;
> >  }
> > --
> > 2.24.1
> >

^ permalink raw reply

* Re: [PATCH net-next v3 07/12] net: dsa: microchip: ksz9477: add Posix clock support for chip PTP clock
From: Vladimir Oltean @ 2020-11-20 23:14 UTC (permalink / raw)
  To: Christian Eggers
  Cc: Jakub Kicinski, Andrew Lunn, Richard Cochran, Rob Herring,
	Vivien Didelot, David S . Miller, Kurt Kanzenbach,
	George McCollister, Marek Vasut, Helmut Grohne, Paul Barker,
	Codrin Ciubotariu, Tristram Ha, Woojung Huh,
	Microchip Linux Driver Support, netdev, devicetree, linux-kernel
In-Reply-To: <20201118203013.5077-8-ceggers@arri.de>

On Wed, Nov 18, 2020 at 09:30:08PM +0100, Christian Eggers wrote:
> Implement routines (adjfine, adjtime, gettime and settime) for
> manipulating the chip's PTP clock.
> 
> Signed-off-by: Christian Eggers <ceggers@arri.de>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

^ permalink raw reply

* Re: [PATCH] net: adaptec: remove dead code in set_vlan_mode
From: Jakub Kicinski @ 2020-11-20 23:17 UTC (permalink / raw)
  To: xiakaixu1987, Ion Badulescu
  Cc: ionut, leon, davem, netdev, linux-kernel, Kaixu Xia,
	Arnd Bergmann
In-Reply-To: <1605858600-7096-1-git-send-email-kaixuxia@tencent.com>

On Fri, 20 Nov 2020 15:50:00 +0800 xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The body of the if statement can be executed only when the variable
> vlan_count equals to 32, so the condition of the while statement can
> not be true and the while statement is dead code. Remove it.
> 
> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> ---
>  drivers/net/ethernet/adaptec/starfire.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c
> index 555299737b51..ad27a9fa5e95 100644
> --- a/drivers/net/ethernet/adaptec/starfire.c
> +++ b/drivers/net/ethernet/adaptec/starfire.c
> @@ -1754,14 +1754,9 @@ static u32 set_vlan_mode(struct netdev_private *np)
>  		filter_addr += 16;
>  		vlan_count++;
>  	}
> -	if (vlan_count == 32) {
> +	if (vlan_count == 32)
>  		ret |= PerfectFilterVlan;
> -		while (vlan_count < 32) {
> -			writew(0, filter_addr);
> -			filter_addr += 16;
> -			vlan_count++;
> -		}
> -	}
> +
>  	return ret;
>  }
>  #endif /* VLAN_SUPPORT */

This got broken back in 2011:

commit 5da96be53a16a62488316810d0c7c5d58ce3ee4f
Author: Jiri Pirko <jpirko@redhat.com>
Date:   Wed Jul 20 04:54:31 2011 +0000

    starfire: do vlan cleanup
    
    - unify vlan and nonvlan rx path
    - kill np->vlgrp and netdev_vlan_rx_register
    
    Signed-off-by: Jiri Pirko <jpirko@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

The comparison to 32 was on a different variable before that change.

Ion, do you think anyone is still using this driver?

Maybe it's time we put it in the history book (by which I mean remove
from the kernel).

^ permalink raw reply

* Re: [PATCH bpf-next 5/6] selftests/bpf: add bpf_sidecar kernel module for testing
From: Martin KaFai Lau @ 2020-11-20 23:21 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: bpf, netdev, ast, daniel, kernel-team
In-Reply-To: <20201119232244.2776720-6-andrii@kernel.org>

On Thu, Nov 19, 2020 at 03:22:43PM -0800, Andrii Nakryiko wrote:
> Add bpf_sidecar module, which is conceptually out-of-tree module and provides
> ways for selftests/bpf to test various kernel module-related functionality:
> raw tracepoint, fentry/fexit/fmod_ret, etc. This module will be auto-loaded by
> test_progs test runner and expected by some of selftests to be present and
> loaded.
Acked-by: Martin KaFai Lau <kafai@fb.com>

^ permalink raw reply

* [PATCH net-next] net: warn if gso_type isn't set for a GSO SKB
From: Heiner Kallweit @ 2020-11-20 23:22 UTC (permalink / raw)
  To: Jakub Kicinski, David Miller, Eric Dumazet
  Cc: netdev@vger.kernel.org, Linux Kernel Mailing List

In bug report [0] a warning in r8169 driver was reported that was
caused by an invalid GSO SKB (gso_type was 0). See [1] for a discussion
about this issue. Still the origin of the invalid GSO SKB isn't clear.

It shouldn't be a network drivers task to check for invalid GSO SKB's.
Also, even if issue [0] can be fixed, we can't be sure that a
similar issue doesn't pop up again at another place.
Therefore let gso_features_check() check for such invalid GSO SKB's.

[0] https://bugzilla.kernel.org/show_bug.cgi?id=209423
[1] https://www.spinics.net/lists/netdev/msg690794.html

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 net/core/dev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 4bfdcd6b2..3c3070d9d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3495,6 +3495,11 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb,
 	if (gso_segs > dev->gso_max_segs)
 		return features & ~NETIF_F_GSO_MASK;
 
+	if (!skb_shinfo(skb)->gso_type) {
+		skb_warn_bad_offload(skb);
+		return features & ~NETIF_F_GSO_MASK;
+	}
+
 	/* Support for GSO partial features requires software
 	 * intervention before we can actually process the packets
 	 * so we need to strip support for any partial features now
-- 
2.29.2


^ permalink raw reply related

* Re: [PATCH net-next 2/3] net: dsa: add Arrow SpeedChips XRS700x driver
From: Andrew Lunn @ 2020-11-20 23:24 UTC (permalink / raw)
  To: George McCollister
  Cc: Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, netdev, open list:OPEN FIRMWARE AND...
In-Reply-To: <CAFSKS=P=epx3Sr3OzkCg9ycoftmXm__PaMee7HWbAGXYdqgbDw@mail.gmail.com>

Hi George

> > > +static void xrs700x_port_stp_state_set(struct dsa_switch *ds, int port,
> > > +                                    u8 state)
> > > +{
> > > +     struct xrs700x *priv = ds->priv;
> > > +     unsigned int val;
> > > +
> > > +     switch (state) {
> > > +     case BR_STATE_DISABLED:
> > > +             val = XRS_PORT_DISABLED;
> > > +             break;
> > > +     case BR_STATE_LISTENING:
> > > +             val = XRS_PORT_DISABLED;
> > > +             break;
> >
> > No listening state?
> 
> No, just forwarding, learning and disabled. See:
> https://www.flexibilis.com/downloads/xrs/SpeedChip_XRS7000_3000_User_Manual.pdf
> page 82.
> 
> >
> > > +     case BR_STATE_LEARNING:
> > > +             val = XRS_PORT_LEARNING;
> > > +             break;
> > > +     case BR_STATE_FORWARDING:
> > > +             val = XRS_PORT_FORWARDING;
> > > +             break;
> > > +     case BR_STATE_BLOCKING:
> > > +             val = XRS_PORT_DISABLED;
> > > +             break;
> >
> > Hum. What exactly does XRS_PORT_DISABLED mean? When blocking, it is
> > expected you can still send/receive BPDUs.
> 
> Datasheet says: "Disabled. Port neither learns MAC addresses nor forwards data."

I think you need to do some testing here. Put the device into a loop
with another switch, the bridge will block a port, and see if it still
can send/receive BPDUs on the blocked port.

If it cannot send/receive BPDUs, it might get into an oscillating
state. They see each other via BPDUs, decide there is a loop, and
block a port. The BPDUs stop, they think the loop has been broken and
so unblock. They see each other via BPUS, decide there is a loop,...

> > > +static int xrs700x_i2c_reg_read(void *context, unsigned int reg,
> > > +                             unsigned int *val)
> > > +{
> > > +     int ret;
> > > +     unsigned char buf[4];
> > > +     struct device *dev = context;
> > > +     struct i2c_client *i2c = to_i2c_client(dev);
> > > +
> > > +     buf[0] = reg >> 23 & 0xff;
> > > +     buf[1] = reg >> 15 & 0xff;
> > > +     buf[2] = reg >> 7 & 0xff;
> > > +     buf[3] = (reg & 0x7f) << 1;
> > > +
> > > +     ret = i2c_master_send(i2c, buf, sizeof(buf));
> >
> > Are you allowed to perform transfers on stack buffers? I think any I2C
> > bus driver using DMA is going to be unhappy.
> 
> It should be fine. See the following file, there is a good write up about this:
> See Documentation/i2c/dma-considerations.rst

O.K, thanks for the pointer.

> > > +static const struct of_device_id xrs700x_i2c_dt_ids[] = {
> > > +     { .compatible = "arrow,xrs7003" },
> > > +     { .compatible = "arrow,xrs7004" },
> > > +     {},
> >
> > Please validate that the compatible string actually matches the switch
> > found. Otherwise we can get into all sorts of horrible backward
> > compatibility issues.
> 
> Okay. What kind of compatibility issues? Do you have a hypothetical
> example? I guess I will just use of_device_is_compatible() to check.

Since it currently does not matter, you can expect 50% of the boards
to get it wrong. Sometime later, you find some difference between the
two, you want to add additional optional properties dependent on the
compatible string. But that is made hard, because 50% of the boards
are broken, and the compatible string is now worthless.

Either you need to verify the compatible from day one so it is not
wrong, or you just use a single compatible "arrow,xrs700x", which
cannot be wrong.

  Andrew

^ permalink raw reply

* Re: [PATCH net-next v3 09/12] net: dsa: microchip: ksz9477: initial hardware time stamping support
From: Vladimir Oltean @ 2020-11-20 23:27 UTC (permalink / raw)
  To: Christian Eggers
  Cc: Jakub Kicinski, Andrew Lunn, Richard Cochran, Rob Herring,
	Vivien Didelot, David S . Miller, Kurt Kanzenbach,
	George McCollister, Marek Vasut, Helmut Grohne, Paul Barker,
	Codrin Ciubotariu, Tristram Ha, Woojung Huh,
	Microchip Linux Driver Support, netdev, devicetree, linux-kernel
In-Reply-To: <20201118203013.5077-10-ceggers@arri.de>

On Wed, Nov 18, 2020 at 09:30:10PM +0100, Christian Eggers wrote:
> Add control routines required for TX hardware time stamping.
> 
> The KSZ9563 only supports one step time stamping
> (HWTSTAMP_TX_ONESTEP_P2P), which requires linuxptp-2.0 or later.
> 
> Currently, only P2P delay measurement is supported. See patchwork
> discussion and comments in ksz9477_ptp_init() for details:
> https://patchwork.ozlabs.org/project/netdev/patch/20201019172435.4416-8-ceggers@arri.de/
> 
> Signed-off-by: Christian Eggers <ceggers@arri.de>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

> +static int ksz9477_set_hwtstamp_config(struct ksz_device *dev, int port,
> +				       struct hwtstamp_config *config)
> +{
> +	struct ksz_port *prt = &dev->ports[port];
> +
> +	/* reserved for future extensions */
> +	if (config->flags)
> +		return -EINVAL;
> +
> +	switch (config->tx_type) {
> +	case HWTSTAMP_TX_OFF:
> +		prt->hwts_tx_en = false;
> +		break;
> +	case HWTSTAMP_TX_ONESTEP_P2P:
> +		prt->hwts_tx_en = true;
> +		break;
> +	default:
> +		return -ERANGE;
> +	}
> +
> +	switch (config->rx_filter) {
> +	case HWTSTAMP_FILTER_NONE:
> +		break;
> +	case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
> +	case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
> +		config->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
> +		break;
> +	case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
> +	case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
> +		config->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
> +		break;
> +	case HWTSTAMP_FILTER_PTP_V2_EVENT:
> +	case HWTSTAMP_FILTER_PTP_V2_SYNC:
> +		config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
> +		break;
> +	case HWTSTAMP_FILTER_ALL:

Putting anything in the same "case" statement as "default" is useless.

> +	default:
> +		config->rx_filter = HWTSTAMP_FILTER_NONE;
> +		return -ERANGE;
> +	}
> +
> +	return 0;
> +}

^ permalink raw reply

* Re: [PATCH bpf-next 6/6] selftests/bpf: add CO-RE relocs selftest relying on kernel module BTF
From: Martin KaFai Lau @ 2020-11-20 23:27 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: bpf, netdev, ast, daniel, kernel-team
In-Reply-To: <20201119232244.2776720-7-andrii@kernel.org>

On Thu, Nov 19, 2020 at 03:22:44PM -0800, Andrii Nakryiko wrote:
> Add a self-tests validating libbpf is able to perform CO-RE relocations
> against the type defined in kernel module BTF.
Acked-by: Martin KaFai Lau <kafai@fb.com>

^ permalink raw reply

* Re: [PATCH net] dpaa2-eth: select XGMAC_MDIO for MDIO bus support
From: patchwork-bot+netdevbpf @ 2020-11-20 23:30 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: kuba, davem, netdev, ioana.ciornei
In-Reply-To: <20201119145106.712761-1-ciorneiioana@gmail.com>

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu, 19 Nov 2020 16:51:06 +0200 you wrote:
> From: Ioana Ciornei <ioana.ciornei@nxp.com>
> 
> Explicitly enable the FSL_XGMAC_MDIO Kconfig option in order to have
> MDIO access to internal and external PHYs.
> 
> Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> 
> [...]

Here is the summary with links:
  - [net] dpaa2-eth: select XGMAC_MDIO for MDIO bus support
    https://git.kernel.org/netdev/net/c/d2624e70a2f5

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply

* Re: [PATCH net-next 0/8] mlxsw: Add support for nexthop objects
From: patchwork-bot+netdevbpf @ 2020-11-20 23:30 UTC (permalink / raw)
  To: Ido Schimmel; +Cc: netdev, davem, kuba, dsahern, jiri, mlxsw, idosch
In-Reply-To: <20201119130848.407918-1-idosch@idosch.org>

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Thu, 19 Nov 2020 15:08:40 +0200 you wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> This patch set adds support for nexthop objects in mlxsw. Nexthop
> objects are treated as another front-end for programming nexthops, in
> addition to the existing IPv4 and IPv6 front-ends.
> 
> Patch #1 registers a listener to the nexthop notification chain and
> parses the nexthop information into the existing mlxsw data structures
> that are already used by the IPv4 and IPv6 front-ends. Blackhole
> nexthops are currently rejected. Support will be added in a follow-up
> patch set.
> 
> [...]

Here is the summary with links:
  - [net-next,1/8] mlxsw: spectrum_router: Add support for nexthop objects
    https://git.kernel.org/netdev/net-next/c/2a014b200bbd
  - [net-next,2/8] mlxsw: spectrum_router: Enable resolution of nexthop groups from nexthop objects
    https://git.kernel.org/netdev/net-next/c/c25db3a77f61
  - [net-next,3/8] mlxsw: spectrum_router: Allow programming routes with nexthop objects
    https://git.kernel.org/netdev/net-next/c/cdd6cfc54c64
  - [net-next,4/8] selftests: mlxsw: Add nexthop objects configuration tests
    https://git.kernel.org/netdev/net-next/c/20ac8f869053
  - [net-next,5/8] selftests: forwarding: Do not configure nexthop objects twice
    https://git.kernel.org/netdev/net-next/c/ffb721515bf3
  - [net-next,6/8] selftests: forwarding: Test IPv4 routes with IPv6 link-local nexthops
    https://git.kernel.org/netdev/net-next/c/3600f29ad139
  - [net-next,7/8] selftests: forwarding: Add device-only nexthop test
    https://git.kernel.org/netdev/net-next/c/e96fa54bbd90
  - [net-next,8/8] selftests: forwarding: Add multipath tunneling nexthop test
    https://git.kernel.org/netdev/net-next/c/e035146d6560

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply

* Re: [PATCH net-next 00/10] mptcp: More miscellaneous MPTCP fixes
From: Jakub Kicinski @ 2020-11-20 23:35 UTC (permalink / raw)
  To: Mat Martineau; +Cc: netdev, mptcp
In-Reply-To: <20201119194603.103158-1-mathew.j.martineau@linux.intel.com>

On Thu, 19 Nov 2020 11:45:53 -0800 Mat Martineau wrote:
> Here's another batch of fixup and enhancement patches that we have
> collected in the MPTCP tree.
> 
> Patch 1 removes an unnecessary flag and related code.
> 
> Patch 2 fixes a bug encountered when closing fallback sockets.
> 
> Patches 3 and 4 choose a better transmit subflow, with a self test.
> 
> Patch 5 adjusts tracking of unaccepted subflows
> 
> Patches 6-8 improve handling of long ADD_ADDR options, with a test.
> 
> Patch 9 more reliably tracks the MPTCP-level window shared with peers.
> 
> Patch 10 sends MPTCP-level acknowledgements more aggressively, so the
> peer can send more data without extra delay.

Applied, thanks!

^ permalink raw reply

* Re: [PATCH net-next v3 12/12] net: dsa: microchip: ksz9477: add periodic output support
From: Vladimir Oltean @ 2020-11-20 23:48 UTC (permalink / raw)
  To: Christian Eggers
  Cc: Jakub Kicinski, Andrew Lunn, Richard Cochran, Rob Herring,
	Vivien Didelot, David S . Miller, Kurt Kanzenbach,
	George McCollister, Marek Vasut, Helmut Grohne, Paul Barker,
	Codrin Ciubotariu, Tristram Ha, Woojung Huh,
	Microchip Linux Driver Support, netdev, devicetree, linux-kernel
In-Reply-To: <20201118203013.5077-13-ceggers@arri.de>

On Wed, Nov 18, 2020 at 09:30:13PM +0100, Christian Eggers wrote:
> The KSZ9563 has a Trigger Output Unit (TOU) which can be used to
> generate periodic signals.
> 
> The pulse length can be altered via a device attribute.
> 
> Tested on a Microchip KSZ9563 switch.
> 
> Signed-off-by: Christian Eggers <ceggers@arri.de>
> ---
>  drivers/net/dsa/microchip/ksz9477_ptp.c | 197 +++++++++++++++++++++++-
>  drivers/net/dsa/microchip/ksz_common.h  |   5 +
>  2 files changed, 201 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz9477_ptp.c b/drivers/net/dsa/microchip/ksz9477_ptp.c
> index ce3fdc9a1f9e..3174574d52f6 100644
> --- a/drivers/net/dsa/microchip/ksz9477_ptp.c
> +++ b/drivers/net/dsa/microchip/ksz9477_ptp.c
> @@ -90,6 +90,20 @@ static int ksz9477_ptp_tou_cycle_count_set(struct ksz_device *dev, u16 count)
>  	return 0;
>  }
>  
> +static int ksz9477_ptp_tou_pulse_verify(u64 pulse_ns)
> +{
> +	u32 data;
> +
> +	if (pulse_ns & 0x3)
> +		return -EINVAL;
> +
> +	data = (pulse_ns / 8);
> +	if (data != (data & TRIG_PULSE_WIDTH_M))
> +		return -ERANGE;
> +
> +	return 0;
> +}
> +
>  static int ksz9477_ptp_tou_pulse_set(struct ksz_device *dev, u32 pulse_ns)
>  {
>  	u32 data;
> @@ -196,6 +210,7 @@ static int ksz9477_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
>  	return ret;
>  }
>  
> +static int ksz9477_ptp_restart_perout(struct ksz_device *dev);
>  static int ksz9477_ptp_enable_pps(struct ksz_device *dev, int on);
>  
>  static int ksz9477_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
> @@ -241,6 +256,15 @@ static int ksz9477_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
>  	case KSZ_PTP_TOU_IDLE:
>  		break;
>  
> +	case KSZ_PTP_TOU_PEROUT:
> +		dev_info(dev->dev, "Restarting periodic output signal\n");

Isn't this a bit too verbose, or is there something for the user to be
concerned about?

> +
> +		ret = ksz9477_ptp_restart_perout(dev);
> +		if (ret)
> +			goto error_return;
> +
> +		break;
> +
>  	case KSZ_PTP_TOU_PPS:
>  		dev_info(dev->dev, "Restarting PPS\n");
>  
> @@ -358,6 +382,15 @@ static int ksz9477_ptp_settime(struct ptp_clock_info *ptp,
>  	case KSZ_PTP_TOU_IDLE:
>  		break;
>  
> +	case KSZ_PTP_TOU_PEROUT:
> +		dev_info(dev->dev, "Restarting periodic output signal\n");
> +
> +		ret = ksz9477_ptp_restart_perout(dev);
> +		if (ret)
> +			goto error_return;
> +
> +		break;
> +
>  	case KSZ_PTP_TOU_PPS:
>  		dev_info(dev->dev, "Restarting PPS\n");
>  
> @@ -377,6 +410,159 @@ static int ksz9477_ptp_settime(struct ptp_clock_info *ptp,
>  	return ret;
>  }
>  
> +static int ksz9477_ptp_configure_perout(struct ksz_device *dev, u32 cycle_width_ns,

Watch out for 80 characters, please!

> +					u16 cycle_count, u32 pulse_width_ns,
> +					struct timespec64 const *target_time)
> +{
> +	int ret;
> +	u32 trig_ctrl;

Reverse Christmas tree.

> +
> +	/* Enable notify, set rising edge, set periodic pattern */
> +	trig_ctrl = TRIG_NOTIFY | (TRIG_POS_PERIOD << TRIG_PATTERN_S);
> +	ret = ksz_write32(dev, REG_TRIG_CTRL__4, trig_ctrl);
> +	if (ret)
> +		return ret;
> +
> +	ret = ksz9477_ptp_tou_cycle_width_set(dev, cycle_width_ns);
> +	if (ret)
> +		return ret;
> +
> +	ksz9477_ptp_tou_cycle_count_set(dev,  cycle_count);
> +	if (ret)
> +		return ret;
> +
> +	ret = ksz9477_ptp_tou_pulse_set(dev, pulse_width_ns);
> +	if (ret)
> +		return ret;
> +
> +	ret = ksz9477_ptp_tou_target_time_set(dev, target_time);
> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}
> +
> +static int ksz9477_ptp_enable_perout(struct ksz_device *dev,
> +				     struct ptp_perout_request const *perout_request, int on)
> +{
> +	u32 gpio_stat0;
> +	u64 cycle_width_ns;
> +	int ret;
> +
> +	if (dev->ptp_tou_mode != KSZ_PTP_TOU_PEROUT && dev->ptp_tou_mode != KSZ_PTP_TOU_IDLE)
> +		return -EBUSY;
> +
> +	ret = ksz9477_ptp_tou_reset(dev, 0);
> +	if (ret)
> +		return ret;
> +
> +	if (!on) {
> +		dev->ptp_tou_mode = KSZ_PTP_TOU_IDLE;
> +		return 0;  /* success */
> +	}
> +
> +	dev->ptp_perout_target_time_first.tv_sec  = perout_request->start.sec;
> +	dev->ptp_perout_target_time_first.tv_nsec = perout_request->start.nsec;
> +
> +	dev->ptp_perout_period.tv_sec = perout_request->period.sec;
> +	dev->ptp_perout_period.tv_nsec = perout_request->period.nsec;
> +
> +	cycle_width_ns = timespec64_to_ns(&dev->ptp_perout_period);
> +	if ((cycle_width_ns & GENMASK(31, 0)) != cycle_width_ns)
> +		return -EINVAL;
> +
> +	if (perout_request->flags & PTP_PEROUT_DUTY_CYCLE) {
> +		u64 value = perout_request->on.sec * NSEC_PER_SEC +
> +			    perout_request->on.nsec;
> +
> +		ret = ksz9477_ptp_tou_pulse_verify(value);
> +		if (ret)
> +			return ret;
> +
> +		dev->ptp_perout_pulse_width_ns = value;
> +	}

It is not guaranteed that user space will set this flag. Shouldn't you
assign a default value for the pulse width? I don't know, half the
period should be a good default.

Also, please reject PTP_PEROUT_ONE_SHOT and PTP_PEROUT_PHASE, since you
don't do anything with them, but user space might be led into believing
otherwise.

> +
> +	ret = ksz9477_ptp_configure_perout(dev, cycle_width_ns,
> +					   dev->ptp_perout_cycle_count,
> +					   dev->ptp_perout_pulse_width_ns,
> +					   &dev->ptp_perout_target_time_first);
> +	if (ret)
> +		return ret;
> +
> +	/* Activate trigger unit */
> +	ret = ksz9477_ptp_tou_start(dev, NULL);
> +	if (ret)
> +		return ret;
> +
> +	/* Check error flag:
> +	 * - the ACTIVE flag is NOT cleared an error!
> +	 */
> +	ret = ksz_read32(dev, REG_PTP_TRIG_STATUS__4, &gpio_stat0);
> +	if (ret)
> +		return ret;
> +
> +	if (gpio_stat0 & (1 << (0 + TRIG_ERROR_S))) {

What is the role of this "0 +" term here?

> +		dev_err(dev->dev, "%s: Trigger unit0 error!\n", __func__);
> +		ret = -EIO;
> +		/* Unit will be reset on next access */
> +		return ret;
> +	}
> +
> +	dev->ptp_tou_mode = KSZ_PTP_TOU_PEROUT;
> +	return 0;
> +}

^ permalink raw reply

* Re: [PATCH net-next v4 2/5] net/lapb: support netdev events
From: Xie He @ 2020-11-20 23:50 UTC (permalink / raw)
  To: Martin Schiller
  Cc: Andrew Hendry, David S. Miller, Jakub Kicinski, Linux X25,
	Linux Kernel Network Developers, LKML
In-Reply-To: <CAJht_EONd3+S12upVPk2K3PWvzMLdE3BkzY_7c5gA493NHcGnA@mail.gmail.com>

On Fri, Nov 20, 2020 at 3:11 PM Xie He <xie.he.0141@gmail.com> wrote:
>
> Should we also handle the NETDEV_UP event here? In previous versions
> of this patch series you seemed to want to establish the L2 connection
> on device-up. But in this patch, you didn't handle NETDEV_UP.
>
> Maybe on device-up, we need to check if the carrier is up, and if it
> is, we do the same thing as we do on carrier-up.

Are the device up/down status and the carrier up/down status
independent of each other? If they are, on device-up or carrier-up, we
only need to try establishing the L2 connection if we see both are up.

On NETDEV_GOING_DOWN, we can also check the carrier status first and
if it is down, we don't need to call lapb_disconnect_request.

^ permalink raw reply

* Re: [PATCH] net: adaptec: remove dead code in set_vlan_mode
From: Ion Badulescu @ 2020-11-20 23:41 UTC (permalink / raw)
  To: Jakub Kicinski, xiakaixu1987
  Cc: leon, davem, netdev, linux-kernel, Kaixu Xia, Arnd Bergmann
In-Reply-To: <20201120151714.0cc2f00b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On 11/20/20 6:17 PM, Jakub Kicinski wrote:
> On Fri, 20 Nov 2020 15:50:00 +0800 xiakaixu1987@gmail.com wrote:
>> From: Kaixu Xia <kaixuxia@tencent.com>
>>
>> The body of the if statement can be executed only when the variable
>> vlan_count equals to 32, so the condition of the while statement can
>> not be true and the while statement is dead code. Remove it.
>>
>> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
>> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
>> ---
>>   drivers/net/ethernet/adaptec/starfire.c | 9 ++-------
>>   1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c
>> index 555299737b51..ad27a9fa5e95 100644
>> --- a/drivers/net/ethernet/adaptec/starfire.c
>> +++ b/drivers/net/ethernet/adaptec/starfire.c
>> @@ -1754,14 +1754,9 @@ static u32 set_vlan_mode(struct netdev_private *np)
>>   		filter_addr += 16;
>>   		vlan_count++;
>>   	}
>> -	if (vlan_count == 32) {
>> +	if (vlan_count == 32)
>>   		ret |= PerfectFilterVlan;
>> -		while (vlan_count < 32) {
>> -			writew(0, filter_addr);
>> -			filter_addr += 16;
>> -			vlan_count++;
>> -		}
>> -	}
>> +
>>   	return ret;
>>   }
>>   #endif /* VLAN_SUPPORT */
> 
> This got broken back in 2011:
> 
> commit 5da96be53a16a62488316810d0c7c5d58ce3ee4f
> Author: Jiri Pirko <jpirko@redhat.com>
> Date:   Wed Jul 20 04:54:31 2011 +0000
> 
>      starfire: do vlan cleanup
>      
>      - unify vlan and nonvlan rx path
>      - kill np->vlgrp and netdev_vlan_rx_register
>      
>      Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>      Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> The comparison to 32 was on a different variable before that change.
> 
> Ion, do you think anyone is still using this driver?
> 
> Maybe it's time we put it in the history book (by which I mean remove
> from the kernel).

Frankly, no, I don't know of any users, and that unfortunately includes 
myself. I still have two cards in my stash, but they're 64-bit PCI-X, so 
plugging them in would likely require taking a dremel to a 32-bit PCI 
slot to make it open-ended. (They do work in a 32-bit slot.)

Anyway, that filter code could use some fixing in other regards. So 
either we fix it properly (which I can submit a patch for), or clean it 
out for good.

-Ion

^ permalink raw reply

* Re: [PATCH] net: adaptec: remove dead code in set_vlan_mode
From: Jakub Kicinski @ 2020-11-20 23:56 UTC (permalink / raw)
  To: Ion Badulescu
  Cc: xiakaixu1987, leon, davem, netdev, linux-kernel, Kaixu Xia,
	Arnd Bergmann
In-Reply-To: <fe835089-3499-0d70-304e-cc3d2e58a8d8@badula.org>

On Fri, 20 Nov 2020 18:41:03 -0500 Ion Badulescu wrote:
> Frankly, no, I don't know of any users, and that unfortunately includes 
> myself. I still have two cards in my stash, but they're 64-bit PCI-X, so 
> plugging them in would likely require taking a dremel to a 32-bit PCI 
> slot to make it open-ended. (They do work in a 32-bit slot.)
> 
> Anyway, that filter code could use some fixing in other regards. So 
> either we fix it properly (which I can submit a patch for), or clean it 
> out for good.

Entirely up to you.

^ permalink raw reply

* Re: [PATCH] net: adaptec: remove dead code in set_vlan_mode
From: Ion Badulescu @ 2020-11-21  0:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: xiakaixu1987, leon, davem, netdev, linux-kernel, Kaixu Xia,
	Arnd Bergmann
In-Reply-To: <20201120155637.78f47bc0@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On 11/20/20 6:56 PM, Jakub Kicinski wrote:
> On Fri, 20 Nov 2020 18:41:03 -0500 Ion Badulescu wrote:
>> Frankly, no, I don't know of any users, and that unfortunately includes
>> myself. I still have two cards in my stash, but they're 64-bit PCI-X, so
>> plugging them in would likely require taking a dremel to a 32-bit PCI
>> slot to make it open-ended. (They do work in a 32-bit slot.)
>>
>> Anyway, that filter code could use some fixing in other regards. So
>> either we fix it properly (which I can submit a patch for), or clean it
>> out for good.
> 
> Entirely up to you.

All right then. I'll whip out the Dremel this weekend and hopefully get 
a test rig going... :)

-Ion

^ permalink raw reply

* Re: [PATCH bpf-next v2 0/5] selftests/bpf: xsk selftests
From: Yonghong Song @ 2020-11-21  0:31 UTC (permalink / raw)
  To: Weqaar Janjua, bpf, netdev, daniel, ast, magnus.karlsson,
	bjorn.topel
  Cc: Weqaar Janjua, shuah, skhan, linux-kselftest, anders.roxell,
	jonathan.lemon
In-Reply-To: <20201120130026.19029-1-weqaar.a.janjua@intel.com>



On 11/20/20 5:00 AM, Weqaar Janjua wrote:
> This patch set adds AF_XDP selftests based on veth to selftests/bpf.
> 
> # Topology:
> # ---------
> #                 -----------
> #               _ | Process | _
> #              /  -----------  \
> #             /        |        \
> #            /         |         \
> #      -----------     |     -----------
> #      | Thread1 |     |     | Thread2 |
> #      -----------     |     -----------
> #           |          |          |
> #      -----------     |     -----------
> #      |  xskX   |     |     |  xskY   |
> #      -----------     |     -----------
> #           |          |          |
> #      -----------     |     ----------
> #      |  vethX  | --------- |  vethY |
> #      -----------   peer    ----------
> #           |          |          |
> #      namespaceX      |     namespaceY
> 
> These selftests test AF_XDP SKB and Native/DRV modes using veth Virtual
> Ethernet interfaces.
> 
> The test program contains two threads, each thread is single socket with
> a unique UMEM. It validates in-order packet delivery and packet content
> by sending packets to each other.
> 
> Prerequisites setup by script test_xsk_prerequisites.sh:
> 
>     Set up veth interfaces as per the topology shown ^^:
>     * setup two veth interfaces and one namespace
>     ** veth<xxxx> in root namespace
>     ** veth<yyyy> in af_xdp<xxxx> namespace
>     ** namespace af_xdp<xxxx>
>     * create a spec file veth.spec that includes this run-time configuration
>       that is read by test scripts - filenames prefixed with test_xsk_
>     *** xxxx and yyyy are randomly generated 4 digit numbers used to avoid
>         conflict with any existing interface
> 
> The following tests are provided:
> 
> 1. AF_XDP SKB mode
>     Generic mode XDP is driver independent, used when the driver does
>     not have support for XDP. Works on any netdevice using sockets and
>     generic XDP path. XDP hook from netif_receive_skb().
>     a. nopoll - soft-irq processing
>     b. poll - using poll() syscall
>     c. Socket Teardown
>        Create a Tx and a Rx socket, Tx from one socket, Rx on another.
>        Destroy both sockets, then repeat multiple times. Only nopoll mode
> 	  is used
>     d. Bi-directional Sockets
>        Configure sockets as bi-directional tx/rx sockets, sets up fill
> 	  and completion rings on each socket, tx/rx in both directions.
> 	  Only nopoll mode is used
> 
> 2. AF_XDP DRV/Native mode
>     Works on any netdevice with XDP_REDIRECT support, driver dependent.
>     Processes packets before SKB allocation. Provides better performance
>     than SKB. Driver hook available just after DMA of buffer descriptor.
>     a. nopoll
>     b. poll
>     c. Socket Teardown
>     d. Bi-directional Sockets
>     * Only copy mode is supported because veth does not currently support
>       zero-copy mode
> 
> Total tests: 8
> 
> Flow:
> * Single process spawns two threads: Tx and Rx
> * Each of these two threads attach to a veth interface within their
>    assigned namespaces
> * Each thread creates one AF_XDP socket connected to a unique umem
>    for each veth interface
> * Tx thread transmits 10k packets from veth<xxxx> to veth<yyyy>
> * Rx thread verifies if all 10k packets were received and delivered
>    in-order, and have the right content
> 
> v2 changes:
> * Move selftests/xsk to selftests/bpf
> * Remove Makefiles under selftests/xsk, and utilize selftests/bpf/Makefile
> 
> Structure of the patch set:
> 
> Patch 1: This patch adds XSK Selftests framework under selftests/bpf
> Patch 2: Adds tests: SKB poll and nopoll mode, and mac-ip-udp debug
> Patch 3: Adds tests: DRV poll and nopoll mode
> Patch 4: Adds tests: SKB and DRV Socket Teardown
> Patch 5: Adds tests: SKB and DRV Bi-directional Sockets

I just want to report that after applying the above 5 patches
on top of bpf-next commit 450d060e8f75 ("bpftool: Add {i,d}tlb_misses 
support for bpftool profile"), I hit the following error with below 
command sequences:

  $ ./test_xsk_prerequisites.sh
  $ ./test_xsk_skb_poll.sh
# Interface found: ve1480
# Interface found: ve9258
# NS switched: af_xdp9258
1..1
# Interface [ve9258] vector [Rx]
# Interface [ve1480] vector [Tx]
# Sending 10000 packets on interface ve1480
[  331.741244] ------------[ cut here ]------------
[  331.741741] kernel BUG at net/core/skbuff.c:1621!
[  331.742265] invalid opcode: 0000 [#1] PREEMPT SMP PTI
[  331.742837] CPU: 0 PID: 1883 Comm: xdpxceiver Not tainted 5.10.0-rc3+ 
#1037
[  331.743468] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), 
BIOS 1.9.3
-1.el7.centos 04/01/2014
[  331.744300] RIP: 0010:pskb_expand_head+0x27b/0x310
[  331.744747] Code: df e8 69 fc ff ff e9 ab fe ff ff 44 2b 6c 24 04 44 
01 ab d0
  00 00 00 48 83 c4 08 31 c0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 0f 0b <0f> 
0b be 02
  00 00 00 e8 89 4e ad ff 8b 83 bc 00 00 00 48 03 83 c0
[  331.746414] RSP: 0018:ffffbae4c0003d08 EFLAGS: 00010202
[  331.746892] RAX: 000000000000013f RBX: ffff9e0a8367ad00 RCX: 
0000000000000a20
[  331.747534] RDX: 0000000000000002 RSI: 0000000000000100 RDI: 
ffff9e0a8367ad00
[  331.748192] RBP: ffffbae4c00b2000 R08: 0000000000000001 R09: 
000000000000000e
[  331.748834] R10: ffffbae4c0003eb8 R11: 00000000ef974e19 R12: 
ffff9e0a86ecf000
[  331.749472] R13: 0000000000000001 R14: ffff9e0a8367ad00 R15: 
ffff9e0a8367ad00
[  331.750119] FS:  00007ff0806c5e00(0000) GS:ffff9e0abae00000(0000) 
knlGS:00000
00000000000
[  331.750848] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  331.751379] CR2: 00007ff0806c01d8 CR3: 0000000106e00006 CR4: 
0000000000370ef0
[  331.752022] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[  331.752665] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 
0000000000000400
[  331.753307] Call Trace:
[  331.753535]  <IRQ>
[  331.753736]  do_xdp_generic.part.157+0xa3/0x550
[  331.754151]  __netif_receive_skb_core+0x67e/0x12b0
[  331.754588]  ? process_backlog+0x86/0x250
[  331.754961]  ? __netif_receive_skb_one_core+0x3c/0xa0
[  331.755419]  __netif_receive_skb_one_core+0x3c/0xa0
[  331.755865]  process_backlog+0xf5/0x250
[  331.756215]  net_rx_action+0x144/0x440
[  331.756559]  __do_softirq+0xe4/0x493
[  331.756894]  asm_call_irq_on_stack+0x12/0x20
[  331.757282]  </IRQ>
[  331.757478]  ? dev_direct_xmit+0x1e8/0x230
[  331.757856]  do_softirq_own_stack+0x81/0xa0
[  331.758244]  do_softirq.part.16+0x3c/0x80
[  331.758611]  __local_bh_enable_ip+0xda/0xe0
[  331.758995]  dev_direct_xmit+0x20d/0x230
[  331.759356]  __xsk_sendmsg+0x314/0x3d0
[  331.759704]  sock_sendmsg+0x5b/0x60
[  331.760025]  __sys_sendto+0xf1/0x160
[  331.760355]  ? lockdep_hardirqs_on+0xbf/0x130
[  331.760759]  ? syscall_enter_from_user_mode+0x1c/0x50
[  331.761216]  __x64_sys_sendto+0x24/0x30
[  331.761563]  do_syscall_64+0x33/0x40
[  331.761895]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  331.762357] RIP: 0033:0x7ff08c8b9633
[  331.762689] Code: 49 89 ca b8 2c 00 00 00 0f 05 48 3d 01 f0 ff ff 73 
34 c3 48
  83 ec 08 e8 1b f7 ff ff 48 89 04 24 49 89 ca b8 2c 00 00 00 0f 05 <48> 
8b 3c 24
  48 89 c2 e8 61 f7 ff ff 48 89 d0 48 83 c4 08 48 3d 01
[  331.764356] RSP: 002b:00007ff0806c55c0 EFLAGS: 00000293 ORIG_RAX: 
00000000000
0002c
[  331.765038] RAX: ffffffffffffffda RBX: 00007ff0780009b0 RCX: 
00007ff08c8b9633
[  331.765684] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 
0000000000000008
[  331.766324] RBP: 0000000000000040 R08: 0000000000000000 R09: 
0000000000000000
[  331.766969] R10: 0000000000000040 R11: 0000000000000293 R12: 
0000000000000040
[  331.767608] R13: 0000000000000040 R14: 0000000000000000 R15: 
0000000000cd4030
[  331.768261] Modules linked in:
[  331.768596] ---[ end trace d9ca37a7957928dd ]---
[  331.769126] RIP: 0010:pskb_expand_head+0x27b/0x310
[  331.769678] Code: df e8 69 fc ff ff e9 ab fe ff ff 44 2b 6c 24 04 44 
01 ab d0
  00 00 00 48 83 c4 08 31 c0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 0f 0b <0f> 
0b be 02
  00 00 00 e8 89 4e ad ff 8b 83 bc 00 00 00 48 03 83 c0
[  331.771459] RSP: 0018:ffffbae4c0003d08 EFLAGS: 00010202
[  331.772043] RAX: 000000000000013f RBX: ffff9e0a8367ad00 RCX: 
0000000000000a20
[  331.772784] RDX: 0000000000000002 RSI: 0000000000000100 RDI: 
ffff9e0a8367ad00
[  331.773526] RBP: ffffbae4c00b2000 R08: 0000000000000001 R09: 
000000000000000e
[  331.774293] R10: ffffbae4c0003eb8 R11: 00000000ef974e19 R12: 
ffff9e0a86ecf000
[  331.775049] R13: 0000000000000001 R14: ffff9e0a8367ad00 R15: 
ffff9e0a8367ad00
[  331.775901] FS:  00007ff0806c5e00(0000) GS:ffff9e0abae00000(0000) 
knlGS:00000
00000000000
[  331.776809] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  331.777455] CR2: 00007ff0806c01d8 CR3: 0000000106e00006 CR4: 
0000000000370ef0
[  331.778232] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[  331.778989] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 
0000000000000400
[  331.779739] Kernel panic - not syncing: Fatal exception in interrupt
[  331.780523] Kernel Offset: 0xb800000 from 0xffffffff81000000 
(relocation rang
e: 0xffffffff80000000-0xffffffffbfffffff)
[  331.781488] ---[ end Kernel panic - not syncing: Fatal exception in 
interrupt
  ]---

In any case, kernel should not panic. You or somebody familiar with xsk
may want to take a look.

> 
> Thanks: Weqaar
> 
> Weqaar Janjua (5):
>    selftests/bpf: xsk selftests framework
>    selftests/bpf: xsk selftests - SKB POLL, NOPOLL
>    selftests/bpf: xsk selftests - DRV POLL, NOPOLL
>    selftests/bpf: xsk selftests - Socket Teardown - SKB, DRV
>    selftests/bpf: xsk selftests - Bi-directional Sockets - SKB, DRV
> 
>   tools/testing/selftests/bpf/Makefile          |   15 +-
>   .../bpf/test_xsk_drv_bidirectional.sh         |   23 +
>   .../selftests/bpf/test_xsk_drv_nopoll.sh      |   20 +
>   .../selftests/bpf/test_xsk_drv_poll.sh        |   20 +
>   .../selftests/bpf/test_xsk_drv_teardown.sh    |   20 +
>   .../selftests/bpf/test_xsk_prerequisites.sh   |  127 ++
>   .../bpf/test_xsk_skb_bidirectional.sh         |   20 +
>   .../selftests/bpf/test_xsk_skb_nopoll.sh      |   20 +
>   .../selftests/bpf/test_xsk_skb_poll.sh        |   20 +
>   .../selftests/bpf/test_xsk_skb_teardown.sh    |   20 +
>   tools/testing/selftests/bpf/xdpxceiver.c      | 1056 +++++++++++++++++
>   tools/testing/selftests/bpf/xdpxceiver.h      |  158 +++
>   tools/testing/selftests/bpf/xsk_env.sh        |   28 +
>   tools/testing/selftests/bpf/xsk_prereqs.sh    |  119 ++
>   14 files changed, 1664 insertions(+), 2 deletions(-)
[...]

^ permalink raw reply


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