From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Jiri Pirko <jiri@resnulli.us>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL 3/4] net: move queue number into NICPeers
Date: Fri, 27 Jun 2014 16:24:52 +0200 [thread overview]
Message-ID: <1403879093-786-4-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1403879093-786-1-git-send-email-stefanha@redhat.com>
From: Jiri Pirko <jiri@resnulli.us>
It indicates the number of elements in ncs field and makes sense to have
int inside NICPeers. Also in parse_netdev we do not need to access
container and work with NICPeers only.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/core/qdev-properties-system.c | 3 +--
hw/net/virtio-net.c | 2 +-
include/net/net.h | 2 +-
net/net.c | 4 ++--
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index de433b2..52c2f8a 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -180,7 +180,6 @@ PropertyInfo qdev_prop_chr = {
static int parse_netdev(DeviceState *dev, const char *str, void **ptr)
{
NICPeers *peers_ptr = (NICPeers *)ptr;
- NICConf *conf = container_of(peers_ptr, NICConf, peers);
NetClientState **ncs = peers_ptr->ncs;
NetClientState *peers[MAX_QUEUE_NUM];
int queues, i = 0;
@@ -219,7 +218,7 @@ static int parse_netdev(DeviceState *dev, const char *str, void **ptr)
ncs[i]->queue_index = i;
}
- conf->queues = queues;
+ peers_ptr->queues = queues;
return 0;
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 00b5e07..e51d753 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1542,7 +1542,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size);
- n->max_queues = MAX(n->nic_conf.queues, 1);
+ n->max_queues = MAX(n->nic_conf.peers.queues, 1);
n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues);
n->vqs[0].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx);
n->curr_queues = 1;
diff --git a/include/net/net.h b/include/net/net.h
index 8b189da..ed594f9 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -24,13 +24,13 @@ struct MACAddr {
typedef struct NICPeers {
NetClientState *ncs[MAX_QUEUE_NUM];
+ int32_t queues;
} NICPeers;
typedef struct NICConf {
MACAddr macaddr;
NICPeers peers;
int32_t bootindex;
- int32_t queues;
} NICConf;
#define DEFINE_NIC_PROPERTIES(_state, _conf) \
diff --git a/net/net.c b/net/net.c
index e636071..0869c60 100644
--- a/net/net.c
+++ b/net/net.c
@@ -250,7 +250,7 @@ NICState *qemu_new_nic(NetClientInfo *info,
{
NetClientState **peers = conf->peers.ncs;
NICState *nic;
- int i, queues = MAX(1, conf->queues);
+ int i, queues = MAX(1, conf->peers.queues);
assert(info->type == NET_CLIENT_OPTIONS_KIND_NIC);
assert(info->size >= sizeof(NICState));
@@ -363,7 +363,7 @@ void qemu_del_net_client(NetClientState *nc)
void qemu_del_nic(NICState *nic)
{
- int i, queues = MAX(nic->conf->queues, 1);
+ int i, queues = MAX(nic->conf->peers.queues, 1);
/* If this is a peer NIC and peer has already been deleted, free it now. */
if (nic->peer_deleted) {
--
1.9.3
next prev parent reply other threads:[~2014-06-27 14:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-27 14:24 [Qemu-devel] [PULL for-2.1 0/4] Net patches Stefan Hajnoczi
2014-06-27 14:24 ` [Qemu-devel] [PULL 1/4] qemu-bridge-helper: Fix fd leak in main() Stefan Hajnoczi
2014-06-27 14:24 ` [Qemu-devel] [PULL 2/4] net: L2TPv3 transport Stefan Hajnoczi
2014-07-01 12:06 ` Jan Kiszka
2014-07-01 15:23 ` Anton Ivanov (antivano)
2014-06-27 14:24 ` Stefan Hajnoczi [this message]
2014-06-27 14:24 ` [Qemu-devel] [PULL 4/4] hw/net/eepro100: Implement read-only bits in MDI registers Stefan Hajnoczi
2014-06-29 12:38 ` [Qemu-devel] [PULL for-2.1 0/4] Net patches Peter Maydell
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=1403879093-786-4-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=jiri@resnulli.us \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).