[dpdk-dev] [PATCH v6 5/6] enicpmd: DPDK-ENIC PMD interface

2015-01-30 Thread Wu, Jingjing
Hi, ssujith

> -Original Message-
> From: Sujith Sankar (ssujith) [mailto:ssujith at cisco.com]
> Sent: Tuesday, December 30, 2014 12:46 PM
> To: Wu, Jingjing; dev at dpdk.org
> Cc: Prasad Rao (prrao)
> Subject: Re: [dpdk-dev] [PATCH v6 5/6] enicpmd: DPDK-ENIC PMD interface
> 
> 
> 
> On 29/12/14 1:45 pm, "Wu, Jingjing"  wrote:
> 
> >Hi, ssujith
> >
> >> +  .tx_queue_release = enicpmd_dev_tx_queue_release,
> >> +  .dev_led_on   = NULL,
> >> +  .dev_led_off  = NULL,
> >> +  .flow_ctrl_get= NULL,
> >> +  .flow_ctrl_set= NULL,
> >> +  .priority_flow_ctrl_set = NULL,
> >> +  .mac_addr_add = enicpmd_add_mac_addr,
> >> +  .mac_addr_remove  = enicpmd_remove_mac_addr,
> >> +  .fdir_add_signature_filter= NULL,
> >> +  .fdir_update_signature_filter = NULL,
> >> +  .fdir_remove_signature_filter = NULL,
> >> +  .fdir_infos_get   = enicpmd_fdir_info_get,
> >> +  .fdir_add_perfect_filter  = enicpmd_fdir_add_perfect_filter,
> >> +  .fdir_update_perfect_filter   = enicpmd_fdir_add_perfect_filter,
> >> +  .fdir_remove_perfect_filter   = enicpmd_fdir_remove_perfect_filter,
> >> +  .fdir_set_masks   = NULL,
> >> +};
> >> +
> >
> >I found that in perfect fdir is also supported in enic driver.
> >
> >During the R1.8 development, we defined a new dev_ops call filter_ctrl,
> >which can be used to control kinds of filters, flow director is
> >included too. Which is mentioned in
> >http://www.dpdk.org/ml/archives/dev/2014-September/005179.html .
> >In R1.8, filter_ctrl is only used by i40e driver. And we also planned
> >use it in the existing ixgbe/e1000 driver in the next days. The old
> >APIs such as fdir_add_perfect_filter, fdir_remove_perfect_filter can be
> >replaced then.
> 
> 
> Hi Jingjing,
> Thanks for the info and the link.  I shall take a look at it.
> It looks like bringing in one interface for all filter related operations.
>  I believe ENIC should also move to it.
> 
> Thanks,
> -Sujith
> 

Just let you know that, I already sent the patch to migrate the flow director 
in ixgbe driver to new filter_ctrl API.
http://www.dpdk.org/ml/archives/dev/2015-January/011830.html 
To avoid compile error and influence to enic driver. I didn't remove the old 
APIs and structures in rte_ethdev. I think they can be removed when the 
migration in enic driver is done. Do you have any plan for this?

Thank u!
Jingjing

> >
> >So, do you have any plan to migrate the fdir in enic to the filter_ctrl
> >API?
> >
> >Jingjing
> >
> >Thanks!
> >
> >> +struct enic *enicpmd_list_head = NULL;
> >> +/* Initialize the driver
> >> + * It returns 0 on success.
> >> + */
> >> +static int eth_enicpmd_dev_init(
> >> +  __attribute__((unused))struct eth_driver *eth_drv,
> >> +  struct rte_eth_dev *eth_dev)
> >> +{
> >> +  struct rte_pci_device *pdev;
> >> +  struct rte_pci_addr *addr;
> >> +  struct enic *enic = pmd_priv(eth_dev);
> >> +
> >> +  ENICPMD_FUNC_TRACE();
> >> +
> >> +  enic->rte_dev = eth_dev;
> >> +  eth_dev->dev_ops = _eth_dev_ops;
> >> +  eth_dev->rx_pkt_burst = _recv_pkts;
> >> +  eth_dev->tx_pkt_burst = _xmit_pkts;
> >> +
> >> +  pdev = eth_dev->pci_dev;
> >> +  enic->pdev = pdev;
> >> +  addr = >addr;
> >> +
> >> +  snprintf(enic->bdf_name, ENICPMD_BDF_LENGTH,
> >> "%04x:%02x:%02x.%x",
> >> +  addr->domain, addr->bus, addr->devid, addr->function);
> >> +
> >> +  return enic_probe(enic);
> >> +}
> >> +
> >> +static struct eth_driver rte_enic_pmd = {
> >> +  {
> >> +  .name = "rte_enic_pmd",
> >> +  .id_table = pci_id_enic_map,
> >> +  .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> >> +  },
> >> +  .eth_dev_init = eth_enicpmd_dev_init,
> >> +  .dev_private_size = sizeof(struct enic), };
> >> +
> >> +/* Driver initialization routine.
> >> + * Invoked once at EAL init time.
> >> + * Register as the [Poll Mode] Driver of Cisco ENIC device.
> >> + */
> >> +int rte_enic_pmd_init(const char *name __rte_unused,
> >> +  const char *params __rte_unused)
> >> +{
> >> +  ENICPMD_FUNC_TRACE();
> >> +
> >> +  rte_eth_driver_register(_enic_pmd);
> >> +  return 0;
> >> +}
> >> +
> >> +static struct rte_driver rte_enic_driver = {
> >> +  .type = PMD_PDEV,
> >> +  .init = rte_enic_pmd_init,
> >> +};
> >> +
> >> +PMD_REGISTER_DRIVER(rte_enic_driver);
> >> +
> >> --
> >> 1.9.1
> >



[dpdk-dev] [PATCH v6 5/6] enicpmd: DPDK-ENIC PMD interface

2015-01-06 Thread Thomas Monjalon
2014-12-30 04:45, Sujith Sankar:
> On 29/12/14 1:45 pm, "Wu, Jingjing"  wrote:
> >I found that in perfect fdir is also supported in enic driver.
> >
> >During the R1.8 development, we defined a new dev_ops call filter_ctrl,
> >which can be used to control kinds of filters, flow director is included
> >too. Which is mentioned in
> >http://www.dpdk.org/ml/archives/dev/2014-September/005179.html .
> >In R1.8, filter_ctrl is only used by i40e driver. And we also planned use
> >it in the existing ixgbe/e1000 driver in the next days. The old APIs such
> >as fdir_add_perfect_filter, fdir_remove_perfect_filter can be replaced
> >then.
> 
> Hi Jingjing,
> Thanks for the info and the link.  I shall take a look at it.
> It looks like bringing in one interface for all filter related operations.
>  I believe ENIC should also move to it.

Yes please.
It is planned to remove or deprecate old flow director API.

-- 
Thomas


[dpdk-dev] [PATCH v6 5/6] enicpmd: DPDK-ENIC PMD interface

2014-12-30 Thread Sujith Sankar (ssujith)


On 29/12/14 1:45 pm, "Wu, Jingjing"  wrote:

>Hi, ssujith
>
>> +.tx_queue_release = enicpmd_dev_tx_queue_release,
>> +.dev_led_on   = NULL,
>> +.dev_led_off  = NULL,
>> +.flow_ctrl_get= NULL,
>> +.flow_ctrl_set= NULL,
>> +.priority_flow_ctrl_set = NULL,
>> +.mac_addr_add = enicpmd_add_mac_addr,
>> +.mac_addr_remove  = enicpmd_remove_mac_addr,
>> +.fdir_add_signature_filter= NULL,
>> +.fdir_update_signature_filter = NULL,
>> +.fdir_remove_signature_filter = NULL,
>> +.fdir_infos_get   = enicpmd_fdir_info_get,
>> +.fdir_add_perfect_filter  = enicpmd_fdir_add_perfect_filter,
>> +.fdir_update_perfect_filter   = enicpmd_fdir_add_perfect_filter,
>> +.fdir_remove_perfect_filter   = enicpmd_fdir_remove_perfect_filter,
>> +.fdir_set_masks   = NULL,
>> +};
>> +
>
>I found that in perfect fdir is also supported in enic driver.
>
>During the R1.8 development, we defined a new dev_ops call filter_ctrl,
>which can be used to control kinds of filters, flow director is included
>too. Which is mentioned in
>http://www.dpdk.org/ml/archives/dev/2014-September/005179.html .
>In R1.8, filter_ctrl is only used by i40e driver. And we also planned use
>it in the existing ixgbe/e1000 driver in the next days. The old APIs such
>as fdir_add_perfect_filter, fdir_remove_perfect_filter can be replaced
>then.


Hi Jingjing,
Thanks for the info and the link.  I shall take a look at it.
It looks like bringing in one interface for all filter related operations.
 I believe ENIC should also move to it.

Thanks,
-Sujith

>
>So, do you have any plan to migrate the fdir in enic to the filter_ctrl
>API?
>
>Jingjing
>
>Thanks!
>
>> +struct enic *enicpmd_list_head = NULL;
>> +/* Initialize the driver
>> + * It returns 0 on success.
>> + */
>> +static int eth_enicpmd_dev_init(
>> +__attribute__((unused))struct eth_driver *eth_drv,
>> +struct rte_eth_dev *eth_dev)
>> +{
>> +struct rte_pci_device *pdev;
>> +struct rte_pci_addr *addr;
>> +struct enic *enic = pmd_priv(eth_dev);
>> +
>> +ENICPMD_FUNC_TRACE();
>> +
>> +enic->rte_dev = eth_dev;
>> +eth_dev->dev_ops = _eth_dev_ops;
>> +eth_dev->rx_pkt_burst = _recv_pkts;
>> +eth_dev->tx_pkt_burst = _xmit_pkts;
>> +
>> +pdev = eth_dev->pci_dev;
>> +enic->pdev = pdev;
>> +addr = >addr;
>> +
>> +snprintf(enic->bdf_name, ENICPMD_BDF_LENGTH,
>> "%04x:%02x:%02x.%x",
>> +addr->domain, addr->bus, addr->devid, addr->function);
>> +
>> +return enic_probe(enic);
>> +}
>> +
>> +static struct eth_driver rte_enic_pmd = {
>> +{
>> +.name = "rte_enic_pmd",
>> +.id_table = pci_id_enic_map,
>> +.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
>> +},
>> +.eth_dev_init = eth_enicpmd_dev_init,
>> +.dev_private_size = sizeof(struct enic), };
>> +
>> +/* Driver initialization routine.
>> + * Invoked once at EAL init time.
>> + * Register as the [Poll Mode] Driver of Cisco ENIC device.
>> + */
>> +int rte_enic_pmd_init(const char *name __rte_unused,
>> +const char *params __rte_unused)
>> +{
>> +ENICPMD_FUNC_TRACE();
>> +
>> +rte_eth_driver_register(_enic_pmd);
>> +return 0;
>> +}
>> +
>> +static struct rte_driver rte_enic_driver = {
>> +.type = PMD_PDEV,
>> +.init = rte_enic_pmd_init,
>> +};
>> +
>> +PMD_REGISTER_DRIVER(rte_enic_driver);
>> +
>> --
>> 1.9.1
>



[dpdk-dev] [PATCH v6 5/6] enicpmd: DPDK-ENIC PMD interface

2014-12-29 Thread Wu, Jingjing
Hi, ssujith

> + .tx_queue_release = enicpmd_dev_tx_queue_release,
> + .dev_led_on   = NULL,
> + .dev_led_off  = NULL,
> + .flow_ctrl_get= NULL,
> + .flow_ctrl_set= NULL,
> + .priority_flow_ctrl_set = NULL,
> + .mac_addr_add = enicpmd_add_mac_addr,
> + .mac_addr_remove  = enicpmd_remove_mac_addr,
> + .fdir_add_signature_filter= NULL,
> + .fdir_update_signature_filter = NULL,
> + .fdir_remove_signature_filter = NULL,
> + .fdir_infos_get   = enicpmd_fdir_info_get,
> + .fdir_add_perfect_filter  = enicpmd_fdir_add_perfect_filter,
> + .fdir_update_perfect_filter   = enicpmd_fdir_add_perfect_filter,
> + .fdir_remove_perfect_filter   = enicpmd_fdir_remove_perfect_filter,
> + .fdir_set_masks   = NULL,
> +};
> +

I found that in perfect fdir is also supported in enic driver.

During the R1.8 development, we defined a new dev_ops call filter_ctrl, which 
can be used to control kinds of filters, flow director is included too. Which 
is mentioned in  http://www.dpdk.org/ml/archives/dev/2014-September/005179.html 
.
In R1.8, filter_ctrl is only used by i40e driver. And we also planned use it in 
the existing ixgbe/e1000 driver in the next days. The old APIs such as 
fdir_add_perfect_filter, fdir_remove_perfect_filter can be replaced then.

So, do you have any plan to migrate the fdir in enic to the filter_ctrl API?

Jingjing

Thanks!

> +struct enic *enicpmd_list_head = NULL;
> +/* Initialize the driver
> + * It returns 0 on success.
> + */
> +static int eth_enicpmd_dev_init(
> + __attribute__((unused))struct eth_driver *eth_drv,
> + struct rte_eth_dev *eth_dev)
> +{
> + struct rte_pci_device *pdev;
> + struct rte_pci_addr *addr;
> + struct enic *enic = pmd_priv(eth_dev);
> +
> + ENICPMD_FUNC_TRACE();
> +
> + enic->rte_dev = eth_dev;
> + eth_dev->dev_ops = _eth_dev_ops;
> + eth_dev->rx_pkt_burst = _recv_pkts;
> + eth_dev->tx_pkt_burst = _xmit_pkts;
> +
> + pdev = eth_dev->pci_dev;
> + enic->pdev = pdev;
> + addr = >addr;
> +
> + snprintf(enic->bdf_name, ENICPMD_BDF_LENGTH,
> "%04x:%02x:%02x.%x",
> + addr->domain, addr->bus, addr->devid, addr->function);
> +
> + return enic_probe(enic);
> +}
> +
> +static struct eth_driver rte_enic_pmd = {
> + {
> + .name = "rte_enic_pmd",
> + .id_table = pci_id_enic_map,
> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
> + },
> + .eth_dev_init = eth_enicpmd_dev_init,
> + .dev_private_size = sizeof(struct enic), };
> +
> +/* Driver initialization routine.
> + * Invoked once at EAL init time.
> + * Register as the [Poll Mode] Driver of Cisco ENIC device.
> + */
> +int rte_enic_pmd_init(const char *name __rte_unused,
> + const char *params __rte_unused)
> +{
> + ENICPMD_FUNC_TRACE();
> +
> + rte_eth_driver_register(_enic_pmd);
> + return 0;
> +}
> +
> +static struct rte_driver rte_enic_driver = {
> + .type = PMD_PDEV,
> + .init = rte_enic_pmd_init,
> +};
> +
> +PMD_REGISTER_DRIVER(rte_enic_driver);
> +
> --
> 1.9.1



[dpdk-dev] [PATCH v6 5/6] enicpmd: DPDK-ENIC PMD interface

2014-11-25 Thread Sujith Sankar
Signed-off-by: Sujith Sankar 
---
 lib/librte_pmd_enic/enic_etherdev.c | 613 
 1 file changed, 613 insertions(+)
 create mode 100644 lib/librte_pmd_enic/enic_etherdev.c

diff --git a/lib/librte_pmd_enic/enic_etherdev.c 
b/lib/librte_pmd_enic/enic_etherdev.c
new file mode 100644
index 000..d0577aa
--- /dev/null
+++ b/lib/librte_pmd_enic/enic_etherdev.c
@@ -0,0 +1,613 @@
+/*
+ * Copyright 2008-2014 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
+ *
+ * Copyright (c) 2014, Cisco Systems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. 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.
+ *
+ * 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 HOLDER 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.
+ *
+ */
+#ident "$Id$"
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "vnic_intr.h"
+#include "vnic_cq.h"
+#include "vnic_wq.h"
+#include "vnic_rq.h"
+#include "vnic_enet.h"
+#include "enic.h"
+
+#define ENICPMD_FUNC_TRACE() \
+   RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__)
+
+/*
+ * The set of PCI devices this driver supports
+ */
+static struct rte_pci_id pci_id_enic_map[] = {
+#define RTE_PCI_DEV_ID_DECL_ENIC(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
+#ifndef PCI_VENDOR_ID_CISCO
+#define PCI_VENDOR_ID_CISCO0x1137
+#endif
+#include "rte_pci_dev_ids.h"
+RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET)
+RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF)
+{.vendor_id = 0, /* Sentinal */},
+};
+
+static int enicpmd_fdir_remove_perfect_filter(struct rte_eth_dev *eth_dev,
+   struct rte_fdir_filter *fdir_filter,
+   uint16_t soft_id)
+{
+   struct enic *enic = pmd_priv(eth_dev);
+
+   ENICPMD_FUNC_TRACE();
+   return enic_fdir_del_fltr(enic, fdir_filter);
+}
+
+static int enicpmd_fdir_add_perfect_filter(struct rte_eth_dev *eth_dev,
+   struct rte_fdir_filter *fdir_filter, uint16_t soft_id,
+   uint8_t queue, uint8_t drop)
+{
+   struct enic *enic = pmd_priv(eth_dev);
+
+   ENICPMD_FUNC_TRACE();
+   return enic_fdir_add_fltr(enic, fdir_filter, (uint16_t)queue, drop);
+}
+
+static void enicpmd_fdir_info_get(struct rte_eth_dev *eth_dev,
+   struct rte_eth_fdir *fdir)
+{
+   struct enic *enic = pmd_priv(eth_dev);
+
+   ENICPMD_FUNC_TRACE();
+   *fdir = enic->fdir.stats;
+}
+
+static void enicpmd_dev_tx_queue_release(void *txq)
+{
+   ENICPMD_FUNC_TRACE();
+   enic_free_wq(txq);
+}
+
+static int enicpmd_dev_setup_intr(struct enic *enic)
+{
+   int ret;
+   int index;
+
+   ENICPMD_FUNC_TRACE();
+
+   /* Are we done with the init of all the queues? */
+   for (index = 0; index < enic->cq_count; index++) {
+   if (!enic->cq[index].ctrl)
+   break;
+   }
+
+   if (enic->cq_count != index)
+   return 0;
+
+   ret = enic_alloc_intr_resources(enic);
+   if (ret) {
+   dev_err(enic, "alloc intr failed\n");
+   return ret;
+   }
+   enic_init_vnic_resources(enic);
+
+   ret = enic_setup_finish(enic);
+   if (ret)
+   dev_err(enic, "setup could not be finished\n");
+
+   return ret;
+}
+
+static int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
+   uint16_t queue_idx,
+   uint16_t nb_desc,
+   unsigned int socket_id,
+   const struct rte_eth_txconf *tx_conf)
+{
+   int ret;
+   struct enic *enic = pmd_priv(eth_dev);
+
+   ENICPMD_FUNC_TRACE();
+   eth_dev->data->tx_queues[queue_idx] = (void *)>wq[queue_idx];
+
+   ret = enic_alloc_wq(enic, queue_idx, socket_id, nb_desc);
+   if (ret) {
+   dev_err(enic, "error in allocating wq\n");
+