net: ti: icssg-prueth: Set XDP feature flags for ndev
authorMeghana Malladi <m-malladi@ti.com>
Tue, 6 May 2025 11:05:44 +0000 (16:35 +0530)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 May 2025 01:19:11 +0000 (18:19 -0700)
xdp_features demonstrates what all XDP capabilities are supported
on a given network device. The driver needs to set these xdp_features
flag to let the network stack know what XDP features a given driver
is supporting. These flags need to be set for a given ndev irrespective
of any XDP program being loaded or not.

Fixes: 62aa3246f462 ("net: ti: icssg-prueth: Add XDP support")
Signed-off-by: Meghana Malladi <m-malladi@ti.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250506110546.4065715-2-m-malladi@ti.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ti/icssg/icssg_prueth.c

index 443f90fa65575a810074c673986b664e3ea11279..ee35fecf61e7c6fc2acd7d84d03dd7910f7862a8 100644 (file)
@@ -1109,11 +1109,6 @@ static int emac_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frame
 static int emac_xdp_setup(struct prueth_emac *emac, struct netdev_bpf *bpf)
 {
        struct bpf_prog *prog = bpf->prog;
-       xdp_features_t val;
-
-       val = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
-             NETDEV_XDP_ACT_NDO_XMIT;
-       xdp_set_features_flag(emac->ndev, val);
 
        if (!emac->xdpi.prog && !prog)
                return 0;
@@ -1291,6 +1286,10 @@ static int prueth_netdev_init(struct prueth *prueth,
        ndev->hw_features = NETIF_F_SG;
        ndev->features = ndev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
        ndev->hw_features |= NETIF_PRUETH_HSR_OFFLOAD_FEATURES;
+       xdp_set_features_flag(ndev,
+                             NETDEV_XDP_ACT_BASIC |
+                             NETDEV_XDP_ACT_REDIRECT |
+                             NETDEV_XDP_ACT_NDO_XMIT);
 
        netif_napi_add(ndev, &emac->napi_rx, icssg_napi_rx_poll);
        hrtimer_setup(&emac->rx_hrtimer, &emac_rx_timer_callback, CLOCK_MONOTONIC,