#define HWRM_UNLOCK() rte_spinlock_unlock(&bp->hwrm_lock)
+int bnxt_hwrm_tf_message_direct(struct bnxt *bp,
+ bool use_kong_mb,
+ uint16_t msg_type,
+ void *msg,
+ uint32_t msg_len,
+ void *resp_msg,
+ uint32_t resp_len)
+{
+ int rc = 0;
+ bool mailbox = BNXT_USE_CHIMP_MB;
+ struct input *req = msg;
+ struct output *resp = bp->hwrm_cmd_resp_addr;
+
+ if (use_kong_mb)
+ mailbox = BNXT_USE_KONG(bp);
+
+ HWRM_PREP(req, msg_type, mailbox);
+
+ rc = bnxt_hwrm_send_message(bp, req, msg_len, mailbox);
+
+ HWRM_CHECK_RESULT();
+
+ if (resp_msg)
+ memcpy(resp_msg, resp, resp_len);
+
+ HWRM_UNLOCK();
+
+ return rc;
+}
+
+int bnxt_hwrm_tf_message_tunneled(struct bnxt *bp,
+ bool use_kong_mb,
+ uint16_t tf_type,
+ uint16_t tf_subtype,
+ uint32_t *tf_response_code,
+ void *msg,
+ uint32_t msg_len,
+ void *response,
+ uint32_t response_len)
+{
+ int rc = 0;
+ struct hwrm_cfa_tflib_input req = { .req_type = 0 };
+ struct hwrm_cfa_tflib_output *resp = bp->hwrm_cmd_resp_addr;
+ bool mailbox = BNXT_USE_CHIMP_MB;
+
+ if (msg_len > sizeof(req.tf_req))
+ return -ENOMEM;
+
+ if (use_kong_mb)
+ mailbox = BNXT_USE_KONG(bp);
+
+ HWRM_PREP(&req, HWRM_TF, mailbox);
+ /* Build request using the user supplied request payload.
+ * TLV request size is checked at build time against HWRM
+ * request max size, thus no checking required.
+ */
+ req.tf_type = tf_type;
+ req.tf_subtype = tf_subtype;
+ memcpy(req.tf_req, msg, msg_len);
+
+ rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), mailbox);
+ HWRM_CHECK_RESULT();
+
+ /* Copy the resp to user provided response buffer */
+ if (response != NULL)
+ /* Post process response data. We need to copy only
+ * the 'payload' as the HWRM data structure really is
+ * HWRM header + msg header + payload and the TFLIB
+ * only provided a payload place holder.
+ */
+ if (response_len != 0) {
+ memcpy(response,
+ resp->tf_resp,
+ response_len);
+ }
+
+ /* Extract the internal tflib response code */
+ *tf_response_code = resp->tf_resp_code;
+ HWRM_UNLOCK();
+
+ return rc;
+}
+
int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic)
{
int rc = 0;
}
int bnxt_hwrm_func_qstats(struct bnxt *bp, uint16_t fid,
- struct rte_eth_stats *stats)
+ struct rte_eth_stats *stats,
+ struct hwrm_func_qstats_output *func_qstats)
{
int rc = 0;
struct hwrm_func_qstats_input req = {.req_type = 0};
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
HWRM_CHECK_RESULT();
+ if (func_qstats)
+ memcpy(func_qstats, resp,
+ sizeof(struct hwrm_func_qstats_output));
+
+ if (!stats)
+ goto exit;
stats->ipackets = rte_le_to_cpu_64(resp->rx_ucast_pkts);
stats->ipackets += rte_le_to_cpu_64(resp->rx_mcast_pkts);
stats->ierrors = rte_le_to_cpu_64(resp->rx_drop_pkts);
stats->oerrors = rte_le_to_cpu_64(resp->tx_discard_pkts);
+exit:
HWRM_UNLOCK();
return rc;
struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
uint16_t flags;
int rc = 0;
+ bp->func_svif = BNXT_SVIF_INVALID;
+ uint16_t svif_info;
HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB);
req.fid = rte_cpu_to_le_16(0xffff);
/* Hard Coded.. 0xfff VLAN ID mask */
bp->vlan = rte_le_to_cpu_16(resp->vlan) & 0xfff;
+
+ svif_info = rte_le_to_cpu_16(resp->svif_info);
+ if (svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_VALID)
+ bp->func_svif = svif_info &
+ HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_MASK;
+
flags = rte_le_to_cpu_16(resp->flags);
if (BNXT_PF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST))
bp->flags |= BNXT_FLAG_MULTI_HOST;
return rc;
}
+int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp)
+{
+ struct hwrm_port_mac_qcfg_input req = {0};
+ struct hwrm_port_mac_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+ uint16_t port_svif_info;
+ int rc;
+
+ bp->port_svif = BNXT_SVIF_INVALID;
+
+ HWRM_PREP(&req, HWRM_PORT_MAC_QCFG, BNXT_USE_CHIMP_MB);
+
+ rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+
+ HWRM_CHECK_RESULT();
+
+ port_svif_info = rte_le_to_cpu_16(resp->port_svif_info);
+ if (port_svif_info &
+ HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_VALID)
+ bp->port_svif = port_svif_info &
+ HWRM_PORT_MAC_QCFG_OUTPUT_PORT_SVIF_INFO_PORT_SVIF_MASK;
+
+ HWRM_UNLOCK();
+
+ return 0;
+}
+
static void copy_func_cfg_to_qcaps(struct hwrm_func_cfg_input *fcfg,
struct hwrm_func_qcaps_output *qcaps)
{