-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: move struct netdev_rx_queue out of netdevice.h
struct netdev_rx_queue is touched in only a few places and having it defined in netdevice.h brings in the dependency on xdp.h, because struct xdp_rxq_info gets embedded in struct netdev_rx_queue. In prep for removal of xdp.h from netdevice.h move all the netdev_rx_queue stuff to a new header. We could technically break the new header up to avoid the sysfs.h include but it's so rarely included it doesn't seem to be worth it at this point. Reviewed-by: Amritha Nambiar <amritha.nambiar@intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Acked-by: Jesper Dangaard Brouer <hawk@kernel.org> Link: https://lore.kernel.org/r/20230803010230.1755386-3-kuba@kernel.org Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
- Loading branch information
Jakub Kicinski
authored and
Martin KaFai Lau
committed
Aug 3, 2023
1 parent
92272ec
commit 49e47a5
Showing
7 changed files
with
58 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _LINUX_NETDEV_RX_QUEUE_H | ||
#define _LINUX_NETDEV_RX_QUEUE_H | ||
|
||
#include <linux/kobject.h> | ||
#include <linux/netdevice.h> | ||
#include <linux/sysfs.h> | ||
#include <net/xdp.h> | ||
|
||
/* This structure contains an instance of an RX queue. */ | ||
struct netdev_rx_queue { | ||
struct xdp_rxq_info xdp_rxq; | ||
#ifdef CONFIG_RPS | ||
struct rps_map __rcu *rps_map; | ||
struct rps_dev_flow_table __rcu *rps_flow_table; | ||
#endif | ||
struct kobject kobj; | ||
struct net_device *dev; | ||
netdevice_tracker dev_tracker; | ||
|
||
#ifdef CONFIG_XDP_SOCKETS | ||
struct xsk_buff_pool *pool; | ||
#endif | ||
} ____cacheline_aligned_in_smp; | ||
|
||
/* | ||
* RX queue sysfs structures and functions. | ||
*/ | ||
struct rx_queue_attribute { | ||
struct attribute attr; | ||
ssize_t (*show)(struct netdev_rx_queue *queue, char *buf); | ||
ssize_t (*store)(struct netdev_rx_queue *queue, | ||
const char *buf, size_t len); | ||
}; | ||
|
||
static inline struct netdev_rx_queue * | ||
__netif_get_rx_queue(struct net_device *dev, unsigned int rxq) | ||
{ | ||
return dev->_rx + rxq; | ||
} | ||
|
||
#ifdef CONFIG_SYSFS | ||
static inline unsigned int | ||
get_netdev_rx_queue_index(struct netdev_rx_queue *queue) | ||
{ | ||
struct net_device *dev = queue->dev; | ||
int index = queue - dev->_rx; | ||
|
||
BUG_ON(index >= dev->num_rx_queues); | ||
return index; | ||
} | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters