From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Shay Agroskin <shayagr@amazon.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, davem@davemloft.net,
kuba@kernel.org, pabeni@redhat.com, edumazet@google.com,
hawk@kernel.org, toke@redhat.com, memxor@gmail.com,
alardam@gmail.com, saeedm@nvidia.com, anthony.l.nguyen@intel.com,
gospo@broadcom.com, vladimir.oltean@nxp.com, nbd@nbd.name,
john@phrozen.org, leon@kernel.org, simon.horman@corigine.com,
aelior@marvell.com, christophe.jaillet@wanadoo.fr,
ecree.xilinx@gmail.com, mst@redhat.com, bjorn@kernel.org,
magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
intel-wired-lan@lists.osuosl.org, lorenzo.bianconi@redhat.com,
martin.lau@linux.dev, sdf@google.com
Subject: Re: [PATCH v4 bpf-next 2/8] drivers: net: turn on XDP features
Date: Tue, 28 Feb 2023 23:11:55 +0100 [thread overview]
Message-ID: <Y/58Kzah/ERCYMGD@lore-desk> (raw)
In-Reply-To: <pj41zlcz5v1kkg.fsf@u570694869fb251.ant.amazon.com>
[-- Attachment #1: Type: text/plain, Size: 2942 bytes --]
>
> Lorenzo Bianconi <lorenzo@kernel.org> writes:
>
> > From: Marek Majtyka <alardam@gmail.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.
Hi Shay,
>
> 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 ?
there are some drivers (e.g. mvneta) where NETDEV_XDP_ACT_NDO_XMIT is always
supported while there are other drivers (e.g. intel drivers) where it
depends on other configurations (e.g. if the driver needs to reserve
some queues for xdp).
Regards,
Lorenzo
>
> 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);
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-02-28 22:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-28 14:06 [PATCH v4 bpf-next 0/8] xdp: introduce xdp-feature support Lorenzo Bianconi
2023-01-28 14:06 ` [PATCH v4 bpf-next 1/8] netdev-genl: create a simple family for netdev stuff Lorenzo Bianconi
2023-01-28 14:06 ` [PATCH v4 bpf-next 2/8] drivers: net: turn on XDP features Lorenzo Bianconi
2023-02-27 9:50 ` Shay Agroskin
2023-02-28 22:11 ` Lorenzo Bianconi [this message]
2023-03-02 13:44 ` Shay Agroskin
2023-01-28 14:06 ` [PATCH v4 bpf-next 3/8] xsk: add usage of XDP features flags Lorenzo Bianconi
2023-01-28 14:06 ` [PATCH v4 bpf-next 4/8] libbpf: add the capability to specify netlink proto in libbpf_netlink_send_recv Lorenzo Bianconi
2023-01-28 14:06 ` [PATCH v4 bpf-next 5/8] libbpf: add API to get XDP/XSK supported features Lorenzo Bianconi
2023-01-28 14:06 ` [PATCH v4 bpf-next 6/8] bpf: devmap: check XDP features in __xdp_enqueue routine Lorenzo Bianconi
2023-01-28 14:06 ` [PATCH v4 bpf-next 7/8] selftests/bpf: add test for bpf_xdp_query xdp-features support Lorenzo Bianconi
2023-01-28 14:06 ` [PATCH v4 bpf-next 8/8] selftests/bpf: introduce XDP compliance test tool Lorenzo Bianconi
2023-01-28 21:34 ` Alexei Starovoitov
2023-01-29 18:48 ` Lorenzo Bianconi
2023-01-30 18:59 ` Stanislav Fomichev
2023-01-30 22:59 ` Lorenzo Bianconi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/58Kzah/ERCYMGD@lore-desk \
--to=lorenzo@kernel.org \
--cc=aelior@marvell.com \
--cc=alardam@gmail.com \
--cc=andrii@kernel.org \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=gospo@broadcom.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john@phrozen.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mst@redhat.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=sdf@google.com \
--cc=shayagr@amazon.com \
--cc=simon.horman@corigine.com \
--cc=toke@redhat.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox