lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <pj41zlcz5v1kkg.fsf@u570694869fb251.ant.amazon.com>
Date:   Mon, 27 Feb 2023 11:50:38 +0200
From:   Shay Agroskin <shayagr@...zon.com>
To:     Lorenzo Bianconi <lorenzo@...nel.org>
CC:     <bpf@...r.kernel.org>, <netdev@...r.kernel.org>, <ast@...nel.org>,
        <daniel@...earbox.net>, <andrii@...nel.org>, <davem@...emloft.net>,
        <kuba@...nel.org>, <pabeni@...hat.com>, <edumazet@...gle.com>,
        <hawk@...nel.org>, <toke@...hat.com>, <memxor@...il.com>,
        <alardam@...il.com>, <saeedm@...dia.com>,
        <anthony.l.nguyen@...el.com>, <gospo@...adcom.com>,
        <vladimir.oltean@....com>, <nbd@....name>, <john@...ozen.org>,
        <leon@...nel.org>, <simon.horman@...igine.com>,
        <aelior@...vell.com>, <christophe.jaillet@...adoo.fr>,
        <ecree.xilinx@...il.com>, <mst@...hat.com>, <bjorn@...nel.org>,
        <magnus.karlsson@...el.com>, <maciej.fijalkowski@...el.com>,
        <intel-wired-lan@...ts.osuosl.org>, <lorenzo.bianconi@...hat.com>,
        <martin.lau@...ux.dev>, <sdf@...gle.com>
Subject: Re: [PATCH v4 bpf-next 2/8] drivers: net: turn on XDP features


Lorenzo Bianconi <lorenzo@...nel.org> writes:

> From: Marek Majtyka <alardam@...il.com>
>
> ...
>
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c 
> b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index e8ad5ea31aff..d3999db7c6a2 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -597,7 +597,9 @@ static int ena_xdp_set(struct net_device 
> *netdev, struct netdev_bpf *bpf)
>  				if (rc)
>  					return rc;
>  			}
> +			xdp_features_set_redirect_target(netdev, 
> false);
>  		} else if (old_bpf_prog) {
> + 
> xdp_features_clear_redirect_target(netdev);
>  			rc = 
>  ena_destroy_and_free_all_xdp_queues(adapter);
>  			if (rc)
>  				return rc;
> @@ -4103,6 +4105,8 @@ static void 
> ena_set_conf_feat_params(struct ena_adapter *adapter,
>  	/* Set offload features */
>  	ena_set_dev_offloads(feat, netdev);
>  
> +	netdev->xdp_features = NETDEV_XDP_ACT_BASIC | 
> NETDEV_XDP_ACT_REDIRECT;
> +
>  	adapter->max_mtu = feat->dev_attr.max_mtu;
>  	netdev->max_mtu = adapter->max_mtu;
>  	netdev->min_mtu = ENA_MIN_MTU;
>

Hi, thanks for the time you put in adjusting the ENA driver as 
well.

Why did you set NETDEV_XDP_ACT_NDO_XMIT dynamically for some 
drivers (like ENA and mlx5) and statically for others (like 
atlantic driver which also redirects packets only when XDP program 
is loaded) ?
Is it only for the sake of notifying the user that an XDP program 
has been loaded ?

Thanks,
Shay

> ...
> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index a5a7ecf6391c..82727b47259d 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -773,3 +773,21 @@ static int __init xdp_metadata_init(void)
>  	return register_btf_kfunc_id_set(BPF_PROG_TYPE_XDP, 
>  &xdp_metadata_kfunc_set);
>  }
>  late_initcall(xdp_metadata_init);
> +
> +void xdp_features_set_redirect_target(struct net_device *dev, 
> bool support_sg)
> +{
> +	dev->xdp_features |= NETDEV_XDP_ACT_NDO_XMIT;
> +	if (support_sg)
> +		dev->xdp_features |= NETDEV_XDP_ACT_NDO_XMIT_SG;
> +
> +	call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);
> +}
> +EXPORT_SYMBOL_GPL(xdp_features_set_redirect_target);
> +
> +void xdp_features_clear_redirect_target(struct net_device *dev)
> +{
> +	dev->xdp_features &= ~(NETDEV_XDP_ACT_NDO_XMIT |
> +			       NETDEV_XDP_ACT_NDO_XMIT_SG);
> +	call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);
> +}
> +EXPORT_SYMBOL_GPL(xdp_features_clear_redirect_target);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ