X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_ethdev.c;h=3c76f21f8cd83f8011e50c13e14d9e52bb38c60c;hb=eee264adc95ed049642a9c7d0e4b897d51ccaccf;hp=a1c213e78ba2a309d5a93824ca86014fdd007398;hpb=6dc83230b43b1a69603f61e55ddc4e5905336365;p=dpdk.git diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index a1c213e78b..3c76f21f8c 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -28,6 +28,7 @@ #include "bnxt_vnic.h" #include "hsi_struct_def_dpdk.h" #include "bnxt_nvm_defs.h" +#include "bnxt_tf_common.h" #define DRV_MODULE_NAME "bnxt" static const char bnxt_version[] = @@ -96,6 +97,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { #define BNXT_DEVARG_TRUFLOW "host-based-truflow" #define BNXT_DEVARG_FLOW_XSTAT "flow-xstat" #define BNXT_DEVARG_MAX_NUM_KFLOWS "max-num-kflows" + static const char *const bnxt_dev_args[] = { BNXT_DEVARG_TRUFLOW, BNXT_DEVARG_FLOW_XSTAT, @@ -172,6 +174,11 @@ uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp) return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_THOR; } +static void bnxt_free_parent_info(struct bnxt *bp) +{ + rte_free(bp->parent); +} + static void bnxt_free_pf_info(struct bnxt *bp) { rte_free(bp->pf); @@ -222,6 +229,16 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig) bp->grp_info = NULL; } +static int bnxt_alloc_parent_info(struct bnxt *bp) +{ + bp->parent = rte_zmalloc("bnxt_parent_info", + sizeof(struct bnxt_parent_info), 0); + if (bp->parent == NULL) + return -ENOMEM; + + return 0; +} + static int bnxt_alloc_pf_info(struct bnxt *bp) { bp->pf = rte_zmalloc("bnxt_pf_info", sizeof(struct bnxt_pf_info), 0); @@ -1321,6 +1338,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) bnxt_free_cos_queues(bp); bnxt_free_link_info(bp); bnxt_free_pf_info(bp); + bnxt_free_parent_info(bp); eth_dev->dev_ops = NULL; eth_dev->rx_pkt_burst = NULL; @@ -5083,6 +5101,63 @@ bnxt_get_fw_func_id(uint16_t port) return bp->fw_fid; } +enum bnxt_ulp_intf_type +bnxt_get_interface_type(uint16_t port) +{ + struct rte_eth_dev *eth_dev; + struct bnxt *bp; + + eth_dev = &rte_eth_devices[port]; + if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) + return BNXT_ULP_INTF_TYPE_VF_REP; + + bp = eth_dev->data->dev_private; + return BNXT_PF(bp) ? BNXT_ULP_INTF_TYPE_PF + : BNXT_ULP_INTF_TYPE_VF; +} + +uint16_t +bnxt_get_phy_port_id(uint16_t port_id) +{ + struct bnxt_vf_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)) { + vfr = eth_dev->data->dev_private; + eth_dev = vfr->parent_dev; + } + + bp = eth_dev->data->dev_private; + + return BNXT_PF(bp) ? bp->pf->port_id : bp->parent->port_id; +} + +uint16_t +bnxt_get_parif(uint16_t port_id) +{ + struct bnxt_vf_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)) { + vfr = eth_dev->data->dev_private; + eth_dev = vfr->parent_dev; + } + + bp = eth_dev->data->dev_private; + + return BNXT_PF(bp) ? bp->fw_fid - 1 : bp->parent->fid - 1; +} + +uint16_t +bnxt_get_vport(uint16_t port_id) +{ + return (1 << bnxt_get_phy_port_id(port_id)); +} + static void bnxt_alloc_error_recovery_info(struct bnxt *bp) { struct bnxt_error_recovery_info *info = bp->recovery_info; @@ -5209,6 +5284,10 @@ static int bnxt_init_fw(struct bnxt *bp) bnxt_hwrm_port_mac_qcfg(bp); + bnxt_hwrm_parent_pf_qcfg(bp); + + bnxt_hwrm_port_phy_qcaps(bp); + rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp); if (rc) return rc; @@ -5527,6 +5606,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused) if (rc) goto error_free; + rc = bnxt_alloc_parent_info(bp); + if (rc) + goto error_free; + rc = bnxt_alloc_hwrm_resources(bp); if (rc) { PMD_DRV_LOG(ERR,