From: Vladislav Yasevich <vyasevich@gmail.com>
To: netdev@vger.kernel.org
Cc: jasowang@redhat.com, mst@redhat.com,
Vladislav Yasevich <vyasevic@redhat.com>
Subject: [RFC PATCH net-next 1/3] macvtap: mutiple qdiscs support
Date: Sun, 7 Feb 2016 22:14:54 -0500 [thread overview]
Message-ID: <1454901296-9915-2-git-send-email-vyasevic@redhat.com> (raw)
In-Reply-To: <1454901296-9915-1-git-send-email-vyasevic@redhat.com>
Since commit 6acf54f1cf0a6747bac9fea26f34cfc5a9029523
macvtap: Add support of packet capture on macvtap device.
macvtap has been using dev_queue_xmit() call. Since macvtap
set the queue length, it ended up using a qdisc and that caused
lock contention when multi-queue macvtap was used.
This patch extends the macvtap multi-queue support that adds
multiple qudiscs. If macvtap is crated without a spcified
number of queues, we default to MAX_MACVTAP_QUEUES. We always
start with one real queue. After the that, every time the user
opens a macvtap device (for every open after the first one), we'll
update the number of real queues. We also update the number of
queues upon queue disables and enables. This is different then tap
bacuase, unlike tap device, macvtap will actually completely unlink
the tap queue from the vlan and change the queue index. As a result,
a disable/enable sequence will cause the queue index change and we
account for this by updating real queues.
Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
drivers/net/macvtap.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index d636d05..810e7d3 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -161,6 +161,12 @@ static struct macvlan_dev *macvtap_get_vlan_rcu(const struct net_device *dev)
* when both our references and any pending SKBs are gone.
*/
+static void macvtap_set_real_num_queues(struct net_device *dev, int q)
+{
+ netif_set_real_num_tx_queues(dev, q);
+ netif_set_real_num_rx_queues(dev, q);
+}
+
static int macvtap_enable_queue(struct net_device *dev, struct file *file,
struct macvtap_queue *q)
{
@@ -178,6 +184,7 @@ static int macvtap_enable_queue(struct net_device *dev, struct file *file,
q->enabled = true;
vlan->numvtaps++;
+ macvtap_set_real_num_queues(dev, vlan->numvtaps);
out:
return err;
}
@@ -204,6 +211,7 @@ static int macvtap_set_queue(struct net_device *dev, struct file *file,
vlan->numvtaps++;
vlan->numqueues++;
+ macvtap_set_real_num_queues(dev, vlan->numvtaps);
return 0;
}
@@ -229,6 +237,7 @@ static int macvtap_disable_queue(struct macvtap_queue *q)
q->enabled = false;
vlan->numvtaps--;
+ macvtap_set_real_num_queues(vlan->dev, vlan->numvtaps);
}
return 0;
@@ -481,15 +490,24 @@ static void macvtap_dellink(struct net_device *dev,
static void macvtap_setup(struct net_device *dev)
{
+ /* Start with 1 queue and will update as user adds them */
+ macvtap_set_real_num_queues(dev, 1);
macvlan_common_setup(dev);
dev->tx_queue_len = TUN_READQ_SIZE;
}
+static unsigned int macvtap_get_num_queues(void)
+{
+ return MAX_MACVTAP_QUEUES;
+}
+
static struct rtnl_link_ops macvtap_link_ops __read_mostly = {
.kind = "macvtap",
.setup = macvtap_setup,
.newlink = macvtap_newlink,
.dellink = macvtap_dellink,
+ .get_num_tx_queues = macvtap_get_num_queues,
+ .get_num_rx_queues = macvtap_get_num_queues,
};
--
2.1.0
next prev parent reply other threads:[~2016-02-08 3:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-08 3:14 [RFC PATCH net-next 0/3] Extend macvtap with multiple qdiscs Vladislav Yasevich
2016-02-08 3:14 ` Vladislav Yasevich [this message]
2016-02-08 3:14 ` [RFC PATCH net-next 2/3] macvlan: add queue selection functionality Vladislav Yasevich
2016-02-08 3:45 ` Eric Dumazet
2016-02-09 4:30 ` Pankaj Gupta
2016-02-08 3:14 ` [RFC PATCH net-next 3/3] macvtap: Record the rx queue based on the user tap queue Vladislav Yasevich
2016-02-23 2:38 ` [RFC PATCH net-next 0/3] Extend macvtap with multiple qdiscs Jason Wang
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=1454901296-9915-2-git-send-email-vyasevic@redhat.com \
--to=vyasevich@gmail.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=vyasevic@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).