/**
* Structure to store private data for each VF representor instance
*/
-struct bnxt_vf_representor {
+struct bnxt_representor {
uint16_t switch_domain_id;
uint16_t vf_id;
+#define BNXT_REP_IS_PF BIT(0)
+#define BNXT_REP_Q_R2F_VALID BIT(1)
+#define BNXT_REP_Q_F2R_VALID BIT(2)
+#define BNXT_REP_FC_R2F_VALID BIT(3)
+#define BNXT_REP_FC_F2R_VALID BIT(4)
+ uint32_t flags;
uint16_t fw_fid;
#define BNXT_DFLT_VNIC_ID_INVALID 0xFFFF
uint16_t dflt_vnic_id;
uint16_t svif;
uint16_t vfr_tx_cfa_action;
uint32_t dpdk_port_id;
+ uint32_t rep_based_pf;
+ uint8_t rep_q_r2f;
+ uint8_t rep_q_f2r;
+ uint8_t rep_fc_r2f;
+ uint8_t rep_fc_f2r;
/* Private data store of associated PF/Trusted VF */
struct rte_eth_dev *parent_dev;
uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
uint64_t rx_drop_bytes[BNXT_MAX_VF_REP_RINGS];
};
+#define BNXT_REP_PF(vfr_bp) ((vfr_bp)->flags & BNXT_REP_IS_PF)
+
struct bnxt_vf_rep_tx_queue {
struct bnxt_tx_queue *txq;
- struct bnxt_vf_representor *bp;
+ struct bnxt_representor *bp;
};
int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
int32_t
bnxt_ulp_create_vfr_default_rules(struct rte_eth_dev *vfr_ethdev);
int32_t
-bnxt_ulp_delete_vfr_default_rules(struct bnxt_vf_representor *vfr);
+bnxt_ulp_delete_vfr_default_rules(struct bnxt_representor *vfr);
uint16_t bnxt_get_vnic_id(uint16_t port, enum bnxt_ulp_intf_type type);
uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif,
enum bnxt_ulp_intf_type type);
uint16_t bnxt_get_vport(uint16_t port);
enum bnxt_ulp_intf_type
bnxt_get_interface_type(uint16_t port);
-int bnxt_vf_rep_dev_start_op(struct rte_eth_dev *eth_dev);
+int bnxt_rep_dev_start_op(struct rte_eth_dev *eth_dev);
void bnxt_cancel_fc_thread(struct bnxt *bp);
void bnxt_flow_cnt_alarm_cb(void *arg);
struct hwrm_async_event_cmpl *async_cmp)
{
uint16_t fid, vnic_state, parent_id, vf_fid, vf_id;
- struct bnxt_vf_representor *vf_rep_bp;
+ struct bnxt_representor *vf_rep_bp;
struct rte_eth_dev *eth_dev;
bool vfr_found = false;
uint32_t event_data;
if (!vfr_found)
return;
- bnxt_vf_rep_dev_start_op(eth_dev);
+ bnxt_rep_dev_start_op(eth_dev);
}
/*
#define BNXT_DEVARG_FLOW_XSTAT "flow-xstat"
#define BNXT_DEVARG_MAX_NUM_KFLOWS "max-num-kflows"
#define BNXT_DEVARG_REPRESENTOR "representor"
+#define BNXT_DEVARG_REP_BASED_PF "rep-based-pf"
+#define BNXT_DEVARG_REP_IS_PF "rep-is-pf"
+#define BNXT_DEVARG_REP_Q_R2F "rep-q-r2f"
+#define BNXT_DEVARG_REP_Q_F2R "rep-q-f2r"
+#define BNXT_DEVARG_REP_FC_R2F "rep-fc-r2f"
+#define BNXT_DEVARG_REP_FC_F2R "rep-fc-f2r"
static const char *const bnxt_dev_args[] = {
BNXT_DEVARG_REPRESENTOR,
BNXT_DEVARG_TRUFLOW,
BNXT_DEVARG_FLOW_XSTAT,
BNXT_DEVARG_MAX_NUM_KFLOWS,
+ BNXT_DEVARG_REP_BASED_PF,
+ BNXT_DEVARG_REP_IS_PF,
+ BNXT_DEVARG_REP_Q_R2F,
+ BNXT_DEVARG_REP_Q_F2R,
+ BNXT_DEVARG_REP_FC_R2F,
+ BNXT_DEVARG_REP_FC_F2R,
NULL
};
*/
#define BNXT_DEVARG_FLOW_XSTAT_INVALID(flow_xstat) ((flow_xstat) > 1)
+/*
+ * rep_is_pf == false to indicate VF representor
+ * rep_is_pf == true to indicate PF representor
+ */
+#define BNXT_DEVARG_REP_IS_PF_INVALID(rep_is_pf) ((rep_is_pf) > 1)
+
+/*
+ * rep_based_pf == Physical index of the PF
+ */
+#define BNXT_DEVARG_REP_BASED_PF_INVALID(rep_based_pf) ((rep_based_pf) > 15)
+/*
+ * rep_q_r2f == Logical COS Queue index for the rep to endpoint direction
+ */
+#define BNXT_DEVARG_REP_Q_R2F_INVALID(rep_q_r2f) ((rep_q_r2f) > 3)
+
+/*
+ * rep_q_f2r == Logical COS Queue index for the endpoint to rep direction
+ */
+#define BNXT_DEVARG_REP_Q_F2R_INVALID(rep_q_f2r) ((rep_q_f2r) > 3)
+
+/*
+ * rep_fc_r2f == Flow control for the representor to endpoint direction
+ */
+#define BNXT_DEVARG_REP_FC_R2F_INVALID(rep_fc_r2f) ((rep_fc_r2f) > 1)
+
+/*
+ * rep_fc_f2r == Flow control for the endpoint to representor direction
+ */
+#define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1)
+
/*
* max_num_kflows must be >= 32
* and must be a power-of-2 supported value
rte_intr_disable(intr_handle);
/* Stop the child representors for this device */
- bnxt_vf_rep_stop_all(bp);
+ bnxt_rep_stop_all(bp);
/* delete the bnxt ULP port details */
bnxt_ulp_port_deinit(bp);
return -EIO;
if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
- struct bnxt_vf_representor *vfr = dev->data->dev_private;
+ struct bnxt_representor *vfr = dev->data->dev_private;
bp = vfr->parent_dev->data->dev_private;
/* parent is deleted while children are still valid */
if (!bp) {
eth_dev = &rte_eth_devices[port_id];
if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
- struct bnxt_vf_representor *vfr = eth_dev->data->dev_private;
+ struct bnxt_representor *vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
eth_dev = &rte_eth_devices[port];
if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
- struct bnxt_vf_representor *vfr = eth_dev->data->dev_private;
+ struct bnxt_representor *vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
eth_dev = &rte_eth_devices[port];
if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
- struct bnxt_vf_representor *vfr = eth_dev->data->dev_private;
+ struct bnxt_representor *vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
uint16_t
bnxt_get_phy_port_id(uint16_t port_id)
{
- struct bnxt_vf_representor *vfr;
+ struct bnxt_representor *vfr;
struct rte_eth_dev *eth_dev;
struct bnxt *bp;
eth_dev = &rte_eth_devices[port_id];
if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
- struct bnxt_vf_representor *vfr = eth_dev->data->dev_private;
+ struct bnxt_representor *vfr = eth_dev->data->dev_private;
if (!vfr)
return 0;
return 0;
}
+static int
+bnxt_parse_devarg_rep_is_pf(__rte_unused const char *key,
+ const char *value, void *opaque_arg)
+{
+ struct bnxt_representor *vfr_bp = opaque_arg;
+ unsigned long rep_is_pf;
+ char *end = NULL;
+
+ if (!value || !opaque_arg) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_is_pf devargs.\n");
+ return -EINVAL;
+ }
+
+ rep_is_pf = strtoul(value, &end, 10);
+ if (end == NULL || *end != '\0' ||
+ (rep_is_pf == ULONG_MAX && errno == ERANGE)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_is_pf devargs.\n");
+ return -EINVAL;
+ }
+
+ if (BNXT_DEVARG_REP_IS_PF_INVALID(rep_is_pf)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid value passed to rep_is_pf devargs.\n");
+ return -EINVAL;
+ }
+
+ vfr_bp->flags |= rep_is_pf;
+ if (BNXT_REP_PF(vfr_bp))
+ PMD_DRV_LOG(INFO, "PF representor\n");
+ else
+ PMD_DRV_LOG(INFO, "VF representor\n");
+
+ return 0;
+}
+
+static int
+bnxt_parse_devarg_rep_based_pf(__rte_unused const char *key,
+ const char *value, void *opaque_arg)
+{
+ struct bnxt_representor *vfr_bp = opaque_arg;
+ unsigned long rep_based_pf;
+ char *end = NULL;
+
+ if (!value || !opaque_arg) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_based_pf "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ rep_based_pf = strtoul(value, &end, 10);
+ if (end == NULL || *end != '\0' ||
+ (rep_based_pf == ULONG_MAX && errno == ERANGE)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_based_pf "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ if (BNXT_DEVARG_REP_BASED_PF_INVALID(rep_based_pf)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid value passed to rep_based_pf devargs.\n");
+ return -EINVAL;
+ }
+
+ vfr_bp->rep_based_pf = rep_based_pf;
+ PMD_DRV_LOG(INFO, "rep-based-pf = %d\n", vfr_bp->rep_based_pf);
+
+ return 0;
+}
+
+static int
+bnxt_parse_devarg_rep_q_r2f(__rte_unused const char *key,
+ const char *value, void *opaque_arg)
+{
+ struct bnxt_representor *vfr_bp = opaque_arg;
+ unsigned long rep_q_r2f;
+ char *end = NULL;
+
+ if (!value || !opaque_arg) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_q_r2f "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ rep_q_r2f = strtoul(value, &end, 10);
+ if (end == NULL || *end != '\0' ||
+ (rep_q_r2f == ULONG_MAX && errno == ERANGE)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_q_r2f "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ if (BNXT_DEVARG_REP_Q_R2F_INVALID(rep_q_r2f)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid value passed to rep_q_r2f devargs.\n");
+ return -EINVAL;
+ }
+
+ vfr_bp->rep_q_r2f = rep_q_r2f;
+ vfr_bp->flags |= BNXT_REP_Q_R2F_VALID;
+ PMD_DRV_LOG(INFO, "rep-q-r2f = %d\n", vfr_bp->rep_q_r2f);
+
+ return 0;
+}
+
+static int
+bnxt_parse_devarg_rep_q_f2r(__rte_unused const char *key,
+ const char *value, void *opaque_arg)
+{
+ struct bnxt_representor *vfr_bp = opaque_arg;
+ unsigned long rep_q_f2r;
+ char *end = NULL;
+
+ if (!value || !opaque_arg) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_q_f2r "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ rep_q_f2r = strtoul(value, &end, 10);
+ if (end == NULL || *end != '\0' ||
+ (rep_q_f2r == ULONG_MAX && errno == ERANGE)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_q_f2r "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ if (BNXT_DEVARG_REP_Q_F2R_INVALID(rep_q_f2r)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid value passed to rep_q_f2r devargs.\n");
+ return -EINVAL;
+ }
+
+ vfr_bp->rep_q_f2r = rep_q_f2r;
+ vfr_bp->flags |= BNXT_REP_Q_F2R_VALID;
+ PMD_DRV_LOG(INFO, "rep-q-f2r = %d\n", vfr_bp->rep_q_f2r);
+
+ return 0;
+}
+
+static int
+bnxt_parse_devarg_rep_fc_r2f(__rte_unused const char *key,
+ const char *value, void *opaque_arg)
+{
+ struct bnxt_representor *vfr_bp = opaque_arg;
+ unsigned long rep_fc_r2f;
+ char *end = NULL;
+
+ if (!value || !opaque_arg) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_fc_r2f "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ rep_fc_r2f = strtoul(value, &end, 10);
+ if (end == NULL || *end != '\0' ||
+ (rep_fc_r2f == ULONG_MAX && errno == ERANGE)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_fc_r2f "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ if (BNXT_DEVARG_REP_FC_R2F_INVALID(rep_fc_r2f)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid value passed to rep_fc_r2f devargs.\n");
+ return -EINVAL;
+ }
+
+ vfr_bp->flags |= BNXT_REP_FC_R2F_VALID;
+ vfr_bp->rep_fc_r2f = rep_fc_r2f;
+ PMD_DRV_LOG(INFO, "rep-fc-r2f = %lu\n", rep_fc_r2f);
+
+ return 0;
+}
+
+static int
+bnxt_parse_devarg_rep_fc_f2r(__rte_unused const char *key,
+ const char *value, void *opaque_arg)
+{
+ struct bnxt_representor *vfr_bp = opaque_arg;
+ unsigned long rep_fc_f2r;
+ char *end = NULL;
+
+ if (!value || !opaque_arg) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_fc_f2r "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ rep_fc_f2r = strtoul(value, &end, 10);
+ if (end == NULL || *end != '\0' ||
+ (rep_fc_f2r == ULONG_MAX && errno == ERANGE)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid parameter passed to rep_fc_f2r "
+ "devargs.\n");
+ return -EINVAL;
+ }
+
+ if (BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r)) {
+ PMD_DRV_LOG(ERR,
+ "Invalid value passed to rep_fc_f2r devargs.\n");
+ return -EINVAL;
+ }
+
+ vfr_bp->flags |= BNXT_REP_FC_F2R_VALID;
+ vfr_bp->rep_fc_f2r = rep_fc_f2r;
+ PMD_DRV_LOG(INFO, "rep-fc-f2r = %lu\n", rep_fc_f2r);
+
+ return 0;
+}
+
static void
bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs)
{
continue;
PMD_DRV_LOG(DEBUG, "BNXT Port:%d VFR pci remove\n",
vf_rep_eth_dev->data->port_id);
- rte_eth_dev_destroy(vf_rep_eth_dev, bnxt_vf_representor_uninit);
+ rte_eth_dev_destroy(vf_rep_eth_dev, bnxt_representor_uninit);
}
PMD_DRV_LOG(DEBUG, "BNXT Port:%d pci remove\n",
eth_dev->data->port_id);
static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,
struct rte_eth_devargs eth_da,
- struct rte_eth_dev *backing_eth_dev)
+ struct rte_eth_dev *backing_eth_dev,
+ const char *dev_args)
{
struct rte_eth_dev *vf_rep_eth_dev;
char name[RTE_ETH_NAME_MAX_LEN];
struct bnxt *backing_bp;
uint16_t num_rep;
int i, ret = 0;
+ struct rte_kvargs *kvlist;
num_rep = eth_da.nb_representor_ports;
if (num_rep > BNXT_MAX_VF_REPS) {
return 0;
for (i = 0; i < num_rep; i++) {
- struct bnxt_vf_representor representor = {
+ struct bnxt_representor representor = {
.vf_id = eth_da.representor_ports[i],
.switch_domain_id = backing_bp->switch_domain_id,
.parent_dev = backing_eth_dev
snprintf(name, sizeof(name), "net_%s_representor_%d",
pci_dev->device.name, eth_da.representor_ports[i]);
+ kvlist = rte_kvargs_parse(dev_args, bnxt_dev_args);
+ if (kvlist) {
+ /*
+ * Handler for "rep_is_pf" devarg.
+ * Invoked as for ex: "-w 000:00:0d.0,
+ * rep-based-pf=<pf index> rep-is-pf=<VF=0 or PF=1>"
+ */
+ rte_kvargs_process(kvlist, BNXT_DEVARG_REP_IS_PF,
+ bnxt_parse_devarg_rep_is_pf,
+ (void *)&representor);
+ /*
+ * Handler for "rep_based_pf" devarg.
+ * Invoked as for ex: "-w 000:00:0d.0,
+ * rep-based-pf=<pf index> rep-is-pf=<VF=0 or PF=1>"
+ */
+ rte_kvargs_process(kvlist, BNXT_DEVARG_REP_BASED_PF,
+ bnxt_parse_devarg_rep_based_pf,
+ (void *)&representor);
+ /*
+ * Handler for "rep_based_pf" devarg.
+ * Invoked as for ex: "-w 000:00:0d.0,
+ * rep-based-pf=<pf index> rep-is-pf=<VF=0 or PF=1>"
+ */
+ rte_kvargs_process(kvlist, BNXT_DEVARG_REP_Q_R2F,
+ bnxt_parse_devarg_rep_q_r2f,
+ (void *)&representor);
+ /*
+ * Handler for "rep_based_pf" devarg.
+ * Invoked as for ex: "-w 000:00:0d.0,
+ * rep-based-pf=<pf index> rep-is-pf=<VF=0 or PF=1>"
+ */
+ rte_kvargs_process(kvlist, BNXT_DEVARG_REP_Q_F2R,
+ bnxt_parse_devarg_rep_q_f2r,
+ (void *)&representor);
+ /*
+ * Handler for "rep_based_pf" devarg.
+ * Invoked as for ex: "-w 000:00:0d.0,
+ * rep-based-pf=<pf index> rep-is-pf=<VF=0 or PF=1>"
+ */
+ rte_kvargs_process(kvlist, BNXT_DEVARG_REP_FC_R2F,
+ bnxt_parse_devarg_rep_fc_r2f,
+ (void *)&representor);
+ /*
+ * Handler for "rep_based_pf" devarg.
+ * Invoked as for ex: "-w 000:00:0d.0,
+ * rep-based-pf=<pf index> rep-is-pf=<VF=0 or PF=1>"
+ */
+ rte_kvargs_process(kvlist, BNXT_DEVARG_REP_FC_F2R,
+ bnxt_parse_devarg_rep_fc_f2r,
+ (void *)&representor);
+ }
+
ret = rte_eth_dev_create(&pci_dev->device, name,
- sizeof(struct bnxt_vf_representor),
+ sizeof(struct bnxt_representor),
NULL, NULL,
- bnxt_vf_representor_init,
+ bnxt_representor_init,
&representor);
if (ret) {
PMD_DRV_LOG(ERR, "failed to create bnxt vf "
}
PMD_DRV_LOG(DEBUG, "BNXT Port:%d VFR pci probe\n",
- backing_eth_dev->data->port_id);
+ backing_eth_dev->data->port_id);
backing_bp->rep_info[representor.vf_id].vfr_eth_dev =
vf_rep_eth_dev;
backing_bp->num_reps++;
+
}
return 0;
PMD_DRV_LOG(DEBUG, "BNXT Port:%d pci probe\n",
backing_eth_dev->data->port_id);
/* probe representor ports now */
- ret = bnxt_rep_port_probe(pci_dev, eth_da, backing_eth_dev);
+ ret = bnxt_rep_port_probe(pci_dev, eth_da, backing_eth_dev,
+ pci_dev->device.devargs->args);
return ret;
}
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
return rte_eth_dev_destroy(eth_dev,
- bnxt_vf_representor_uninit);
+ bnxt_representor_uninit);
else
return rte_eth_dev_destroy(eth_dev,
bnxt_dev_uninit);
PMD_DRV_LOG(DEBUG, "VFR %d freed\n", vf_idx);
return rc;
}
+
+int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
+ uint16_t *first_vf_id)
+{
+ int rc = 0;
+ struct hwrm_func_qcaps_input req = {.req_type = 0 };
+ struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr;
+
+ HWRM_PREP(&req, HWRM_FUNC_QCAPS, BNXT_USE_CHIMP_MB);
+
+ req.fid = rte_cpu_to_le_16(fid);
+
+ rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+
+ HWRM_CHECK_RESULT();
+
+ if (first_vf_id)
+ *first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
+
+ HWRM_UNLOCK();
+
+ return rc;
+}
+
+int bnxt_hwrm_cfa_pair_alloc(struct bnxt *bp, struct bnxt_representor *rep_bp)
+{
+ struct hwrm_cfa_pair_alloc_output *resp = bp->hwrm_cmd_resp_addr;
+ struct hwrm_cfa_pair_alloc_input req = {0};
+ int rc;
+
+ if (!(BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))) {
+ PMD_DRV_LOG(DEBUG,
+ "Not a PF or trusted VF. Command not supported\n");
+ return 0;
+ }
+
+ HWRM_PREP(&req, HWRM_CFA_PAIR_ALLOC, BNXT_USE_CHIMP_MB);
+ req.pair_mode = HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2FN_TRUFLOW;
+ snprintf(req.pair_name, sizeof(req.pair_name), "%svfr%d",
+ bp->eth_dev->data->name, rep_bp->vf_id);
+
+ req.pf_b_id = rte_cpu_to_le_32(rep_bp->rep_based_pf);
+ req.vf_b_id = rte_cpu_to_le_16(rep_bp->vf_id);
+ req.vf_a_id = rte_cpu_to_le_16(bp->fw_fid);
+ req.host_b_id = 1; /* TBD - Confirm if this is OK */
+
+ req.enables |= rep_bp->flags & BNXT_REP_Q_R2F_VALID ?
+ HWRM_CFA_PAIR_ALLOC_INPUT_ENABLES_Q_AB_VALID : 0;
+ req.enables |= rep_bp->flags & BNXT_REP_Q_F2R_VALID ?
+ HWRM_CFA_PAIR_ALLOC_INPUT_ENABLES_Q_BA_VALID : 0;
+ req.enables |= rep_bp->flags & BNXT_REP_FC_R2F_VALID ?
+ HWRM_CFA_PAIR_ALLOC_INPUT_ENABLES_FC_AB_VALID : 0;
+ req.enables |= rep_bp->flags & BNXT_REP_FC_F2R_VALID ?
+ HWRM_CFA_PAIR_ALLOC_INPUT_ENABLES_FC_BA_VALID : 0;
+
+ req.q_ab = rep_bp->rep_q_r2f;
+ req.q_ba = rep_bp->rep_q_f2r;
+ req.fc_ab = rep_bp->rep_fc_r2f;
+ req.fc_ba = rep_bp->rep_fc_f2r;
+
+ rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+ HWRM_CHECK_RESULT();
+
+ HWRM_UNLOCK();
+ PMD_DRV_LOG(DEBUG, "%s %d allocated\n",
+ BNXT_REP_PF(rep_bp) ? "PFR" : "VFR", rep_bp->vf_id);
+ return rc;
+}
+
+int bnxt_hwrm_cfa_pair_free(struct bnxt *bp, struct bnxt_representor *rep_bp)
+{
+ struct hwrm_cfa_pair_free_output *resp = bp->hwrm_cmd_resp_addr;
+ struct hwrm_cfa_pair_free_input req = {0};
+ int rc;
+
+ if (!(BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))) {
+ PMD_DRV_LOG(DEBUG,
+ "Not a PF or trusted VF. Command not supported\n");
+ return 0;
+ }
+
+ HWRM_PREP(&req, HWRM_CFA_PAIR_FREE, BNXT_USE_CHIMP_MB);
+ snprintf(req.pair_name, sizeof(req.pair_name), "%svfr%d",
+ bp->eth_dev->data->name, rep_bp->vf_id);
+ req.pf_b_id = rte_cpu_to_le_32(rep_bp->rep_based_pf);
+ req.vf_id = rte_cpu_to_le_16(rep_bp->vf_id);
+ req.pair_mode = HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2FN_TRUFLOW;
+
+ rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+ HWRM_CHECK_RESULT();
+ HWRM_UNLOCK();
+ PMD_DRV_LOG(DEBUG, "%s %d freed\n", BNXT_REP_PF(rep_bp) ? "PFR" : "VFR",
+ rep_bp->vf_id);
+ return rc;
+}
int bnxt_hwrm_cfa_vfr_alloc(struct bnxt *bp, uint16_t vf_idx);
int bnxt_hwrm_cfa_vfr_free(struct bnxt *bp, uint16_t vf_idx);
void bnxt_hwrm_free_vf_info(struct bnxt *bp);
+int bnxt_hwrm_first_vf_id_query(struct bnxt *bp, uint16_t fid,
+ uint16_t *first_vf_id);
+int bnxt_hwrm_cfa_pair_alloc(struct bnxt *bp, struct bnxt_representor *rep);
+int bnxt_hwrm_cfa_pair_free(struct bnxt *bp, struct bnxt_representor *rep);
#endif
#include "ulp_port_db.h"
#include "ulp_flow_db.h"
-static const struct eth_dev_ops bnxt_vf_rep_dev_ops = {
- .dev_infos_get = bnxt_vf_rep_dev_info_get_op,
- .dev_configure = bnxt_vf_rep_dev_configure_op,
- .dev_start = bnxt_vf_rep_dev_start_op,
- .rx_queue_setup = bnxt_vf_rep_rx_queue_setup_op,
- .rx_queue_release = bnxt_vf_rep_rx_queue_release_op,
- .tx_queue_setup = bnxt_vf_rep_tx_queue_setup_op,
- .tx_queue_release = bnxt_vf_rep_tx_queue_release_op,
- .link_update = bnxt_vf_rep_link_update_op,
- .dev_close = bnxt_vf_rep_dev_close_op,
- .dev_stop = bnxt_vf_rep_dev_stop_op,
- .stats_get = bnxt_vf_rep_stats_get_op,
- .stats_reset = bnxt_vf_rep_stats_reset_op,
+static const struct eth_dev_ops bnxt_rep_dev_ops = {
+ .dev_infos_get = bnxt_rep_dev_info_get_op,
+ .dev_configure = bnxt_rep_dev_configure_op,
+ .dev_start = bnxt_rep_dev_start_op,
+ .rx_queue_setup = bnxt_rep_rx_queue_setup_op,
+ .rx_queue_release = bnxt_rep_rx_queue_release_op,
+ .tx_queue_setup = bnxt_rep_tx_queue_setup_op,
+ .tx_queue_release = bnxt_rep_tx_queue_release_op,
+ .link_update = bnxt_rep_link_update_op,
+ .dev_close = bnxt_rep_dev_close_op,
+ .dev_stop = bnxt_rep_dev_stop_op,
+ .stats_get = bnxt_rep_stats_get_op,
+ .stats_reset = bnxt_rep_stats_reset_op,
.filter_ctrl = bnxt_filter_ctrl_op
};
struct bnxt_rx_ring_info *rep_rxr;
struct bnxt_rx_queue *rep_rxq;
struct rte_eth_dev *vfr_eth_dev;
- struct bnxt_vf_representor *vfr_bp;
+ struct bnxt_representor *vfr_bp;
uint16_t mask;
uint8_t que;
}
static uint16_t
-bnxt_vf_rep_rx_burst(void *rx_queue,
+bnxt_rep_rx_burst(void *rx_queue,
struct rte_mbuf **rx_pkts,
uint16_t nb_pkts)
{
}
static uint16_t
-bnxt_vf_rep_tx_burst(void *tx_queue,
+bnxt_rep_tx_burst(void *tx_queue,
struct rte_mbuf **tx_pkts,
__rte_unused uint16_t nb_pkts)
{
struct bnxt_vf_rep_tx_queue *vfr_txq = tx_queue;
struct bnxt_tx_queue *ptxq;
struct bnxt *parent;
- struct bnxt_vf_representor *vf_rep_bp;
+ struct bnxt_representor *vf_rep_bp;
int qid;
int rc;
int i;
}
static int
-bnxt_get_dflt_vnic_svif(struct bnxt *bp, struct bnxt_vf_representor *vf_rep_bp)
+bnxt_get_dflt_vnic_svif(struct bnxt *bp, struct bnxt_representor *vf_rep_bp)
{
struct bnxt_rep_info *rep_info;
int rc;
return rc;
}
-int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params)
+int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params)
{
- struct bnxt_vf_representor *vf_rep_bp = eth_dev->data->dev_private;
- struct bnxt_vf_representor *rep_params =
- (struct bnxt_vf_representor *)params;
+ struct bnxt_representor *vf_rep_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *rep_params =
+ (struct bnxt_representor *)params;
struct rte_eth_link *link;
struct bnxt *parent_bp;
+ uint16_t first_vf_id;
+ int rc = 0;
PMD_DRV_LOG(DEBUG, "BNXT Port:%d VFR init\n", eth_dev->data->port_id);
vf_rep_bp->vf_id = rep_params->vf_id;
vf_rep_bp->switch_domain_id = rep_params->switch_domain_id;
vf_rep_bp->parent_dev = rep_params->parent_dev;
+ vf_rep_bp->rep_based_pf = rep_params->rep_based_pf;
+ vf_rep_bp->flags = rep_params->flags;
+ vf_rep_bp->rep_q_r2f = rep_params->rep_q_r2f;
+ vf_rep_bp->rep_q_f2r = rep_params->rep_q_f2r;
+ vf_rep_bp->rep_fc_r2f = rep_params->rep_fc_r2f;
+ vf_rep_bp->rep_fc_f2r = rep_params->rep_fc_f2r;
eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;
eth_dev->data->representor_id = rep_params->vf_id;
sizeof(vf_rep_bp->mac_addr));
eth_dev->data->mac_addrs =
(struct rte_ether_addr *)&vf_rep_bp->mac_addr;
- eth_dev->dev_ops = &bnxt_vf_rep_dev_ops;
+ eth_dev->dev_ops = &bnxt_rep_dev_ops;
/* No data-path, but need stub Rx/Tx functions to avoid crash
* when testing with ovs-dpdk
*/
- eth_dev->rx_pkt_burst = bnxt_vf_rep_rx_burst;
- eth_dev->tx_pkt_burst = bnxt_vf_rep_tx_burst;
+ eth_dev->rx_pkt_burst = bnxt_rep_rx_burst;
+ eth_dev->tx_pkt_burst = bnxt_rep_tx_burst;
/* Link state. Inherited from PF or trusted VF */
parent_bp = vf_rep_bp->parent_dev->data->dev_private;
link = &parent_bp->eth_dev->data->dev_link;
"Switch domain id %d: Representor Device %d init done\n",
vf_rep_bp->switch_domain_id, vf_rep_bp->vf_id);
- vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
+ if (vf_rep_bp->rep_based_pf) {
+ vf_rep_bp->fw_fid = vf_rep_bp->rep_based_pf + 1;
+ if (!(BNXT_REP_PF(vf_rep_bp))) {
+ /* VF representor for the remote PF,get first_vf_id */
+ rc = bnxt_hwrm_first_vf_id_query(parent_bp,
+ vf_rep_bp->fw_fid,
+ &first_vf_id);
+ if (rc)
+ return rc;
+ if (first_vf_id == 0xffff) {
+ PMD_DRV_LOG(ERR,
+ "Invalid first_vf_id fid:%x\n",
+ vf_rep_bp->fw_fid);
+ return -EINVAL;
+ }
+ PMD_DRV_LOG(INFO, "first_vf_id = %x parent_fid:%x\n",
+ first_vf_id, vf_rep_bp->fw_fid);
+ vf_rep_bp->fw_fid = rep_params->vf_id + first_vf_id;
+ }
+ } else {
+ vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id;
+ }
+
PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid);
return 0;
}
-int bnxt_vf_representor_uninit(struct rte_eth_dev *eth_dev)
+int bnxt_representor_uninit(struct rte_eth_dev *eth_dev)
{
struct bnxt *parent_bp;
- struct bnxt_vf_representor *rep =
- (struct bnxt_vf_representor *)eth_dev->data->dev_private;
+ struct bnxt_representor *rep =
+ (struct bnxt_representor *)eth_dev->data->dev_private;
uint16_t vf_id;
PMD_DRV_LOG(DEBUG, "BNXT Port:%d VFR uninit\n", eth_dev->data->port_id);
return 0;
}
-int bnxt_vf_rep_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_compl)
+int bnxt_rep_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_compl)
{
struct bnxt *parent_bp;
- struct bnxt_vf_representor *rep =
- (struct bnxt_vf_representor *)eth_dev->data->dev_private;
+ struct bnxt_representor *rep =
+ (struct bnxt_representor *)eth_dev->data->dev_private;
struct rte_eth_link *link;
int rc;
static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
{
int rc;
- struct bnxt_vf_representor *vfr = vfr_ethdev->data->dev_private;
+ struct bnxt_representor *vfr = vfr_ethdev->data->dev_private;
struct rte_eth_dev *parent_dev = vfr->parent_dev;
struct bnxt *parent_bp = parent_dev->data->dev_private;
}
/* update the port id so you can backtrack to ethdev */
vfr->dpdk_port_id = vfr_ethdev->data->port_id;
- rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
+
+ if (BNXT_STINGRAY(parent_bp)) {
+ rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
+ } else {
+ rc = bnxt_hwrm_cfa_vfr_alloc(parent_bp, vfr->vf_id);
+ }
if (rc) {
BNXT_TF_DBG(ERR, "Failed in hwrm vfr alloc vfr:%u rc=%d\n",
vfr->vf_id, rc);
static int bnxt_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
{
int rc = 0;
- struct bnxt_vf_representor *vfr = vfr_ethdev->data->dev_private;
+ struct bnxt_representor *vfr = vfr_ethdev->data->dev_private;
struct bnxt *parent_bp;
if (!vfr || !vfr->parent_dev) {
return rc;
}
-static void bnxt_vf_rep_free_rx_mbufs(struct bnxt_vf_representor *rep_bp)
+static void bnxt_rep_free_rx_mbufs(struct bnxt_representor *rep_bp)
{
struct bnxt_rx_queue *rxq;
unsigned int i;
}
}
-int bnxt_vf_rep_dev_start_op(struct rte_eth_dev *eth_dev)
+int bnxt_rep_dev_start_op(struct rte_eth_dev *eth_dev)
{
- struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
struct bnxt_rep_info *rep_info;
struct bnxt *parent_bp;
int rc;
rc = bnxt_vfr_alloc(eth_dev);
if (rc) {
eth_dev->data->dev_link.link_status = 0;
- bnxt_vf_rep_free_rx_mbufs(rep_bp);
+ bnxt_rep_free_rx_mbufs(rep_bp);
return rc;
}
- eth_dev->rx_pkt_burst = &bnxt_vf_rep_rx_burst;
- eth_dev->tx_pkt_burst = &bnxt_vf_rep_tx_burst;
- bnxt_vf_rep_link_update_op(eth_dev, 1);
+ eth_dev->rx_pkt_burst = &bnxt_rep_rx_burst;
+ eth_dev->tx_pkt_burst = &bnxt_rep_tx_burst;
+ bnxt_rep_link_update_op(eth_dev, 1);
return 0;
}
-static int bnxt_tf_vfr_free(struct bnxt_vf_representor *vfr)
+static int bnxt_tf_vfr_free(struct bnxt_representor *vfr)
{
BNXT_TF_DBG(DEBUG, "BNXT Port:%d VFR ulp free\n", vfr->dpdk_port_id);
return bnxt_ulp_delete_vfr_default_rules(vfr);
}
-static int bnxt_vfr_free(struct bnxt_vf_representor *vfr)
+static int bnxt_vfr_free(struct bnxt_representor *vfr)
{
int rc = 0;
struct bnxt *parent_bp;
vfr->vf_id);
vfr->vfr_tx_cfa_action = 0;
- rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
+ if (BNXT_STINGRAY(parent_bp))
+ rc = bnxt_hwrm_cfa_pair_free(parent_bp, vfr);
+ else
+ rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
return rc;
}
-void bnxt_vf_rep_dev_stop_op(struct rte_eth_dev *eth_dev)
+void bnxt_rep_dev_stop_op(struct rte_eth_dev *eth_dev)
{
- struct bnxt_vf_representor *vfr_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *vfr_bp = eth_dev->data->dev_private;
/* Avoid crashes as we are about to free queues */
eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts;
if (eth_dev->data->dev_started)
eth_dev->data->dev_link.link_status = 0;
- bnxt_vf_rep_free_rx_mbufs(vfr_bp);
+ bnxt_rep_free_rx_mbufs(vfr_bp);
}
-void bnxt_vf_rep_dev_close_op(struct rte_eth_dev *eth_dev)
+void bnxt_rep_dev_close_op(struct rte_eth_dev *eth_dev)
{
BNXT_TF_DBG(DEBUG, "BNXT Port:%d VFR close\n", eth_dev->data->port_id);
- bnxt_vf_representor_uninit(eth_dev);
+ bnxt_representor_uninit(eth_dev);
}
-int bnxt_vf_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
+int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_dev_info *dev_info)
{
- struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
struct bnxt *parent_bp;
unsigned int max_rx_rings;
int rc = 0;
return 0;
}
-int bnxt_vf_rep_dev_configure_op(__rte_unused struct rte_eth_dev *eth_dev)
+int bnxt_rep_dev_configure_op(__rte_unused struct rte_eth_dev *eth_dev)
{
- struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
PMD_DRV_LOG(DEBUG, "Representor dev_configure_op\n");
rep_bp->rx_queues = (void *)eth_dev->data->rx_queues;
return 0;
}
-int bnxt_vf_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
- uint16_t queue_idx,
- uint16_t nb_desc,
- unsigned int socket_id,
- __rte_unused const struct rte_eth_rxconf *rx_conf,
- __rte_unused struct rte_mempool *mp)
+int bnxt_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
+ uint16_t queue_idx,
+ uint16_t nb_desc,
+ unsigned int socket_id,
+ __rte_unused const struct rte_eth_rxconf *rx_conf,
+ __rte_unused struct rte_mempool *mp)
{
- struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
struct bnxt *parent_bp = rep_bp->parent_dev->data->dev_private;
struct bnxt_rx_queue *parent_rxq;
struct bnxt_rx_queue *rxq;
out:
if (rxq)
- bnxt_vf_rep_rx_queue_release_op(rxq);
+ bnxt_rep_rx_queue_release_op(rxq);
return rc;
}
-void bnxt_vf_rep_rx_queue_release_op(void *rx_queue)
+void bnxt_rep_rx_queue_release_op(void *rx_queue)
{
struct bnxt_rx_queue *rxq = (struct bnxt_rx_queue *)rx_queue;
rte_free(rxq);
}
-int bnxt_vf_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
- uint16_t queue_idx,
- uint16_t nb_desc,
- unsigned int socket_id,
- __rte_unused const struct rte_eth_txconf *tx_conf)
+int bnxt_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
+ uint16_t queue_idx,
+ uint16_t nb_desc,
+ unsigned int socket_id,
+ __rte_unused const struct rte_eth_txconf *tx_conf)
{
- struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
struct bnxt *parent_bp = rep_bp->parent_dev->data->dev_private;
struct bnxt_tx_queue *parent_txq, *txq;
struct bnxt_vf_rep_tx_queue *vfr_txq;
if (eth_dev->data->tx_queues) {
vfr_txq = eth_dev->data->tx_queues[queue_idx];
- bnxt_vf_rep_tx_queue_release_op(vfr_txq);
+ bnxt_rep_tx_queue_release_op(vfr_txq);
vfr_txq = NULL;
}
return 0;
}
-void bnxt_vf_rep_tx_queue_release_op(void *tx_queue)
+void bnxt_rep_tx_queue_release_op(void *tx_queue)
{
struct bnxt_vf_rep_tx_queue *vfr_txq = tx_queue;
rte_free(vfr_txq);
}
-int bnxt_vf_rep_stats_get_op(struct rte_eth_dev *eth_dev,
+int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *stats)
{
- struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
int i;
memset(stats, 0, sizeof(*stats));
return 0;
}
-int bnxt_vf_rep_stats_reset_op(struct rte_eth_dev *eth_dev)
+int bnxt_rep_stats_reset_op(struct rte_eth_dev *eth_dev)
{
- struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
+ struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
int i;
for (i = 0; i < BNXT_MAX_VF_REP_RINGS; i++) {
return 0;
}
-void bnxt_vf_rep_stop_all(struct bnxt *bp)
+void bnxt_rep_stop_all(struct bnxt *bp)
{
uint16_t vf_id;
struct rte_eth_dev *rep_eth_dev;
rep_eth_dev = bp->rep_info[vf_id].vfr_eth_dev;
if (!rep_eth_dev)
continue;
- bnxt_vf_rep_dev_stop_op(rep_eth_dev);
+ bnxt_rep_dev_stop_op(rep_eth_dev);
}
}
uint16_t
bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf);
-int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params);
-int bnxt_vf_representor_uninit(struct rte_eth_dev *eth_dev);
-int bnxt_vf_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
+int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params);
+int bnxt_representor_uninit(struct rte_eth_dev *eth_dev);
+int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_dev_info *dev_info);
-int bnxt_vf_rep_dev_configure_op(struct rte_eth_dev *eth_dev);
+int bnxt_rep_dev_configure_op(struct rte_eth_dev *eth_dev);
-int bnxt_vf_rep_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_compl);
-int bnxt_vf_rep_dev_start_op(struct rte_eth_dev *eth_dev);
-int bnxt_vf_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
+int bnxt_rep_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_compl);
+int bnxt_rep_dev_start_op(struct rte_eth_dev *eth_dev);
+int bnxt_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
__rte_unused uint16_t queue_idx,
__rte_unused uint16_t nb_desc,
__rte_unused unsigned int socket_id,
__rte_unused const struct rte_eth_rxconf *
rx_conf,
__rte_unused struct rte_mempool *mp);
-int bnxt_vf_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
+int bnxt_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
__rte_unused uint16_t queue_idx,
__rte_unused uint16_t nb_desc,
__rte_unused unsigned int socket_id,
__rte_unused const struct rte_eth_txconf *
tx_conf);
-void bnxt_vf_rep_rx_queue_release_op(void *rx_queue);
-void bnxt_vf_rep_tx_queue_release_op(void *tx_queue);
-void bnxt_vf_rep_dev_stop_op(struct rte_eth_dev *eth_dev);
-void bnxt_vf_rep_dev_close_op(struct rte_eth_dev *eth_dev);
-int bnxt_vf_rep_stats_get_op(struct rte_eth_dev *eth_dev,
+void bnxt_rep_rx_queue_release_op(void *rx_queue);
+void bnxt_rep_tx_queue_release_op(void *tx_queue);
+void bnxt_rep_dev_stop_op(struct rte_eth_dev *eth_dev);
+void bnxt_rep_dev_close_op(struct rte_eth_dev *eth_dev);
+int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *stats);
-int bnxt_vf_rep_stats_reset_op(struct rte_eth_dev *eth_dev);
-void bnxt_vf_rep_stop_all(struct bnxt *bp);
+int bnxt_rep_stats_reset_op(struct rte_eth_dev *eth_dev);
+void bnxt_rep_stop_all(struct bnxt *bp);
#endif /* _BNXT_REPS_H_ */
uint8_t valid;
} __rte_packed;
+/***********************
+ * hwrm_cfa_pair_alloc *
+ ***********************/
+
+
+/* hwrm_cfa_pair_alloc_input (size:576b/72B) */
+struct hwrm_cfa_pair_alloc_input {
+ /* The HWRM command request type. */
+ uint16_t req_type;
+ /*
+ * The completion ring to send the completion event on. This should
+ * be the NQ ID returned from the `nq_alloc` HWRM command.
+ */
+ uint16_t cmpl_ring;
+ /*
+ * The sequence ID is used by the driver for tracking multiple
+ * commands. This ID is treated as opaque data by the firmware and
+ * the value is returned in the `hwrm_resp_hdr` upon completion.
+ */
+ uint16_t seq_id;
+ /*
+ * The target ID of the command:
+ * * 0x0-0xFFF8 - The function ID
+ * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+ * * 0xFFFD - Reserved for user-space HWRM interface
+ * * 0xFFFF - HWRM
+ */
+ uint16_t target_id;
+ /*
+ * A physical address pointer pointing to a host buffer that the
+ * command's response data will be written. This can be either a host
+ * physical address (HPA) or a guest physical address (GPA) and must
+ * point to a physically contiguous block of memory.
+ */
+ uint64_t resp_addr;
+ /*
+ * Pair mode (0-vf2fn, 1-rep2fn, 2-rep2rep, 3-proxy, 4-pfpair,
+ * 5-rep2fn_mod, 6-rep2fn_modall, 7-rep2fn_truflow).
+ */
+ uint16_t pair_mode;
+ /* Pair between VF on local host with PF or VF on specified host. */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_VF2FN \
+ UINT32_C(0x0)
+ /* Pair between REP on local host with PF or VF on specified host. */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_REP2FN \
+ UINT32_C(0x1)
+ /* Pair between REP on local host with REP on specified host. */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_REP2REP \
+ UINT32_C(0x2)
+ /* Pair for the proxy interface. */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_PROXY \
+ UINT32_C(0x3)
+ /* Pair for the PF interface. */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_PFPAIR \
+ UINT32_C(0x4)
+ /* Modify existing rep2fn pair and move pair to new PF. */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_REP2FN_MOD \
+ UINT32_C(0x5)
+ /* Modify existing rep2fn pairs paired with same PF and move pairs to new PF. */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_REP2FN_MODALL \
+ UINT32_C(0x6)
+ /* Truflow pair between REP on local host with PF or VF on specified host. */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_REP2FN_TRUFLOW \
+ UINT32_C(0x7)
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_LAST \
+ HWRM_CFA_PAIR_ALLOC_INPUT_PAIR_MODE_REP2FN_TRUFLOW
+ /* Logical VF number (range: 0 -> MAX_VFS -1). */
+ uint16_t vf_a_id;
+ /* Logical Host (0xff-local host). */
+ uint8_t host_b_id;
+ /* Logical PF (0xff-PF for command channel). */
+ uint8_t pf_b_id;
+ /* Logical VF number (range: 0 -> MAX_VFS -1). */
+ uint16_t vf_b_id;
+ /* Loopback port (0xff-internal loopback), valid for mode-3. */
+ uint8_t port_id;
+ /* Priority used for encap of loopback packets valid for mode-3. */
+ uint8_t pri;
+ /* New PF for rep2fn modify, valid for mode 5. */
+ uint16_t new_pf_fid;
+ uint32_t enables;
+ /*
+ * This bit must be '1' for the q_ab field to be
+ * configured.
+ */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_ENABLES_Q_AB_VALID UINT32_C(0x1)
+ /*
+ * This bit must be '1' for the q_ba field to be
+ * configured.
+ */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_ENABLES_Q_BA_VALID UINT32_C(0x2)
+ /*
+ * This bit must be '1' for the fc_ab field to be
+ * configured.
+ */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_ENABLES_FC_AB_VALID UINT32_C(0x4)
+ /*
+ * This bit must be '1' for the fc_ba field to be
+ * configured.
+ */
+ #define HWRM_CFA_PAIR_ALLOC_INPUT_ENABLES_FC_BA_VALID UINT32_C(0x8)
+ /* VF Pair name (32 byte string). */
+ char pair_name[32];
+ /*
+ * The q_ab value specifies the logical index of the TX/RX CoS
+ * queue to be assigned for traffic in the A to B direction of
+ * the interface pair. The default value is 0.
+ */
+ uint8_t q_ab;
+ /*
+ * The q_ba value specifies the logical index of the TX/RX CoS
+ * queue to be assigned for traffic in the B to A direction of
+ * the interface pair. The default value is 1.
+ */
+ uint8_t q_ba;
+ /*
+ * Specifies whether RX ring flow control is disabled (0) or enabled
+ * (1) in the A to B direction. The default value is 0, meaning that
+ * packets will be dropped when the B-side RX rings are full.
+ */
+ uint8_t fc_ab;
+ /*
+ * Specifies whether RX ring flow control is disabled (0) or enabled
+ * (1) in the B to A direction. The default value is 1, meaning that
+ * the RX CoS queue will be flow controlled when the A-side RX rings
+ * are full.
+ */
+ uint8_t fc_ba;
+ uint8_t unused_1[4];
+} __rte_packed;
+
+/* hwrm_cfa_pair_alloc_output (size:192b/24B) */
+struct hwrm_cfa_pair_alloc_output {
+ /* The specific error status for the command. */
+ uint16_t error_code;
+ /* The HWRM command request type. */
+ uint16_t req_type;
+ /* The sequence ID from the original command. */
+ uint16_t seq_id;
+ /* The length of the response data in number of bytes. */
+ uint16_t resp_len;
+ /* Only valid for modes 1 and 2. */
+ uint16_t rx_cfa_code_a;
+ /* Only valid for modes 1 and 2. */
+ uint16_t tx_cfa_action_a;
+ /* Only valid for mode 2. */
+ uint16_t rx_cfa_code_b;
+ /* Only valid for mode 2. */
+ uint16_t tx_cfa_action_b;
+ uint8_t unused_0[7];
+ /*
+ * This field is used in Output records to indicate that the output
+ * is completely written to RAM. This field should be read as '1'
+ * to indicate that the output has been completely written.
+ * When writing a command completion or response to an internal processor,
+ * the order of writes has to be such that this field is written last.
+ */
+ uint8_t valid;
+} __rte_packed;
+
+/**********************
+ * hwrm_cfa_pair_free *
+ **********************/
+
+
+/* hwrm_cfa_pair_free_input (size:448b/56B) */
+struct hwrm_cfa_pair_free_input {
+ /* The HWRM command request type. */
+ uint16_t req_type;
+ /*
+ * The completion ring to send the completion event on. This should
+ * be the NQ ID returned from the `nq_alloc` HWRM command.
+ */
+ uint16_t cmpl_ring;
+ /*
+ * The sequence ID is used by the driver for tracking multiple
+ * commands. This ID is treated as opaque data by the firmware and
+ * the value is returned in the `hwrm_resp_hdr` upon completion.
+ */
+ uint16_t seq_id;
+ /*
+ * The target ID of the command:
+ * * 0x0-0xFFF8 - The function ID
+ * * 0xFFF8-0xFFFC, 0xFFFE - Reserved for internal processors
+ * * 0xFFFD - Reserved for user-space HWRM interface
+ * * 0xFFFF - HWRM
+ */
+ uint16_t target_id;
+ /*
+ * A physical address pointer pointing to a host buffer that the
+ * command's response data will be written. This can be either a host
+ * physical address (HPA) or a guest physical address (GPA) and must
+ * point to a physically contiguous block of memory.
+ */
+ uint64_t resp_addr;
+ /* VF Pair name (32 byte string). */
+ char pair_name[32];
+ /* Logical PF (0xff-PF for command channel). */
+ uint8_t pf_b_id;
+ uint8_t unused_0[3];
+ /* Logical VF number (range: 0 -> MAX_VFS -1). */
+ uint16_t vf_id;
+ /*
+ * Pair mode (0-vf2fn, 1-rep2fn, 2-rep2rep, 3-proxy, 4-pfpair,
+ * 5-rep2fn_mod, 6-rep2fn_modall, 7-rep2fn_truflow).
+ */
+ uint16_t pair_mode;
+ /* Pair between VF on local host with PF or VF on specified host. */
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_VF2FN UINT32_C(0x0)
+ /* Pair between REP on local host with PF or VF on specified host. */
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2FN UINT32_C(0x1)
+ /* Pair between REP on local host with REP on specified host. */
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2REP UINT32_C(0x2)
+ /* Pair for the proxy interface. */
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_PROXY UINT32_C(0x3)
+ /* Pair for the PF interface. */
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_PFPAIR UINT32_C(0x4)
+ /* Modify existing rep2fn pair and move pair to new PF. */
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2FN_MOD UINT32_C(0x5)
+ /* Modify existing rep2fn pairs paired with same PF and move pairs to new PF. */
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2FN_MODALL UINT32_C(0x6)
+ /* Truflow pair between REP on local host with PF or VF on specified host. */
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2FN_TRUFLOW UINT32_C(0x7)
+ #define HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_LAST \
+ HWRM_CFA_PAIR_FREE_INPUT_PAIR_MODE_REP2FN_TRUFLOW
+} __rte_packed;
+
+/* hwrm_cfa_pair_free_output (size:128b/16B) */
+struct hwrm_cfa_pair_free_output {
+ /* The specific error status for the command. */
+ uint16_t error_code;
+ /* The HWRM command request type. */
+ uint16_t req_type;
+ /* The sequence ID from the original command. */
+ uint16_t seq_id;
+ /* The length of the response data in number of bytes. */
+ uint16_t resp_len;
+ uint8_t unused_0[7];
+ /*
+ * This field is used in Output records to indicate that the output
+ * is completely written to RAM. This field should be read as '1'
+ * to indicate that the output has been completely written.
+ * When writing a command completion or response to an internal processor,
+ * the order of writes has to be such that this field is written last.
+ */
+ uint8_t valid;
+} __rte_packed;
+
#endif /* _HSI_STRUCT_DEF_DPDK_H_ */
struct bnxt_ulp_vfr_rule_info *info;
uint8_t port_id;
struct rte_eth_dev *vfr_eth_dev;
- struct bnxt_vf_representor *vfr_bp;
+ struct bnxt_representor *vfr_bp;
if (!BNXT_TRUFLOW_EN(bp) || BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev))
return;
struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
- struct bnxt_vf_representor *vfr = dev->data->dev_private;
+ struct bnxt_representor *vfr = dev->data->dev_private;
bp = vfr->parent_dev->data->dev_private;
}
bnxt_ulp_create_vfr_default_rules(struct rte_eth_dev *vfr_ethdev)
{
struct bnxt_ulp_vfr_rule_info *info;
- struct bnxt_vf_representor *vfr = vfr_ethdev->data->dev_private;
+ struct bnxt_representor *vfr = vfr_ethdev->data->dev_private;
struct rte_eth_dev *parent_dev = vfr->parent_dev;
struct bnxt *bp = parent_dev->data->dev_private;
uint16_t vfr_port_id = vfr_ethdev->data->port_id;
}
int32_t
-bnxt_ulp_delete_vfr_default_rules(struct bnxt_vf_representor *vfr)
+bnxt_ulp_delete_vfr_default_rules(struct bnxt_representor *vfr)
{
struct bnxt_ulp_vfr_rule_info *info;
struct rte_eth_dev *parent_dev = vfr->parent_dev;