mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 02:44:41 +01:00
igb: Introduce igb_xdp_is_enabled()
Introduce igb_xdp_is_enabled() to check if an XDP program is assigned to the device. Use that wherever xdp_prog is read and evaluated. Signed-off-by: Sriram Yagnaraman <sriram.yagnaraman@est.tech> [Kurt: Split patches and use READ_ONCE()] Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Link: https://patch.msgid.link/20250106221929.956999-3-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
f70b864ccc
commit
6dc75fc230
2 changed files with 10 additions and 3 deletions
|
|
@ -826,6 +826,11 @@ static inline struct igb_ring *igb_xdp_tx_queue_mapping(struct igb_adapter *adap
|
|||
return adapter->tx_ring[r_idx];
|
||||
}
|
||||
|
||||
static inline bool igb_xdp_is_enabled(struct igb_adapter *adapter)
|
||||
{
|
||||
return !!READ_ONCE(adapter->xdp_prog);
|
||||
}
|
||||
|
||||
int igb_add_filter(struct igb_adapter *adapter,
|
||||
struct igb_nfc_filter *input);
|
||||
int igb_erase_filter(struct igb_adapter *adapter,
|
||||
|
|
|
|||
|
|
@ -2930,7 +2930,8 @@ int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp)
|
|||
/* During program transitions its possible adapter->xdp_prog is assigned
|
||||
* but ring has not been configured yet. In this case simply abort xmit.
|
||||
*/
|
||||
tx_ring = adapter->xdp_prog ? igb_xdp_tx_queue_mapping(adapter) : NULL;
|
||||
tx_ring = igb_xdp_is_enabled(adapter) ?
|
||||
igb_xdp_tx_queue_mapping(adapter) : NULL;
|
||||
if (unlikely(!tx_ring))
|
||||
return IGB_XDP_CONSUMED;
|
||||
|
||||
|
|
@ -2963,7 +2964,8 @@ static int igb_xdp_xmit(struct net_device *dev, int n,
|
|||
/* During program transitions its possible adapter->xdp_prog is assigned
|
||||
* but ring has not been configured yet. In this case simply abort xmit.
|
||||
*/
|
||||
tx_ring = adapter->xdp_prog ? igb_xdp_tx_queue_mapping(adapter) : NULL;
|
||||
tx_ring = igb_xdp_is_enabled(adapter) ?
|
||||
igb_xdp_tx_queue_mapping(adapter) : NULL;
|
||||
if (unlikely(!tx_ring))
|
||||
return -ENXIO;
|
||||
|
||||
|
|
@ -6597,7 +6599,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
|
|||
struct igb_adapter *adapter = netdev_priv(netdev);
|
||||
int max_frame = new_mtu + IGB_ETH_PKT_HDR_PAD;
|
||||
|
||||
if (adapter->xdp_prog) {
|
||||
if (igb_xdp_is_enabled(adapter)) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < adapter->num_rx_queues; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue