From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Kurt Kanzenbach <kurt@linutronix.de>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Richard Cochran <richardcochran@gmail.com>,
Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
Benjamin Steinke <benjamin.steinke@woks-audio.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<bpf@vger.kernel.org>,
Sriram Yagnaraman <sriram.yagnaraman@est.tech>
Subject: Re: [PATCH iwl-next v7 1/5] igb: Remove static qualifiers
Date: Mon, 7 Oct 2024 15:09:36 +0200 [thread overview]
Message-ID: <ZwPdkPB1z4CiYCBH@boxer> (raw)
In-Reply-To: <20241007-b4-igb_zero_copy-v7-1-23556668adc6@linutronix.de>
On Mon, Oct 07, 2024 at 02:31:23PM +0200, Kurt Kanzenbach wrote:
> From: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
>
> 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>
> ---
> drivers/net/ethernet/intel/igb/igb.h | 29 ++++++++++++++++++++++++
> drivers/net/ethernet/intel/igb/igb_main.c | 37 +++++--------------------------
> 2 files changed, 35 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
> index 3c2dc7bdebb5..1bfe703e73d9 100644
> --- a/drivers/net/ethernet/intel/igb/igb.h
> +++ b/drivers/net/ethernet/intel/igb/igb.h
> @@ -18,6 +18,7 @@
> #include <linux/i2c-algo-bit.h>
> #include <linux/pci.h>
> #include <linux/mdio.h>
> +#include <linux/lockdep.h>
>
> #include <net/xdp.h>
>
> @@ -731,12 +732,18 @@ int igb_setup_tx_resources(struct igb_ring *);
> int igb_setup_rx_resources(struct igb_ring *);
> void igb_free_tx_resources(struct igb_ring *);
> void igb_free_rx_resources(struct igb_ring *);
> +void igb_clean_tx_ring(struct igb_ring *tx_ring);
> +void igb_clean_rx_ring(struct igb_ring *rx_ring);
> void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
> void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
> void igb_setup_tctl(struct igb_adapter *);
> void igb_setup_rctl(struct igb_adapter *);
> void igb_setup_srrctl(struct igb_adapter *, struct igb_ring *);
> netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *);
> +int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp);
> +void igb_process_skb_fields(struct igb_ring *rx_ring,
> + union e1000_adv_rx_desc *rx_desc,
> + struct sk_buff *skb);
> void igb_alloc_rx_buffers(struct igb_ring *, u16);
> void igb_update_stats(struct igb_adapter *);
> 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)
> return netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
> }
>
> +/* This function assumes __netif_tx_lock is held by the caller. */
> +static inline void igb_xdp_ring_update_tail(struct igb_ring *ring)
> +{
> + lockdep_assert_held(&txring_txq(ring)->_xmit_lock);
> +
> + /* Force memory writes to complete before letting h/w know there
> + * are new descriptors to fetch.
> + */
> + wmb();
> + writel(ring->next_to_use, ring->tail);
> +}
> +
> +static inline struct igb_ring *igb_xdp_tx_queue_mapping(struct igb_adapter *adapter)
> +{
> + unsigned int r_idx = smp_processor_id();
> +
> + if (r_idx >= adapter->num_tx_queues)
> + r_idx = r_idx % adapter->num_tx_queues;
> +
> + return adapter->tx_ring[r_idx];
> +}
> +
> int igb_add_filter(struct igb_adapter *adapter,
> struct igb_nfc_filter *input);
> int igb_erase_filter(struct igb_adapter *adapter,
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 1ef4cb871452..71addc0eac96 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -33,7 +33,6 @@
> #include <linux/bpf_trace.h>
> #include <linux/pm_runtime.h>
> #include <linux/etherdevice.h>
> -#include <linux/lockdep.h>
> #ifdef CONFIG_IGB_DCA
> #include <linux/dca.h>
> #endif
> @@ -116,8 +115,6 @@ static void igb_configure_tx(struct igb_adapter *);
> static void igb_configure_rx(struct igb_adapter *);
> static void igb_clean_all_tx_rings(struct igb_adapter *);
> static void igb_clean_all_rx_rings(struct igb_adapter *);
> -static void igb_clean_tx_ring(struct igb_ring *);
> -static void igb_clean_rx_ring(struct igb_ring *);
> static void igb_set_rx_mode(struct net_device *);
> static void igb_update_phy_info(struct timer_list *);
> static void igb_watchdog(struct timer_list *);
> @@ -2915,29 +2912,7 @@ static int igb_xdp(struct net_device *dev, struct netdev_bpf *xdp)
> }
> }
>
> -/* This function assumes __netif_tx_lock is held by the caller. */
> -static void igb_xdp_ring_update_tail(struct igb_ring *ring)
> -{
> - lockdep_assert_held(&txring_txq(ring)->_xmit_lock);
> -
> - /* Force memory writes to complete before letting h/w know there
> - * are new descriptors to fetch.
> - */
> - wmb();
> - writel(ring->next_to_use, ring->tail);
> -}
> -
> -static struct igb_ring *igb_xdp_tx_queue_mapping(struct igb_adapter *adapter)
> -{
> - unsigned int r_idx = smp_processor_id();
> -
> - if (r_idx >= adapter->num_tx_queues)
> - r_idx = r_idx % adapter->num_tx_queues;
> -
> - return adapter->tx_ring[r_idx];
> -}
> -
> -static int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp)
> +int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp)
> {
> struct xdp_frame *xdpf = xdp_convert_buff_to_frame(xdp);
> int cpu = smp_processor_id();
> @@ -4884,7 +4859,7 @@ static void igb_free_all_tx_resources(struct igb_adapter *adapter)
> * igb_clean_tx_ring - Free Tx Buffers
> * @tx_ring: ring to be cleaned
> **/
> -static void igb_clean_tx_ring(struct igb_ring *tx_ring)
> +void igb_clean_tx_ring(struct igb_ring *tx_ring)
> {
> u16 i = tx_ring->next_to_clean;
> struct igb_tx_buffer *tx_buffer = &tx_ring->tx_buffer_info[i];
> @@ -5003,7 +4978,7 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter)
> * igb_clean_rx_ring - Free Rx Buffers per Queue
> * @rx_ring: ring to free buffers from
> **/
> -static void igb_clean_rx_ring(struct igb_ring *rx_ring)
> +void igb_clean_rx_ring(struct igb_ring *rx_ring)
> {
> u16 i = rx_ring->next_to_clean;
>
> @@ -8782,9 +8757,9 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring,
> * order to populate the hash, checksum, VLAN, timestamp, protocol, and
> * other fields within the skb.
> **/
> -static void igb_process_skb_fields(struct igb_ring *rx_ring,
> - union e1000_adv_rx_desc *rx_desc,
> - struct sk_buff *skb)
> +void igb_process_skb_fields(struct igb_ring *rx_ring,
> + union e1000_adv_rx_desc *rx_desc,
> + struct sk_buff *skb)
> {
> struct net_device *dev = rx_ring->netdev;
>
>
> --
> 2.39.5
>
>
WARNING: multiple messages have this Message-ID (diff)
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Kurt Kanzenbach <kurt@linutronix.de>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Sriram Yagnaraman <sriram.yagnaraman@est.tech>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Richard Cochran <richardcochran@gmail.com>,
John Fastabend <john.fastabend@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
Benjamin Steinke <benjamin.steinke@woks-audio.com>,
Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, Tony Nguyen <anthony.l.nguyen@intel.com>,
intel-wired-lan@lists.osuosl.org,
Jakub Kicinski <kuba@kernel.org>,
bpf@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v7 1/5] igb: Remove static qualifiers
Date: Mon, 7 Oct 2024 15:09:36 +0200 [thread overview]
Message-ID: <ZwPdkPB1z4CiYCBH@boxer> (raw)
In-Reply-To: <20241007-b4-igb_zero_copy-v7-1-23556668adc6@linutronix.de>
On Mon, Oct 07, 2024 at 02:31:23PM +0200, Kurt Kanzenbach wrote:
> From: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
>
> 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>
> ---
> drivers/net/ethernet/intel/igb/igb.h | 29 ++++++++++++++++++++++++
> drivers/net/ethernet/intel/igb/igb_main.c | 37 +++++--------------------------
> 2 files changed, 35 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
> index 3c2dc7bdebb5..1bfe703e73d9 100644
> --- a/drivers/net/ethernet/intel/igb/igb.h
> +++ b/drivers/net/ethernet/intel/igb/igb.h
> @@ -18,6 +18,7 @@
> #include <linux/i2c-algo-bit.h>
> #include <linux/pci.h>
> #include <linux/mdio.h>
> +#include <linux/lockdep.h>
>
> #include <net/xdp.h>
>
> @@ -731,12 +732,18 @@ int igb_setup_tx_resources(struct igb_ring *);
> int igb_setup_rx_resources(struct igb_ring *);
> void igb_free_tx_resources(struct igb_ring *);
> void igb_free_rx_resources(struct igb_ring *);
> +void igb_clean_tx_ring(struct igb_ring *tx_ring);
> +void igb_clean_rx_ring(struct igb_ring *rx_ring);
> void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
> void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
> void igb_setup_tctl(struct igb_adapter *);
> void igb_setup_rctl(struct igb_adapter *);
> void igb_setup_srrctl(struct igb_adapter *, struct igb_ring *);
> netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *);
> +int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp);
> +void igb_process_skb_fields(struct igb_ring *rx_ring,
> + union e1000_adv_rx_desc *rx_desc,
> + struct sk_buff *skb);
> void igb_alloc_rx_buffers(struct igb_ring *, u16);
> void igb_update_stats(struct igb_adapter *);
> 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)
> return netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
> }
>
> +/* This function assumes __netif_tx_lock is held by the caller. */
> +static inline void igb_xdp_ring_update_tail(struct igb_ring *ring)
> +{
> + lockdep_assert_held(&txring_txq(ring)->_xmit_lock);
> +
> + /* Force memory writes to complete before letting h/w know there
> + * are new descriptors to fetch.
> + */
> + wmb();
> + writel(ring->next_to_use, ring->tail);
> +}
> +
> +static inline struct igb_ring *igb_xdp_tx_queue_mapping(struct igb_adapter *adapter)
> +{
> + unsigned int r_idx = smp_processor_id();
> +
> + if (r_idx >= adapter->num_tx_queues)
> + r_idx = r_idx % adapter->num_tx_queues;
> +
> + return adapter->tx_ring[r_idx];
> +}
> +
> int igb_add_filter(struct igb_adapter *adapter,
> struct igb_nfc_filter *input);
> int igb_erase_filter(struct igb_adapter *adapter,
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 1ef4cb871452..71addc0eac96 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -33,7 +33,6 @@
> #include <linux/bpf_trace.h>
> #include <linux/pm_runtime.h>
> #include <linux/etherdevice.h>
> -#include <linux/lockdep.h>
> #ifdef CONFIG_IGB_DCA
> #include <linux/dca.h>
> #endif
> @@ -116,8 +115,6 @@ static void igb_configure_tx(struct igb_adapter *);
> static void igb_configure_rx(struct igb_adapter *);
> static void igb_clean_all_tx_rings(struct igb_adapter *);
> static void igb_clean_all_rx_rings(struct igb_adapter *);
> -static void igb_clean_tx_ring(struct igb_ring *);
> -static void igb_clean_rx_ring(struct igb_ring *);
> static void igb_set_rx_mode(struct net_device *);
> static void igb_update_phy_info(struct timer_list *);
> static void igb_watchdog(struct timer_list *);
> @@ -2915,29 +2912,7 @@ static int igb_xdp(struct net_device *dev, struct netdev_bpf *xdp)
> }
> }
>
> -/* This function assumes __netif_tx_lock is held by the caller. */
> -static void igb_xdp_ring_update_tail(struct igb_ring *ring)
> -{
> - lockdep_assert_held(&txring_txq(ring)->_xmit_lock);
> -
> - /* Force memory writes to complete before letting h/w know there
> - * are new descriptors to fetch.
> - */
> - wmb();
> - writel(ring->next_to_use, ring->tail);
> -}
> -
> -static struct igb_ring *igb_xdp_tx_queue_mapping(struct igb_adapter *adapter)
> -{
> - unsigned int r_idx = smp_processor_id();
> -
> - if (r_idx >= adapter->num_tx_queues)
> - r_idx = r_idx % adapter->num_tx_queues;
> -
> - return adapter->tx_ring[r_idx];
> -}
> -
> -static int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp)
> +int igb_xdp_xmit_back(struct igb_adapter *adapter, struct xdp_buff *xdp)
> {
> struct xdp_frame *xdpf = xdp_convert_buff_to_frame(xdp);
> int cpu = smp_processor_id();
> @@ -4884,7 +4859,7 @@ static void igb_free_all_tx_resources(struct igb_adapter *adapter)
> * igb_clean_tx_ring - Free Tx Buffers
> * @tx_ring: ring to be cleaned
> **/
> -static void igb_clean_tx_ring(struct igb_ring *tx_ring)
> +void igb_clean_tx_ring(struct igb_ring *tx_ring)
> {
> u16 i = tx_ring->next_to_clean;
> struct igb_tx_buffer *tx_buffer = &tx_ring->tx_buffer_info[i];
> @@ -5003,7 +4978,7 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter)
> * igb_clean_rx_ring - Free Rx Buffers per Queue
> * @rx_ring: ring to free buffers from
> **/
> -static void igb_clean_rx_ring(struct igb_ring *rx_ring)
> +void igb_clean_rx_ring(struct igb_ring *rx_ring)
> {
> u16 i = rx_ring->next_to_clean;
>
> @@ -8782,9 +8757,9 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring,
> * order to populate the hash, checksum, VLAN, timestamp, protocol, and
> * other fields within the skb.
> **/
> -static void igb_process_skb_fields(struct igb_ring *rx_ring,
> - union e1000_adv_rx_desc *rx_desc,
> - struct sk_buff *skb)
> +void igb_process_skb_fields(struct igb_ring *rx_ring,
> + union e1000_adv_rx_desc *rx_desc,
> + struct sk_buff *skb)
> {
> struct net_device *dev = rx_ring->netdev;
>
>
> --
> 2.39.5
>
>
next prev parent reply other threads:[~2024-10-07 13:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-07 12:31 [PATCH iwl-next v7 0/5] igb: Add support for AF_XDP zero-copy Kurt Kanzenbach
2024-10-07 12:31 ` [Intel-wired-lan] " Kurt Kanzenbach
2024-10-07 12:31 ` [PATCH iwl-next v7 1/5] igb: Remove static qualifiers Kurt Kanzenbach
2024-10-07 12:31 ` [Intel-wired-lan] " Kurt Kanzenbach
2024-10-07 13:09 ` Maciej Fijalkowski [this message]
2024-10-07 13:09 ` Maciej Fijalkowski
2024-10-07 12:31 ` [PATCH iwl-next v7 2/5] igb: Introduce igb_xdp_is_enabled() Kurt Kanzenbach
2024-10-07 12:31 ` [Intel-wired-lan] " Kurt Kanzenbach
2024-10-07 12:31 ` [PATCH iwl-next v7 3/5] igb: Introduce XSK data structures and helpers Kurt Kanzenbach
2024-10-07 12:31 ` [Intel-wired-lan] " Kurt Kanzenbach
2024-10-07 12:31 ` [PATCH iwl-next v7 4/5] igb: Add AF_XDP zero-copy Rx support Kurt Kanzenbach
2024-10-07 12:31 ` [Intel-wired-lan] " Kurt Kanzenbach
2024-10-07 13:08 ` Maciej Fijalkowski
2024-10-07 13:08 ` [Intel-wired-lan] " Maciej Fijalkowski
2024-10-07 13:45 ` Kurt Kanzenbach
2024-10-07 13:45 ` [Intel-wired-lan] " Kurt Kanzenbach
2024-10-07 12:31 ` [PATCH iwl-next v7 5/5] igb: Add AF_XDP zero-copy Tx support Kurt Kanzenbach
2024-10-07 12:31 ` [Intel-wired-lan] " Kurt Kanzenbach
2024-10-07 13:15 ` Maciej Fijalkowski
2024-10-07 13:15 ` [Intel-wired-lan] " Maciej Fijalkowski
2024-10-07 13:48 ` Kurt Kanzenbach
2024-10-07 13:48 ` [Intel-wired-lan] " Kurt Kanzenbach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZwPdkPB1z4CiYCBH@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=benjamin.steinke@woks-audio.com \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=richardcochran@gmail.com \
--cc=sriram.yagnaraman@ericsson.com \
--cc=sriram.yagnaraman@est.tech \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.