[dpdk-dev] [PATCH v4 30/39] bnxt: add start/stop/link update operations

2016-06-08 Thread Bruce Richardson
On Wed, Jun 08, 2016 at 11:02:08AM +0100, Bruce Richardson wrote:
> On Mon, Jun 06, 2016 at 03:08:34PM -0700, Stephen Hurd wrote:
> > From: Ajit Khaparde 
> > 
> > This patch adds code to add the start, stop and link update dev_ops.
> > The BNXT driver will now minimally pass traffic with testpmd.
> > 
> > v4:
> > - Fix issues pointed out by checkpatch.
> > - Shorten the string passed for reserving memzone
> > when default completion ring is created.
> > 
> > Signed-off-by: Ajit Khaparde 
> > Reviewed-by: David Christensen 
> > Signed-off-by: Stephen Hurd 
> > ---
> >  drivers/net/bnxt/bnxt_ethdev.c | 269 
> > +
> >  1 file changed, 269 insertions(+)
> > 
> I get compilation errors after applying this patch:
> 
> == Build drivers/net/bnxt
>   CC bnxt_ethdev.o
> /home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c: In 
> function ?bnxt_init_chip?:
> /home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c:135:7: 
> error: implicit declaration of function ?bnxt_alloc_hwrm_rings? 
> [-Werror=implicit-function-declaration]
>   rc = bnxt_alloc_hwrm_rings(bp);
>^
> /home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c:135:2: 
> error: nested extern declaration of ?bnxt_alloc_hwrm_rings? 
> [-Werror=nested-externs]
>   rc = bnxt_alloc_hwrm_rings(bp);
>   ^
> /home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c: In 
> function ?bnxt_init_nic?:
> /home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c:233:2: 
> error: implicit declaration of function ?bnxt_init_ring_grps? 
> [-Werror=implicit-function-declaration]
>   bnxt_init_ring_grps(bp);
>   ^
> /home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c:233:2: 
> error: nested extern declaration of ?bnxt_init_ring_grps? 
> [-Werror=nested-externs]
> cc1: all warnings being treated as errors
> /home/bruce/next-net/dpdk-next-net/mk/internal/rte.compile-pre.mk:126: recipe 
> for target 'bnxt_ethdev.o' failed
> make[5]: *** [bnxt_ethdev.o] Error 1
> 
Please ignore, my mistake, as I was missing patch 28.

/Bruce


[dpdk-dev] [PATCH v4 30/39] bnxt: add start/stop/link update operations

2016-06-08 Thread Bruce Richardson
On Mon, Jun 06, 2016 at 03:08:34PM -0700, Stephen Hurd wrote:
> From: Ajit Khaparde 
> 
> This patch adds code to add the start, stop and link update dev_ops.
> The BNXT driver will now minimally pass traffic with testpmd.
> 
> v4:
> - Fix issues pointed out by checkpatch.
> - Shorten the string passed for reserving memzone
> when default completion ring is created.
> 
> Signed-off-by: Ajit Khaparde 
> Reviewed-by: David Christensen 
> Signed-off-by: Stephen Hurd 
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 269 
> +
>  1 file changed, 269 insertions(+)
> 
I get compilation errors after applying this patch:

== Build drivers/net/bnxt
  CC bnxt_ethdev.o
/home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c: In function 
?bnxt_init_chip?:
/home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c:135:7: error: 
implicit declaration of function ?bnxt_alloc_hwrm_rings? 
[-Werror=implicit-function-declaration]
  rc = bnxt_alloc_hwrm_rings(bp);
   ^
/home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c:135:2: error: 
nested extern declaration of ?bnxt_alloc_hwrm_rings? [-Werror=nested-externs]
  rc = bnxt_alloc_hwrm_rings(bp);
  ^
/home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c: In function 
?bnxt_init_nic?:
/home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c:233:2: error: 
implicit declaration of function ?bnxt_init_ring_grps? 
[-Werror=implicit-function-declaration]
  bnxt_init_ring_grps(bp);
  ^
/home/bruce/next-net/dpdk-next-net/drivers/net/bnxt/bnxt_ethdev.c:233:2: error: 
nested extern declaration of ?bnxt_init_ring_grps? [-Werror=nested-externs]
cc1: all warnings being treated as errors
/home/bruce/next-net/dpdk-next-net/mk/internal/rte.compile-pre.mk:126: recipe 
for target 'bnxt_ethdev.o' failed
make[5]: *** [bnxt_ethdev.o] Error 1



[dpdk-dev] [PATCH v4 30/39] bnxt: add start/stop/link update operations

2016-06-06 Thread Stephen Hurd
From: Ajit Khaparde 

This patch adds code to add the start, stop and link update dev_ops.
The BNXT driver will now minimally pass traffic with testpmd.

v4:
- Fix issues pointed out by checkpatch.
- Shorten the string passed for reserving memzone
when default completion ring is created.

Signed-off-by: Ajit Khaparde 
Reviewed-by: David Christensen 
Signed-off-by: Stephen Hurd 
---
 drivers/net/bnxt/bnxt_ethdev.c | 269 +
 1 file changed, 269 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 6888363..ac82876 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -40,12 +40,17 @@
 #include 

 #include "bnxt.h"
+#include "bnxt_cpr.h"
+#include "bnxt_filter.h"
 #include "bnxt_hwrm.h"
+#include "bnxt_ring.h"
 #include "bnxt_rxq.h"
 #include "bnxt_rxr.h"
 #include "bnxt_stats.h"
 #include "bnxt_txq.h"
 #include "bnxt_txr.h"
+#include "bnxt_vnic.h"
+#include "hsi_struct_def_dpdk.h"

 #define DRV_MODULE_NAME"bnxt"
 static const char bnxt_version[] =
@@ -65,6 +70,177 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
bnxt_free_hwrm_resources(bp);
 }

+/***/
+
+/*
+ * High level utility functions
+ */
+
+static void bnxt_free_mem(struct bnxt *bp)
+{
+   bnxt_free_filter_mem(bp);
+   bnxt_free_vnic_attributes(bp);
+   bnxt_free_vnic_mem(bp);
+
+   bnxt_free_stats(bp);
+   bnxt_free_tx_rings(bp);
+   bnxt_free_rx_rings(bp);
+   bnxt_free_def_cp_ring(bp);
+}
+
+static int bnxt_alloc_mem(struct bnxt *bp)
+{
+   int rc;
+
+   /* Default completion ring */
+   rc = bnxt_init_def_ring_struct(bp, SOCKET_ID_ANY);
+   if (rc)
+   goto alloc_mem_err;
+
+   rc = bnxt_alloc_rings(bp, 0, NULL, NULL,
+ bp->def_cp_ring, "def_cp");
+   if (rc)
+   goto alloc_mem_err;
+
+   rc = bnxt_alloc_vnic_mem(bp);
+   if (rc)
+   goto alloc_mem_err;
+
+   rc = bnxt_alloc_vnic_attributes(bp);
+   if (rc)
+   goto alloc_mem_err;
+
+   rc = bnxt_alloc_filter_mem(bp);
+   if (rc)
+   goto alloc_mem_err;
+
+   return 0;
+
+alloc_mem_err:
+   bnxt_free_mem(bp);
+   return rc;
+}
+
+static int bnxt_init_chip(struct bnxt *bp)
+{
+   unsigned int i, rss_idx, fw_idx;
+   int rc;
+
+   rc = bnxt_alloc_all_hwrm_stat_ctxs(bp);
+   if (rc) {
+   RTE_LOG(ERR, PMD, "HWRM stat ctx alloc failure rc: %x\n", rc);
+   goto err_out;
+   }
+
+   rc = bnxt_alloc_hwrm_rings(bp);
+   if (rc) {
+   RTE_LOG(ERR, PMD, "HWRM ring alloc failure rc: %x\n", rc);
+   goto err_out;
+   }
+
+   rc = bnxt_alloc_all_hwrm_ring_grps(bp);
+   if (rc) {
+   RTE_LOG(ERR, PMD, "HWRM ring grp alloc failure: %x\n", rc);
+   goto err_out;
+   }
+
+   rc = bnxt_mq_rx_configure(bp);
+   if (rc) {
+   RTE_LOG(ERR, PMD, "MQ mode configure failure rc: %x\n", rc);
+   goto err_out;
+   }
+
+   /* VNIC configuration */
+   for (i = 0; i < bp->nr_vnics; i++) {
+   struct bnxt_vnic_info *vnic = >vnic_info[i];
+
+   rc = bnxt_hwrm_vnic_alloc(bp, vnic);
+   if (rc) {
+   RTE_LOG(ERR, PMD, "HWRM vnic alloc failure rc: %x\n",
+   rc);
+   goto err_out;
+   }
+
+   rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic);
+   if (rc) {
+   RTE_LOG(ERR, PMD,
+   "HWRM vnic ctx alloc failure rc: %x\n", rc);
+   goto err_out;
+   }
+
+   rc = bnxt_hwrm_vnic_cfg(bp, vnic);
+   if (rc) {
+   RTE_LOG(ERR, PMD, "HWRM vnic cfg failure rc: %x\n", rc);
+   goto err_out;
+   }
+
+   rc = bnxt_set_hwrm_vnic_filters(bp, vnic);
+   if (rc) {
+   RTE_LOG(ERR, PMD, "HWRM vnic filter failure rc: %x\n",
+   rc);
+   goto err_out;
+   }
+   if (vnic->rss_table && vnic->hash_type) {
+   /*
+* Fill the RSS hash & redirection table with
+* ring group ids for all VNICs
+*/
+   for (rss_idx = 0, fw_idx = 0;
+rss_idx < HW_HASH_INDEX_SIZE;
+rss_idx++, fw_idx++) {
+   if (vnic->fw_grp_ids[fw_idx] ==
+   INVALID_HW_RING_ID)
+   fw_idx = 0;
+   vnic->rss_table[rss_idx] =
+