@@ -362,7 +362,7 @@ int nfp_abm_ctrl_find_addrs(struct nfp_abm *abm)
const struct nfp_rtsym *sym;
int res;
- abm->pf_id = nfp_cppcore_pcie_unit(pf->cpp);
+ abm->pf_id = nfp_get_pf_id(pf);
/* Check if Qdisc offloads are supported */
res = nfp_pf_rtsym_read_optional(pf, NFP_RED_SUPPORT_SYM_NAME, 1);
@@ -378,10 +378,10 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
enum nfp_flower_cmsg_port_vnic_type vnic_type,
enum nfp_repr_type repr_type, unsigned int cnt)
{
- u8 nfp_pcie = nfp_cppcore_pcie_unit(app->pf->cpp);
struct nfp_flower_priv *priv = app->priv;
atomic_t *replies = &priv->reify_replies;
struct nfp_flower_repr_priv *repr_priv;
+ u8 nfp_pcie = nfp_get_pf_id(app->pf);
enum nfp_port_type port_type;
struct nfp_repr *nfp_repr;
struct nfp_reprs *reprs;
@@ -69,6 +69,13 @@ static const struct pci_device_id nfp_pci_device_ids[] = {
};
MODULE_DEVICE_TABLE(pci, nfp_pci_device_ids);
+u8 nfp_get_pf_id(struct nfp_pf *pf)
+{
+ return nfp_cppcore_pcie_unit(pf->cpp) *
+ pf->dev_info->pf_num_per_unit +
+ pf->multi_pf.id;
+}
+
int nfp_pf_rtsym_read_optional(struct nfp_pf *pf, const char *format,
unsigned int default_val)
{
@@ -76,7 +83,7 @@ int nfp_pf_rtsym_read_optional(struct nfp_pf *pf, const char *format,
int err = 0;
u64 val;
- snprintf(name, sizeof(name), format, nfp_cppcore_pcie_unit(pf->cpp));
+ snprintf(name, sizeof(name), format, nfp_get_pf_id(pf));
val = nfp_rtsym_read_le(pf->rtbl, name, &err);
if (err) {
@@ -95,8 +102,7 @@ nfp_pf_map_rtsym(struct nfp_pf *pf, const char *name, const char *sym_fmt,
{
char pf_symbol[256];
- snprintf(pf_symbol, sizeof(pf_symbol), sym_fmt,
- nfp_cppcore_pcie_unit(pf->cpp));
+ snprintf(pf_symbol, sizeof(pf_symbol), sym_fmt, nfp_get_pf_id(pf));
return nfp_rtsym_map(pf->rtbl, pf_symbol, name, min_size, area);
}
@@ -803,10 +809,8 @@ static void nfp_fw_unload(struct nfp_pf *pf)
static int nfp_pf_find_rtsyms(struct nfp_pf *pf)
{
+ unsigned int pf_id = nfp_get_pf_id(pf);
char pf_symbol[256];
- unsigned int pf_id;
-
- pf_id = nfp_cppcore_pcie_unit(pf->cpp);
/* Optional per-PCI PF mailbox */
snprintf(pf_symbol, sizeof(pf_symbol), NFP_MBOX_SYM_NAME, pf_id);
@@ -832,7 +836,7 @@ static u64 nfp_net_pf_get_app_cap(struct nfp_pf *pf)
int err = 0;
u64 val;
- snprintf(name, sizeof(name), "_pf%u_net_app_cap", nfp_cppcore_pcie_unit(pf->cpp));
+ snprintf(name, sizeof(name), "_pf%u_net_app_cap", nfp_get_pf_id(pf));
val = nfp_rtsym_read_le(pf->rtbl, name, &err);
if (err) {
@@ -208,4 +208,6 @@ void nfp_devlink_params_unregister(struct nfp_pf *pf);
unsigned int nfp_net_lr2speed(unsigned int linkrate);
unsigned int nfp_net_speed2lr(unsigned int speed);
+
+u8 nfp_get_pf_id(struct nfp_pf *pf);
#endif /* NFP_MAIN_H */
@@ -19,6 +19,7 @@ const struct nfp_dev_info nfp_dev_info[NFP_DEV_CNT] = {
.pcie_cfg_expbar_offset = 0x0a00,
.pcie_expl_offset = 0xd000,
.qc_area_sz = 0x100000,
+ .pf_num_per_unit = 4,
},
[NFP_DEV_NFP3800_VF] = {
.dma_mask = DMA_BIT_MASK(48),
@@ -38,6 +39,7 @@ const struct nfp_dev_info nfp_dev_info[NFP_DEV_CNT] = {
.pcie_cfg_expbar_offset = 0x0400,
.pcie_expl_offset = 0x1000,
.qc_area_sz = 0x80000,
+ .pf_num_per_unit = 1,
},
[NFP_DEV_NFP6000_VF] = {
.dma_mask = DMA_BIT_MASK(40),
@@ -35,6 +35,7 @@ struct nfp_dev_info {
u32 pcie_cfg_expbar_offset;
u32 pcie_expl_offset;
u32 qc_area_sz;
+ u8 pf_num_per_unit;
};
extern const struct nfp_dev_info nfp_dev_info[NFP_DEV_CNT];