From: Zhi Yong Wu <zwu.kernel@gmail•com>
To: netdev@vger•kernel.org
Cc: therbert@google•com, edumazet@google•com, davem@davemloft•net,
Zhi Yong Wu <wuzhy@linux•vnet.ibm.com>
Subject: [RFC PATCH net-next 1/3] virtio_pci: Introduce one new config api vp_get_vq_irq()
Date: Wed, 15 Jan 2014 22:20:52 +0800 [thread overview]
Message-ID: <1389795654-28381-2-git-send-email-zwu.kernel@gmail.com> (raw)
In-Reply-To: <1389795654-28381-1-git-send-email-zwu.kernel@gmail.com>
From: Zhi Yong Wu <wuzhy@linux•vnet.ibm.com>
This config api is used to get irq number of the given virtqueue.
Signed-off-by: Zhi Yong Wu <wuzhy@linux•vnet.ibm.com>
---
drivers/virtio/virtio_pci.c | 11 +++++++++++
include/linux/virtio_config.h | 12 ++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index a37c699..85f1aa6 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -654,6 +654,16 @@ static int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
return 0;
}
+static int vp_get_vq_irq(struct virtio_device *vdev, struct virtqueue *vq)
+{
+ struct virtio_pci_device *vp_dev = to_vp_device(vdev);
+ struct virtio_pci_vq_info *info = vq->priv;
+
+ if (vp_dev->msix_enabled)
+ return vp_dev->msix_entries[info->msix_vector].vector;
+ return -1;
+}
+
static const struct virtio_config_ops virtio_pci_config_ops = {
.get = vp_get,
.set = vp_set,
@@ -666,6 +676,7 @@ static const struct virtio_config_ops virtio_pci_config_ops = {
.finalize_features = vp_finalize_features,
.bus_name = vp_bus_name,
.set_vq_affinity = vp_set_vq_affinity,
+ .get_vq_irq = vp_get_vq_irq,
};
static void virtio_pci_release_dev(struct device *_d)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e8f8f71..b70fc47 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -51,6 +51,9 @@
* This returns a pointer to the bus name a la pci_name from which
* the caller can then copy.
* @set_vq_affinity: set the affinity for a virtqueue.
+ * @get_vq_irq: get irq of the given virtqueue
+ * vdev: the virtio_device
+ * vq: the virtqueue
*/
typedef void vq_callback_t(struct virtqueue *);
struct virtio_config_ops {
@@ -70,6 +73,7 @@ struct virtio_config_ops {
void (*finalize_features)(struct virtio_device *vdev);
const char *(*bus_name)(struct virtio_device *vdev);
int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
+ int (*get_vq_irq)(struct virtio_device *vdev, struct virtqueue *vq);
};
/* If driver didn't advertise the feature, it will never appear. */
@@ -135,6 +139,14 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
return 0;
}
+static inline
+int virtqueue_get_vq_irq(struct virtio_device *vdev, struct virtqueue *vq)
+{
+ if (vdev->config->get_vq_irq)
+ return vdev->config->get_vq_irq(vdev, vq);
+ return -1;
+}
+
/* Config space accessors. */
#define virtio_cread(vdev, structname, member, ptr) \
do { \
--
1.7.6.5
next prev parent reply other threads:[~2014-01-15 14:21 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 14:20 [RFC PATCH net-next 0/3] virtio_net: add aRFS support Zhi Yong Wu
2014-01-15 14:20 ` Zhi Yong Wu [this message]
2014-01-15 14:20 ` [RFC PATCH net-next 2/3] virtio_net: Introduce one dummy function virtnet_filter_rfs() Zhi Yong Wu
2014-01-15 17:54 ` Tom Herbert
2014-01-16 2:45 ` Zhi Yong Wu
2014-01-15 14:20 ` [RFC PATCH net-next 3/3] virtio-net: Add accelerated RFS support Zhi Yong Wu
2014-01-16 21:31 ` Ben Hutchings
2014-01-16 22:00 ` Zhi Yong Wu
2014-01-16 23:16 ` Ben Hutchings
2014-01-17 16:54 ` Zhi Yong Wu
2014-01-17 17:20 ` Ben Hutchings
2014-01-18 4:59 ` Tom Herbert
2014-01-18 14:19 ` Ben Hutchings
2014-01-16 4:23 ` [RFC PATCH net-next 0/3] virtio_net: add aRFS support Jason Wang
2014-01-16 8:34 ` Fwd: " Zhi Yong Wu
2014-01-16 8:52 ` Stefan Hajnoczi
2014-01-16 17:12 ` Tom Herbert
2014-01-17 3:26 ` Jason Wang
2014-01-17 5:08 ` Tom Herbert
2014-01-17 6:36 ` Jason Wang
2014-01-17 16:03 ` Tom Herbert
2014-01-17 5:22 ` Stefan Hajnoczi
2014-01-17 6:45 ` Jason Wang
2014-01-20 14:36 ` Ben Hutchings
2014-01-22 13:27 ` Zhi Yong Wu
2014-01-22 18:00 ` Tom Herbert
2014-01-23 0:40 ` Zhi Yong Wu
2014-01-23 14:23 ` Michael S. Tsirkin
2014-01-17 3:04 ` Jason Wang
2014-01-20 16:49 ` Stefan Hajnoczi
2014-01-16 8:48 ` Zhi Yong Wu
2014-01-23 14:26 ` Michael S. Tsirkin
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=1389795654-28381-2-git-send-email-zwu.kernel@gmail.com \
--to=zwu.kernel@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=therbert@google$(echo .)com \
--cc=wuzhy@linux$(echo .)vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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