gve: set xdp redirect target only when it is available
commit415cadd505upstream. Before this patch the NETDEV_XDP_ACT_NDO_XMIT XDP feature flag is set by default as part of driver initialization, and is never cleared. However, this flag differs from others in that it is used as an indicator for whether the driver is ready to perform the ndo_xdp_xmit operation as part of an XDP_REDIRECT. Kernel helpers xdp_features_(set|clear)_redirect_target exist to convey this meaning. This patch ensures that the netdev is only reported as a redirect target when XDP queues exist to forward traffic. Fixes:39a7f4aa3e("gve: Add XDP REDIRECT support for GQI-QPL format") Cc: stable@vger.kernel.org Reviewed-by: Praveen Kaligineedi <pkaligineedi@google.com> Reviewed-by: Jeroen de Borst <jeroendb@google.com> Signed-off-by: Joshua Washington <joshwash@google.com> Link: https://patch.msgid.link/20250214224417.1237818-1-joshwash@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Joshua Washington <joshwash@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c52d6aaf8e
commit
9921e26602
@@ -1030,6 +1030,16 @@ static inline u32 gve_xdp_tx_start_queue_id(struct gve_priv *priv)
|
||||
return gve_xdp_tx_queue_id(priv, 0);
|
||||
}
|
||||
|
||||
static inline bool gve_supports_xdp_xmit(struct gve_priv *priv)
|
||||
{
|
||||
switch (priv->queue_format) {
|
||||
case GVE_GQI_QPL_FORMAT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* buffers */
|
||||
int gve_alloc_page(struct gve_priv *priv, struct device *dev,
|
||||
struct page **page, dma_addr_t *dma,
|
||||
|
||||
@@ -1753,6 +1753,8 @@ static void gve_turndown(struct gve_priv *priv)
|
||||
/* Stop tx queues */
|
||||
netif_tx_disable(priv->dev);
|
||||
|
||||
xdp_features_clear_redirect_target(priv->dev);
|
||||
|
||||
gve_clear_napi_enabled(priv);
|
||||
gve_clear_report_stats(priv);
|
||||
|
||||
@@ -1793,6 +1795,9 @@ static void gve_turnup(struct gve_priv *priv)
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->num_xdp_queues && gve_supports_xdp_xmit(priv))
|
||||
xdp_features_set_redirect_target(priv->dev, false);
|
||||
|
||||
gve_set_napi_enabled(priv);
|
||||
}
|
||||
|
||||
@@ -2014,7 +2019,6 @@ static void gve_set_netdev_xdp_features(struct gve_priv *priv)
|
||||
if (priv->queue_format == GVE_GQI_QPL_FORMAT) {
|
||||
xdp_features = NETDEV_XDP_ACT_BASIC;
|
||||
xdp_features |= NETDEV_XDP_ACT_REDIRECT;
|
||||
xdp_features |= NETDEV_XDP_ACT_NDO_XMIT;
|
||||
xdp_features |= NETDEV_XDP_ACT_XSK_ZEROCOPY;
|
||||
} else {
|
||||
xdp_features = 0;
|
||||
|
||||
Reference in New Issue
Block a user