Commit d40156aa5ecbd51fed932ed4813df82b56e5ff4d

Authored by Jiri Pirko
Committed by David S. Miller
1 parent ee6ae1a1d5

rtnl: allow to specify different num for rx and tx queue count

Also cut out unused function parameters and possible err in return
value.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 22 additions and 18 deletions Side-by-side Diff

drivers/net/bonding/bond_main.c
... ... @@ -4845,17 +4845,19 @@
4845 4845 return 0;
4846 4846 }
4847 4847  
4848   -static int bond_get_tx_queues(struct net *net, struct nlattr *tb[])
  4848 +static unsigned int bond_get_num_tx_queues(void)
4849 4849 {
4850 4850 return tx_queues;
4851 4851 }
4852 4852  
4853 4853 static struct rtnl_link_ops bond_link_ops __read_mostly = {
4854   - .kind = "bond",
4855   - .priv_size = sizeof(struct bonding),
4856   - .setup = bond_setup,
4857   - .validate = bond_validate,
4858   - .get_tx_queues = bond_get_tx_queues,
  4854 + .kind = "bond",
  4855 + .priv_size = sizeof(struct bonding),
  4856 + .setup = bond_setup,
  4857 + .validate = bond_validate,
  4858 + .get_num_tx_queues = bond_get_num_tx_queues,
  4859 + .get_num_rx_queues = bond_get_num_tx_queues, /* Use the same number
  4860 + as for TX queues */
4859 4861 };
4860 4862  
4861 4863 /* Create a new bond based on the specified name and bonding parameters.
include/net/rtnetlink.h
... ... @@ -44,8 +44,10 @@
44 44 * @get_xstats_size: Function to calculate required room for dumping device
45 45 * specific statistics
46 46 * @fill_xstats: Function to dump device specific statistics
47   - * @get_tx_queues: Function to determine number of transmit queues to create when
48   - * creating a new device.
  47 + * @get_num_tx_queues: Function to determine number of transmit queues
  48 + * to create when creating a new device.
  49 + * @get_num_rx_queues: Function to determine number of receive queues
  50 + * to create when creating a new device.
49 51 */
50 52 struct rtnl_link_ops {
51 53 struct list_head list;
... ... @@ -77,8 +79,8 @@
77 79 size_t (*get_xstats_size)(const struct net_device *dev);
78 80 int (*fill_xstats)(struct sk_buff *skb,
79 81 const struct net_device *dev);
80   - int (*get_tx_queues)(struct net *net,
81   - struct nlattr *tb[]);
  82 + unsigned int (*get_num_tx_queues)(void);
  83 + unsigned int (*get_num_rx_queues)(void);
82 84 };
83 85  
84 86 extern int __rtnl_link_register(struct rtnl_link_ops *ops);
net/core/rtnetlink.c
... ... @@ -1624,17 +1624,17 @@
1624 1624 {
1625 1625 int err;
1626 1626 struct net_device *dev;
1627   - unsigned int num_queues = 1;
  1627 + unsigned int num_tx_queues = 1;
  1628 + unsigned int num_rx_queues = 1;
1628 1629  
1629   - if (ops->get_tx_queues) {
1630   - err = ops->get_tx_queues(src_net, tb);
1631   - if (err < 0)
1632   - goto err;
1633   - num_queues = err;
1634   - }
  1630 + if (ops->get_num_tx_queues)
  1631 + num_tx_queues = ops->get_num_tx_queues();
  1632 + if (ops->get_num_rx_queues)
  1633 + num_rx_queues = ops->get_num_rx_queues();
1635 1634  
1636 1635 err = -ENOMEM;
1637   - dev = alloc_netdev_mq(ops->priv_size, ifname, ops->setup, num_queues);
  1636 + dev = alloc_netdev_mqs(ops->priv_size, ifname, ops->setup,
  1637 + num_tx_queues, num_rx_queues);
1638 1638 if (!dev)
1639 1639 goto err;
1640 1640