[5/8] net/nfp: add new data field into representor port structure
Checks
Commit Message
From: Qin Ke <qin.ke@corigine.com>
Add a new data field 'idx' into 'nfp_flower_representor' structure
to indicate the sequential physical port number of representor
devices, also initialize it for all representor ports.
Signed-off-by: Qin Ke <qin.ke@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/flower/nfp_flower_representor.c | 4 ++++
drivers/net/nfp/flower/nfp_flower_representor.h | 2 ++
2 files changed, 6 insertions(+)
@@ -649,6 +649,7 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
}
/* Copy data here from the input representor template */
+ repr->idx = init_repr_data->idx;
repr->vf_id = init_repr_data->vf_id;
repr->switch_domain_id = init_repr_data->switch_domain_id;
repr->port_id = init_repr_data->port_id;
@@ -822,6 +823,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
/* Create a rte_eth_dev for PF vNIC representor */
flower_repr.repr_type = NFP_REPR_TYPE_PF;
+ flower_repr.idx = 0;
/* PF vNIC reprs get a random MAC address */
rte_eth_random_addr(flower_repr.mac_addr.addr_bytes);
@@ -854,6 +856,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
flower_repr.port_id = nfp_flower_get_phys_port_id(eth_port->index);
flower_repr.nfp_idx = eth_port->index;
flower_repr.vf_id = i + 1;
+ flower_repr.idx = id;
/* Copy the real mac of the interface to the representor struct */
rte_ether_addr_copy(ð_port->mac_addr, &flower_repr.mac_addr);
@@ -887,6 +890,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF, i + pf_dev->vf_base_id, 0);
flower_repr.nfp_idx = 0;
flower_repr.vf_id = i;
+ flower_repr.idx = 0;
/* VF reprs get a random MAC address */
rte_eth_random_addr(flower_repr.mac_addr.addr_bytes);
@@ -23,6 +23,8 @@ struct nfp_flower_representor {
struct rte_eth_xstat *repr_xstats_base;
uint8_t *mac_stats;
+ /** Sequential physical port number, only valid for repr of physical port */
+ uint8_t idx;
};
int nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower,