Skip to content

Commit f70b864

Browse files
sriramykuba-moo
authored andcommitted
igb: Remove static qualifiers
Remove static qualifiers on the following functions to be able to call from XSK specific file that is added in the later patches: - igb_xdp_tx_queue_mapping() - igb_xdp_ring_update_tail() - igb_clean_tx_ring() - igb_clean_rx_ring() - igb_xdp_xmit_back() - igb_process_skb_fields() While at it, inline igb_xdp_tx_queue_mapping() and igb_xdp_ring_update_tail(). These functions are small enough and used in XDP hot paths. Signed-off-by: Sriram Yagnaraman <sriram.yagnaraman@est.tech> [Kurt: Split patches, inline small XDP functions] 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-2-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent acafa84 commit f70b864

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed

drivers/net/ethernet/intel/igb/igb.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/i2c-algo-bit.h>
1919
#include <linux/pci.h>
2020
#include <linux/mdio.h>
21+
#include <linux/lockdep.h>
2122

2223
#include <net/xdp.h>
2324

@@ -731,12 +732,18 @@ int igb_setup_tx_resources(struct igb_ring *);
731732
int igb_setup_rx_resources(struct igb_ring *);
732733
void igb_free_tx_resources(struct igb_ring *);
733734
void igb_free_rx_resources(struct igb_ring *);
735+
void igb_clean_tx_ring(struct igb_ring *tx_ring);
736+
void igb_clean_rx_ring(struct igb_ring *rx_ring);
734737
void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
735738
void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
736739
void igb_setup_tctl(struct igb_adapter *);
737740
void igb_setup_rctl(struct igb_adapter *);
738741
void igb_setup_srrctl(struct igb_adapter *, struct igb_ring *);
739742
netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *);
743+
int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp);
744+
void igb_process_skb_fields(struct igb_ring *rx_ring,
745+
union e1000_adv_rx_desc *rx_desc,
746+
struct sk_buff *skb);
740747
void igb_alloc_rx_buffers(struct igb_ring *, u16);
741748
void igb_update_stats(struct igb_adapter *);
742749
bool igb_has_link(struct igb_adapter *adapter);
@@ -797,6 +804,28 @@ static inline struct netdev_queue *txring_txq(const struct igb_ring *tx_ring)
797804
return netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
798805
}
799806

807+
/* This function assumes __netif_tx_lock is held by the caller. */
808+
static inline void igb_xdp_ring_update_tail(struct igb_ring *ring)
809+
{
810+
lockdep_assert_held(&txring_txq(ring)->_xmit_lock);
811+
812+
/* Force memory writes to complete before letting h/w know there
813+
* are new descriptors to fetch.
814+
*/
815+
wmb();
816+
writel(ring->next_to_use, ring->tail);
817+
}
818+
819+
static inline struct igb_ring *igb_xdp_tx_queue_mapping(struct igb_adapter *adapter)
820+
{
821+
unsigned int r_idx = smp_processor_id();
822+
823+
if (r_idx >= adapter->num_tx_queues)
824+
r_idx = r_idx % adapter->num_tx_queues;
825+
826+
return adapter->tx_ring[r_idx];
827+
}
828+
800829
int igb_add_filter(struct igb_adapter *adapter,
801830
struct igb_nfc_filter *input);
802831
int igb_erase_filter(struct igb_adapter *adapter,

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <linux/bpf_trace.h>
3434
#include <linux/pm_runtime.h>
3535
#include <linux/etherdevice.h>
36-
#include <linux/lockdep.h>
3736
#ifdef CONFIG_IGB_DCA
3837
#include <linux/dca.h>
3938
#endif
@@ -116,8 +115,6 @@ static void igb_configure_tx(struct igb_adapter *);
116115
static void igb_configure_rx(struct igb_adapter *);
117116
static void igb_clean_all_tx_rings(struct igb_adapter *);
118117
static void igb_clean_all_rx_rings(struct igb_adapter *);
119-
static void igb_clean_tx_ring(struct igb_ring *);
120-
static void igb_clean_rx_ring(struct igb_ring *);
121118
static void igb_set_rx_mode(struct net_device *);
122119
static void igb_update_phy_info(struct timer_list *);
123120
static void igb_watchdog(struct timer_list *);
@@ -2919,29 +2916,7 @@ static int igb_xdp(struct net_device *dev, struct netdev_bpf *xdp)
29192916
}
29202917
}
29212918

2922-
/* This function assumes __netif_tx_lock is held by the caller. */
2923-
static void igb_xdp_ring_update_tail(struct igb_ring *ring)
2924-
{
2925-
lockdep_assert_held(&txring_txq(ring)->_xmit_lock);
2926-
2927-
/* Force memory writes to complete before letting h/w know there
2928-
* are new descriptors to fetch.
2929-
*/
2930-
wmb();
2931-
writel(ring->next_to_use, ring->tail);
2932-
}
2933-
2934-
static struct igb_ring *igb_xdp_tx_queue_mapping(struct igb_adapter *adapter)
2935-
{
2936-
unsigned int r_idx = smp_processor_id();
2937-
2938-
if (r_idx >= adapter->num_tx_queues)
2939-
r_idx = r_idx % adapter->num_tx_queues;
2940-
2941-
return adapter->tx_ring[r_idx];
2942-
}
2943-
2944-
static int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp)
2919+
int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp)
29452920
{
29462921
struct xdp_frame *xdpf = xdp_convert_buff_to_frame(xdp);
29472922
int cpu = smp_processor_id();
@@ -4888,7 +4863,7 @@ static void igb_free_all_tx_resources(struct igb_adapter *adapter)
48884863
* igb_clean_tx_ring - Free Tx Buffers
48894864
* @tx_ring: ring to be cleaned
48904865
**/
4891-
static void igb_clean_tx_ring(struct igb_ring *tx_ring)
4866+
void igb_clean_tx_ring(struct igb_ring *tx_ring)
48924867
{
48934868
u16 i = tx_ring->next_to_clean;
48944869
struct igb_tx_buffer *tx_buffer = &tx_ring->tx_buffer_info[i];
@@ -5007,7 +4982,7 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter)
50074982
* igb_clean_rx_ring - Free Rx Buffers per Queue
50084983
* @rx_ring: ring to free buffers from
50094984
**/
5010-
static void igb_clean_rx_ring(struct igb_ring *rx_ring)
4985+
void igb_clean_rx_ring(struct igb_ring *rx_ring)
50114986
{
50124987
u16 i = rx_ring->next_to_clean;
50134988

@@ -8786,9 +8761,9 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring,
87868761
* order to populate the hash, checksum, VLAN, timestamp, protocol, and
87878762
* other fields within the skb.
87888763
**/
8789-
static void igb_process_skb_fields(struct igb_ring *rx_ring,
8790-
union e1000_adv_rx_desc *rx_desc,
8791-
struct sk_buff *skb)
8764+
void igb_process_skb_fields(struct igb_ring *rx_ring,
8765+
union e1000_adv_rx_desc *rx_desc,
8766+
struct sk_buff *skb)
87928767
{
87938768
struct net_device *dev = rx_ring->netdev;
87948769

0 commit comments

Comments
 (0)