Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aac3942c authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'team_multiq'



Jiri Pirko says:

====================
This patchset represents the way I walked when I was adding multiqueue
support for team driver.

Jiri Pirko (6):
  net: honour netif_set_real_num_tx_queues() retval
  rtnl: allow to specify different num for rx and tx queue count
  rtnl: allow to specify number of rx and tx queues on device creation
  net: rename bond_queue_mapping to slave_dev_queue_mapping
  bond_sysfs: use ream_num_tx_queues rather than params.tx_queue
  team: add multiqueue support
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6f458dfb 6c85f2bd
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -395,8 +395,8 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
	skb->dev = slave_dev;

	BUILD_BUG_ON(sizeof(skb->queue_mapping) !=
		     sizeof(qdisc_skb_cb(skb)->bond_queue_mapping));
	skb->queue_mapping = qdisc_skb_cb(skb)->bond_queue_mapping;
		     sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping));
	skb->queue_mapping = qdisc_skb_cb(skb)->slave_dev_queue_mapping;

	if (unlikely(netpoll_tx_running(slave_dev)))
		bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
@@ -4184,7 +4184,7 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)
	/*
	 * Save the original txq to restore before passing to the driver
	 */
	qdisc_skb_cb(skb)->bond_queue_mapping = skb->queue_mapping;
	qdisc_skb_cb(skb)->slave_dev_queue_mapping = skb->queue_mapping;

	if (unlikely(txq >= dev->real_num_tx_queues)) {
		do {
@@ -4845,7 +4845,7 @@ static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
	return 0;
}

static int bond_get_tx_queues(struct net *net, struct nlattr *tb[])
static unsigned int bond_get_num_tx_queues(void)
{
	return tx_queues;
}
@@ -4855,7 +4855,9 @@ static struct rtnl_link_ops bond_link_ops __read_mostly = {
	.priv_size		= sizeof(struct bonding),
	.setup			= bond_setup,
	.validate		= bond_validate,
	.get_tx_queues	= bond_get_tx_queues,
	.get_num_tx_queues	= bond_get_num_tx_queues,
	.get_num_rx_queues	= bond_get_num_tx_queues, /* Use the same number
							     as for TX queues */
};

/* Create a new bond based on the specified name and bonding parameters.
+1 −1
Original line number Diff line number Diff line
@@ -1495,7 +1495,7 @@ static ssize_t bonding_store_queue_id(struct device *d,
	/* Check buffer length, valid ifname and queue id */
	if (strlen(buffer) > IFNAMSIZ ||
	    !dev_valid_name(buffer) ||
	    qid > bond->params.tx_queues)
	    qid > bond->dev->real_num_tx_queues)
		goto err_no_cmd;

	/* Get the pointer to that interface if it exists */
+60 −5
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <net/rtnetlink.h>
#include <net/genetlink.h>
#include <net/netlink.h>
#include <net/sch_generic.h>
#include <linux/if_team.h>

#define DRV_NAME "team"
@@ -1121,6 +1122,22 @@ static const struct team_option team_options[] = {
	},
};

static struct lock_class_key team_netdev_xmit_lock_key;
static struct lock_class_key team_netdev_addr_lock_key;

static void team_set_lockdep_class_one(struct net_device *dev,
				       struct netdev_queue *txq,
				       void *unused)
{
	lockdep_set_class(&txq->_xmit_lock, &team_netdev_xmit_lock_key);
}

static void team_set_lockdep_class(struct net_device *dev)
{
	lockdep_set_class(&dev->addr_list_lock, &team_netdev_addr_lock_key);
	netdev_for_each_tx_queue(dev, team_set_lockdep_class_one, NULL);
}

static int team_init(struct net_device *dev)
{
	struct team *team = netdev_priv(dev);
@@ -1148,6 +1165,8 @@ static int team_init(struct net_device *dev)
		goto err_options_register;
	netif_carrier_off(dev);

	team_set_lockdep_class(dev);

	return 0;

err_options_register:
@@ -1216,6 +1235,29 @@ static netdev_tx_t team_xmit(struct sk_buff *skb, struct net_device *dev)
	return NETDEV_TX_OK;
}

static u16 team_select_queue(struct net_device *dev, struct sk_buff *skb)
{
	/*
	 * This helper function exists to help dev_pick_tx get the correct
	 * destination queue.  Using a helper function skips a call to
	 * skb_tx_hash and will put the skbs in the queue we expect on their
	 * way down to the team driver.
	 */
	u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0;

	/*
	 * Save the original txq to restore before passing to the driver
	 */
	qdisc_skb_cb(skb)->slave_dev_queue_mapping = skb->queue_mapping;

	if (unlikely(txq >= dev->real_num_tx_queues)) {
		do {
			txq -= dev->real_num_tx_queues;
		} while (txq >= dev->real_num_tx_queues);
	}
	return txq;
}

static void team_change_rx_flags(struct net_device *dev, int change)
{
	struct team *team = netdev_priv(dev);
@@ -1469,6 +1511,7 @@ static const struct net_device_ops team_netdev_ops = {
	.ndo_open		= team_open,
	.ndo_stop		= team_close,
	.ndo_start_xmit		= team_xmit,
	.ndo_select_queue	= team_select_queue,
	.ndo_change_rx_flags	= team_change_rx_flags,
	.ndo_set_rx_mode	= team_set_rx_mode,
	.ndo_set_mac_address	= team_set_mac_address,
@@ -1543,12 +1586,24 @@ static int team_validate(struct nlattr *tb[], struct nlattr *data[])
	return 0;
}

static unsigned int team_get_num_tx_queues(void)
{
	return TEAM_DEFAULT_NUM_TX_QUEUES;
}

static unsigned int team_get_num_rx_queues(void)
{
	return TEAM_DEFAULT_NUM_RX_QUEUES;
}

static struct rtnl_link_ops team_link_ops __read_mostly = {
	.kind			= DRV_NAME,
	.priv_size		= sizeof(struct team),
	.setup			= team_setup,
	.newlink		= team_newlink,
	.validate		= team_validate,
	.get_num_tx_queues	= team_get_num_tx_queues,
	.get_num_rx_queues	= team_get_num_rx_queues,
};


+2 −0
Original line number Diff line number Diff line
@@ -140,6 +140,8 @@ enum {
	IFLA_EXT_MASK,		/* Extended info mask, VFs, etc */
	IFLA_PROMISCUITY,	/* Promiscuity count: > 0 means acts PROMISC */
#define IFLA_PROMISCUITY IFLA_PROMISCUITY
	IFLA_NUM_TX_QUEUES,
	IFLA_NUM_RX_QUEUES,
	__IFLA_MAX
};

+8 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#ifdef __KERNEL__

#include <linux/netpoll.h>
#include <net/sch_generic.h>

struct team_pcpu_stats {
	u64			rx_packets;
@@ -98,6 +99,10 @@ static inline void team_netpoll_send_skb(struct team_port *port,
static inline int team_dev_queue_xmit(struct team *team, struct team_port *port,
				      struct sk_buff *skb)
{
	BUILD_BUG_ON(sizeof(skb->queue_mapping) !=
		     sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping));
	skb_set_queue_mapping(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping);

	skb->dev = port->dev;
	if (unlikely(netpoll_tx_running(port->dev))) {
		team_netpoll_send_skb(port, skb);
@@ -236,6 +241,9 @@ extern void team_options_unregister(struct team *team,
extern int team_mode_register(const struct team_mode *mode);
extern void team_mode_unregister(const struct team_mode *mode);

#define TEAM_DEFAULT_NUM_TX_QUEUES 16
#define TEAM_DEFAULT_NUM_RX_QUEUES 16

#endif /* __KERNEL__ */

#define TEAM_STRING_MAX_LEN 32
Loading