DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cunming Liang <cunming.liang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [RFC PATCH 1/6] eal: common direct ring access API
Date: Tue, 25 Nov 2014 22:11:17 +0800	[thread overview]
Message-ID: <1416924682-24170-2-git-send-email-cunming.liang@intel.com> (raw)
In-Reply-To: <1416924682-24170-1-git-send-email-cunming.liang@intel.com>


Signed-off-by: Cunming Liang <cunming.liang@intel.com>
---
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 +++++++++++++++++++++++++
 2 files changed, 191 insertions(+)
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h

diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 499ba4d..6b2e231 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -52,6 +52,11 @@ GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h
 ARCH_DIR ?= $(RTE_ARCH)
 ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))
 
+ifeq ($(CONFIG_RTE_LIBRTE_EAL_LINUXAPP),y)
+INC += rte_pci_bifurc.h
+endif
+
+
 SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include := $(addprefix include/,$(INC))
 SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include += \
 	$(addprefix include/arch/$(ARCH_DIR)/,$(ARCH_INC))
diff --git a/lib/librte_eal/common/include/rte_pci_bifurc.h b/lib/librte_eal/common/include/rte_pci_bifurc.h
new file mode 100644
index 0000000..ad93124
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_pci_bifurc.h
@@ -0,0 +1,186 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTE_PCI_BIFURC_H_
+#define _RTE_PCI_BIFURC_H_
+
+/**
+ * @file
+ *
+ * RTE PCI BIFURC Interface
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_pci.h>
+#include <rte_devargs.h>
+
+
+/**
+ * Open a socket for direct ring access.
+ * For those socket API support direct ring access,
+ * it opens a socket for such address family.
+ *
+ * @param sockfd
+ *     A pinter to socket file descriptor to get the open sockfd.
+ * @return
+ *     0 on success, negative on error.
+ *
+ */
+int rte_eal_bifurc_open(int *sockfd);
+
+/**
+ * Bind a net interface to specific socket for direct ring access.
+ *
+ * @param sockfd
+ *	The Socket file descriptor to bind the net interface with.
+ * @param if_index
+ *	The net interface used for direct ring access.
+ * @return
+ *      0 on success, negative on error.
+ */
+int rte_eal_bifurc_bind(int sockfd, int if_index);
+
+/**
+ * Map ring specific register space for direct access.
+ *
+ * @param sockfd
+ *	The socket file descriptor to get the ring address mapping from.
+ * @param addr
+ *	The pointer to the virtual address got from mapping.
+ * @param size
+ *      The pointer to the memory size.
+ * @return
+ *      0 on success, negative on error.
+ */
+int rte_eal_bifurc_map(int sockfd, void **addr, uint32_t *size);
+
+/**
+ * Unmap ring specific register space for direct access.
+ *
+ * @param sockfd
+ *	The socket file descriptor to release the ring address mapping.
+ * @param addr
+ *	The unmap virtual address.
+ */
+void rte_eal_bifurc_unmap(int sockfd, void *addr);
+
+/**
+ * Split the ring pairs from the net device.
+ * For those net device support direct ring access,
+ * will split the ring and exclusively reserve the resource.
+ *
+ * @param sockfd
+ *	The socket fd owns the split ring resource.
+ * @param nb_qp
+ *	Request number of queue pair.
+ * @param qp_start
+ *      The first queue pair id.
+ * @return
+ *      0 on success, negative on error.
+ */
+int rte_eal_bifurc_split(int sockfd, uint32_t *nb_qp, uint32_t *qp_start);
+
+/**
+ * Retire the ring pairs to the net device.
+ *
+ * @param sockfd
+ *	The socket fd owns the ring resource.
+ * @param nb_qp
+ *	Request number of queue pair.
+ * @param qp_start
+ *      The first queue pair id.
+ */
+void rte_eal_bifurc_retire(int sockfd, uint32_t nb_qp, uint32_t qp_start);
+
+/**
+ * Utility function to initial pci info in rte_pci_device by net device.
+ *
+ * @param sockfd
+ *	The socket fd stands for the binding net device.
+ * @param pci_dev
+ *	The pointer of pci device to hook with the net device.
+ * @return
+ *      0 on success, negative on error.
+ */
+int rte_eal_bifurc_set_pci(int sockfd, struct rte_pci_device *pci_dev);
+
+/**
+ * Utility function to get net interface info by iface name.
+ *
+ * @param sockfd
+ *	The socket fd which already bind with the net device.
+ * @param iface_name
+ *	The string for iface name.
+ * @param if_index
+ *      The pointer to the index of such net interface/device.
+ * @param hwaddr
+ *      The pointer to the MAC address of such net device.
+ * @param mtu
+ *      The pointer to the MTU os such net device.
+ * @return
+ *      0 on success, negative on error.
+ */
+int rte_eal_bifurc_get_ifinfo(int sockfd, char *iface_name,
+			      int *if_index, uint8_t *hwaddr, int *mtu);
+
+/**
+ * Utility function to get/alloc a devargs instance.
+ *
+ * @param drv_name
+ *	The string of driver name in devargs.
+ * @param args
+ *	The args in devargs.
+ * @return
+ *      0 on success, negative on error.
+ */
+struct rte_devargs *
+rte_eal_bifurc_get_devargs(const char *drv_name, const char *args);
+
+/**
+ * Utility function to free the devargs instance.
+ *
+ * @param devargs
+ *	The devargs instance to free.
+ *
+ */
+void rte_eal_bifurc_put_devargs(struct rte_devargs *devargs);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PCI_BIFURC_H_ */
-- 
1.8.1.4

  reply	other threads:[~2014-11-25 14:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 14:11 [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver Cunming Liang
2014-11-25 14:11 ` Cunming Liang [this message]
2014-11-25 14:11 ` [dpdk-dev] [RFC PATCH 2/6] eal: direct ring access support by linux af_packet Cunming Liang
2014-11-25 14:11 ` [dpdk-dev] [RFC PATCH 3/6] pci: allow VDEV as pci device during device driver probe Cunming Liang
2014-11-25 14:11 ` [dpdk-dev] [RFC PATCH 4/6] bifurc: add driver to scan bifurcated netdev Cunming Liang
2014-11-25 14:11 ` [dpdk-dev] [RFC PATCH 5/6] ixgbe: rx/tx queue stop bug fix Cunming Liang
2014-11-26  0:44   ` Ouyang, Changchun
2014-11-25 14:11 ` [dpdk-dev] [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device Cunming Liang
2014-11-25 14:34   ` Bruce Richardson
2014-11-25 14:48     ` Liang, Cunming
2014-11-25 15:01       ` Bruce Richardson
2014-11-26  8:22         ` Liang, Cunming
2014-11-26 10:35           ` Bruce Richardson
2014-11-25 14:23 ` [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver Neil Horman
2014-11-25 14:29   ` Bruce Richardson
2014-11-25 14:40     ` Liang, Cunming
2014-11-25 14:46       ` Zhou, Danny
2014-11-25 14:57     ` Walukiewicz, Miroslaw
2014-11-25 15:02       ` Bruce Richardson
2014-11-25 15:23         ` Zhou, Danny
2014-11-26 10:45           ` Walukiewicz, Miroslaw
2014-11-26 12:22             ` Zhou, Danny
2015-04-09  3:43 ` 贾学涛
2015-04-20  9:53   ` Shelton Chia

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=1416924682-24170-2-git-send-email-cunming.liang@intel.com \
    --to=cunming.liang@intel.com \
    --cc=dev@dpdk.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).