[Intel-wired-lan] [PATCH v4 bpf-next 2/8] drivers: net: turn on XDP features

Shay Agroskin shayagr at amazon.com
Thu Mar 2 13:44:18 UTC 2023


Lorenzo Bianconi <lorenzo at kernel.org> writes:

> [[PGP Signed Part:Undecided]]
>> 
>> Lorenzo Bianconi <lorenzo at kernel.org> writes:
>> 
>> > From: Marek Majtyka <alardam at 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
>

Well given that ENA's ability to redirect packets goes hand in 
hand with its ability to process any XDP traffic I'd say it always 
supports ndo_xmit.
Doesn't seem like a big issue though.

Thanks for the explanation,
Shay

>
> [[End of PGP Signed Part]]



More information about the Intel-wired-lan mailing list