[dpdk-dev] [PATCH v2 20/40] bnxt: add vnic RSS cos lb cTx alloc/free functions

2016-05-26 Thread Bruce Richardson
On Fri, May 13, 2016 at 03:46:09PM -0700, Stephen Hurd wrote:
> More HWRM calls.
> 

The title should be shortened to something like "add vnic ctx functions" and the
commit message should then explain what the contexts are for, and how things 
like
RSS apply.

/Bruce



[dpdk-dev] [PATCH v2 20/40] bnxt: add vnic RSS cos lb cTx alloc/free functions

2016-05-13 Thread Stephen Hurd
More HWRM calls.

Signed-off-by: Stephen Hurd 
Reviewed-by: Ajit Kumar Khaparde 
---
 drivers/net/bnxt/bnxt_hwrm.c   |  38 
 drivers/net/bnxt/bnxt_hwrm.h   |   2 +
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 153 +
 3 files changed, 193 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 2a18cf3..4609862 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -544,6 +544,44 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct 
bnxt_vnic_info *vnic)
return rc;
 }

+int bnxt_hwrm_vnic_ctx_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+{
+   int rc = 0;
+   struct hwrm_vnic_rss_cos_lb_ctx_alloc_input req = {.req_type = 0 };
+   struct hwrm_vnic_rss_cos_lb_ctx_alloc_output *resp =
+   bp->hwrm_cmd_resp_addr;
+
+   HWRM_PREP(req, VNIC_RSS_COS_LB_CTX_ALLOC, -1, resp);
+
+   rc = bnxt_hwrm_send_message(bp, , sizeof(req));
+
+   HWRM_CHECK_RESULT;
+
+   vnic->fw_rss_cos_lb_ctx = rte_le_to_cpu_16(resp->rss_cos_lb_ctx_id);
+
+   return rc;
+}
+
+int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+{
+   int rc = 0;
+   struct hwrm_vnic_rss_cos_lb_ctx_free_input req = {.req_type = 0 };
+   struct hwrm_vnic_rss_cos_lb_ctx_free_output *resp =
+   bp->hwrm_cmd_resp_addr;
+
+   HWRM_PREP(req, VNIC_RSS_COS_LB_CTX_FREE, -1, resp);
+
+   req.rss_cos_lb_ctx_id = rte_cpu_to_le_16(vnic->fw_rss_cos_lb_ctx);
+
+   rc = bnxt_hwrm_send_message(bp, , sizeof(req));
+
+   HWRM_CHECK_RESULT;
+
+   vnic->fw_rss_cos_lb_ctx = INVALID_HW_RING_ID;
+
+   return rc;
+}
+
 int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
int rc = 0;
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index b5cf090..b7f6b20 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -61,6 +61,8 @@ int bnxt_hwrm_ver_get(struct bnxt *bp);

 int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_vnic_ctx_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic);

 int bnxt_clear_all_hwrm_stat_ctxs(struct bnxt *bp);
diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h 
b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index b74f9f9..34f66c5 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -92,6 +92,8 @@ typedef struct ctx_hw_stats64 {
 #define HWRM_VNIC_ALLOC(UINT32_C(0x40))
 #define HWRM_VNIC_FREE (UINT32_C(0x41))
 #define HWRM_VNIC_CFG  (UINT32_C(0x42))
+#define HWRM_VNIC_RSS_COS_LB_CTX_ALLOC (UINT32_C(0x70))
+#define HWRM_VNIC_RSS_COS_LB_CTX_FREE  (UINT32_C(0x71))
 #define HWRM_CFA_L2_FILTER_ALLOC   (UINT32_C(0x90))
 #define HWRM_CFA_L2_FILTER_FREE(UINT32_C(0x91))
 #define HWRM_CFA_L2_FILTER_CFG (UINT32_C(0x92))
@@ -3625,6 +3627,157 @@ struct hwrm_vnic_rss_cfg_output {
uint8_t valid;
 } __attribute__((packed));

+/* Input (16 bytes) */
+struct hwrm_vnic_rss_cos_lb_ctx_alloc_input {
+   /*
+* This value indicates what type of request this is. The format for the
+* rest of the command is determined by this field.
+*/
+   uint16_t req_type;
+
+   /*
+* This value indicates the what completion ring the request will be
+* optionally completed on. If the value is -1, then no CR completion
+* will be generated. Any other value must be a valid CR ring_id value
+* for this function.
+*/
+   uint16_t cmpl_ring;
+
+   /* This value indicates the command sequence number. */
+   uint16_t seq_id;
+
+   /*
+* Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
+* 0xFFF8 - 0xFFFE - Reserved for internal processors 0x - HWRM
+*/
+   uint16_t target_id;
+
+   /*
+* This is the host address where the response will be written when the
+* request is complete. This area must be 16B aligned and must be
+* cleared to zero before the request is made.
+*/
+   uint64_t resp_addr;
+} __attribute__((packed));
+
+/* Output (16 bytes) */
+
+struct hwrm_vnic_rss_cos_lb_ctx_alloc_output {
+   /*
+* Pass/Fail or error type Note: receiver to verify the in parameters,
+* and fail the call with an error when appropriate
+*/
+   uint16_t error_code;
+
+   /* This field returns the type of original request. */
+   uint16_t req_type;
+
+   /* This field provides original sequence number of the command. */
+   uint16_t seq_id;
+
+