From patchwork Wed Sep 8 07:29:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Kumar X-Patchwork-Id: 64098 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44284B6F0E for ; Wed, 8 Sep 2010 17:29:21 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758068Ab0IHH3S (ORCPT ); Wed, 8 Sep 2010 03:29:18 -0400 Received: from e28smtp04.in.ibm.com ([122.248.162.4]:52380 "EHLO e28smtp04.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757930Ab0IHH3L (ORCPT ); Wed, 8 Sep 2010 03:29:11 -0400 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp04.in.ibm.com (8.14.4/8.13.1) with ESMTP id o887T7Bn032708; Wed, 8 Sep 2010 12:59:08 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o887T7Gf3559498; Wed, 8 Sep 2010 12:59:07 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o887T6l8017150; Wed, 8 Sep 2010 17:29:07 +1000 Received: from krkumar2.in.ibm.com ([9.124.208.96]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o887T5f4016962; Wed, 8 Sep 2010 17:29:05 +1000 From: Krishna Kumar To: rusty@rustcorp.com.au, davem@davemloft.net Cc: netdev@vger.kernel.org, Krishna Kumar , anthony@codemonkey.ws, kvm@vger.kernel.org, mst@redhat.com Date: Wed, 08 Sep 2010 12:59:05 +0530 Message-Id: <20100908072905.23769.10732.sendpatchset@krkumar2.in.ibm.com> In-Reply-To: <20100908072859.23769.97363.sendpatchset@krkumar2.in.ibm.com> References: <20100908072859.23769.97363.sendpatchset@krkumar2.in.ibm.com> Subject: [RFC PATCH 1/4] Add a new API to virtio-pci Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add virtio_get_queue_index() to get the queue index of a vq. This is needed by the cb handler to locate the queue that should be processed. Signed-off-by: Krishna Kumar --- drivers/virtio/virtio_pci.c | 9 +++++++++ include/linux/virtio.h | 3 +++ 2 files changed, 12 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -ruNp org/include/linux/virtio.h tx_only/include/linux/virtio.h --- org/include/linux/virtio.h 2010-09-03 16:33:51.000000000 +0530 +++ tx_only/include/linux/virtio.h 2010-09-08 10:23:36.000000000 +0530 @@ -136,4 +136,7 @@ struct virtio_driver { int register_virtio_driver(struct virtio_driver *drv); void unregister_virtio_driver(struct virtio_driver *drv); + +/* return the internal queue index associated with the virtqueue */ +extern int virtio_get_queue_index(struct virtqueue *vq); #endif /* _LINUX_VIRTIO_H */ diff -ruNp org/drivers/virtio/virtio_pci.c tx_only/drivers/virtio/virtio_pci.c --- org/drivers/virtio/virtio_pci.c 2010-09-03 16:33:51.000000000 +0530 +++ tx_only/drivers/virtio/virtio_pci.c 2010-09-08 10:23:16.000000000 +0530 @@ -359,6 +359,15 @@ static int vp_request_intx(struct virtio return err; } +/* Return the internal queue index associated with the virtqueue */ +int virtio_get_queue_index(struct virtqueue *vq) +{ + struct virtio_pci_vq_info *info = vq->priv; + + return info->queue_index; +} +EXPORT_SYMBOL(virtio_get_queue_index); + static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index, void (*callback)(struct virtqueue *vq), const char *name,