Re: [PATCH 2/4] net: thunderx: Add multiqset support for dataplane apps
Hi, [auto build test ERROR on net/master] [also build test ERROR on v4.6-rc4 next-20160420] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/sunil-kovvuri-gmail-com/net-thunderx-Add-multiqset-support-for-DPDK/20160419-213640 config: x86_64-randconfig-s4-04211222 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/net/ethernet/cavium/thunder/nic_main.c: In function 'nic_get_vf_pdev': >> drivers/net/ethernet/cavium/thunder/nic_main.c:600:12: error: 'struct >> pci_dev' has no member named 'physfn' if (vfdev->physfn != pdev) ^ vim +600 drivers/net/ethernet/cavium/thunder/nic_main.c 594 pci_read_config_word(pdev, pos + PCI_SRIOV_VF_DID, ); 595 596 vfdev = pci_get_device(vid, devid, NULL); 597 for (; vfdev; vfdev = pci_get_device(vid, devid, vfdev)) { 598 if (!vfdev->is_virtfn) 599 continue; > 600 if (vfdev->physfn != pdev) 601 continue; 602 if (vf >= vf_en) 603 continue; --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH 2/4] net: thunderx: Add multiqset support for dataplane apps
Hi, [auto build test ERROR on net/master] [also build test ERROR on v4.6-rc4 next-20160420] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/sunil-kovvuri-gmail-com/net-thunderx-Add-multiqset-support-for-DPDK/20160419-213640 config: x86_64-randconfig-s4-04211222 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/net/ethernet/cavium/thunder/nic_main.c: In function 'nic_get_vf_pdev': >> drivers/net/ethernet/cavium/thunder/nic_main.c:600:12: error: 'struct >> pci_dev' has no member named 'physfn' if (vfdev->physfn != pdev) ^ vim +600 drivers/net/ethernet/cavium/thunder/nic_main.c 594 pci_read_config_word(pdev, pos + PCI_SRIOV_VF_DID, ); 595 596 vfdev = pci_get_device(vid, devid, NULL); 597 for (; vfdev; vfdev = pci_get_device(vid, devid, vfdev)) { 598 if (!vfdev->is_virtfn) 599 continue; > 600 if (vfdev->physfn != pdev) 601 continue; 602 if (vf >= vf_en) 603 continue; --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[PATCH 2/4] net: thunderx: Add multiqset support for dataplane apps
From: Radoslaw BiernackiThis patch adds support to PF for allocating additional Qsets to dataplane apps such as DPDK. Till now PF, upon host bound interface's request it used to allocate Qsets from the free ones, but for dataplane apps support has been added for it to request specific Qsets instead of just PF's choice. And also adds validation checks at different places, these are needed to have proper secondary Qset allocation when interfaces in different domain i.e Host, VFIO, DPDK e.t.c exist at the same time. Some of the checks are - Check if RSS indirection table has valid entries. - When host bound interface requests additional Qsets, PF should assign only those which in host domain i.e both primary VF and secondary VFs should be using same driver. Hence added PCI driver checks. - If dataplane app terminates without proper shutdown then when restarted it will request the same or different SQsets as were assigned before. This is taken care of otherwise application won't recover. Removed 'sqs_used' which became redundant due to new SQset allocation scheme. Signed-off-by: Radoslaw Biernacki Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/nic.h|5 +- drivers/net/ethernet/cavium/thunder/nic_main.c | 193 +++--- drivers/net/ethernet/cavium/thunder/nicvf_main.c |2 +- 3 files changed, 170 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h index e2ac9bd..b63278a 100644 --- a/drivers/net/ethernet/cavium/thunder/nic.h +++ b/drivers/net/ethernet/cavium/thunder/nic.h @@ -463,11 +463,12 @@ struct bgx_link_status { u32 speed; }; -/* Get Extra Qset IDs */ +/* Allocate additional SQS to VF */ struct sqs_alloc { u8msg; - u8vf_id; + u8spec; /* 1 - For specific SQS allocation, 0 - For PF's choice */ u8qs_count; + u8svf[MAX_SQS_PER_VF]; /* SQS VF ids for specific allocation */ }; struct nicvf_ptr { diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 77ee260..d6a6914 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -29,9 +29,9 @@ struct nicpf { void __iomem*reg_base; /* Register start address */ u8 num_sqs_en; /* Secondary qsets enabled */ u64 nicvf[MAX_NUM_VFS_SUPPORTED]; +#defineNIC_VF_UNASSIGNED ((u8)0xFF) u8 vf_sqs[MAX_NUM_VFS_SUPPORTED][MAX_SQS_PER_VF]; u8 pqs_vf[MAX_NUM_VFS_SUPPORTED]; - boolsqs_used[MAX_NUM_VFS_SUPPORTED]; struct pkind_cfgpkind; #defineNIC_SET_VF_LMAC_MAP(bgx, lmac) (((bgx & 0xF) << 4) | (lmac & 0xF)) #defineNIC_GET_BGX_FROM_VF_LMAC_MAP(map) ((map >> 4) & 0xF) @@ -46,6 +46,7 @@ struct nicpf { u16 rssi_base[MAX_NUM_VFS_SUPPORTED]; u16 rss_ind_tbl_size; boolmbx_lock[MAX_NUM_VFS_SUPPORTED]; + struct pci_dev *vf_pdev[MAX_NUM_VFS_SUPPORTED]; /* MSI-X */ boolmsix_enabled; @@ -458,10 +459,18 @@ static void nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg) for (; rssi < (rssi_base + cfg->tbl_len); rssi++) { u8 svf = cfg->ind_tbl[idx] >> 3; - if (svf) + if (svf && (svf <= MAX_SQS_PER_VF)) { qset = nic->vf_sqs[cfg->vf_id][svf - 1]; - else + if ((qset >= MAX_NUM_VFS_SUPPORTED) || + (nic->pqs_vf[qset] != cfg->vf_id)) { + dev_err(>pdev->dev, + "Invalid rss table entry %d from VF %d\n", + cfg->ind_tbl[idx], cfg->vf_id); + qset = cfg->vf_id; + } + } else { qset = cfg->vf_id; + } nic_reg_write(nic, NIC_PF_RSSI_0_4097_RQ | (rssi << 3), (qset << 3) | (cfg->ind_tbl[idx] & 0x7)); idx++; @@ -550,7 +559,19 @@ static void nic_send_pnicvf(struct nicpf *nic, int sqs) static void nic_send_snicvf(struct nicpf *nic, struct nicvf_ptr *nicvf) { union nic_mbx mbx = {}; - int sqs_id = nic->vf_sqs[nicvf->vf_id][nicvf->sqs_id]; + int sqs_id; + + if (nicvf->sqs_id >= MAX_SQS_PER_VF) { + nic_mbx_send_nack(nic, nicvf->vf_id); + return; + } + + sqs_id = nic->vf_sqs[nicvf->vf_id][nicvf->sqs_id]; + if ((sqs_id < nic->num_vf_en) || + (nic->pqs_vf[sqs_id] !=
[PATCH 2/4] net: thunderx: Add multiqset support for dataplane apps
From: Radoslaw Biernacki This patch adds support to PF for allocating additional Qsets to dataplane apps such as DPDK. Till now PF, upon host bound interface's request it used to allocate Qsets from the free ones, but for dataplane apps support has been added for it to request specific Qsets instead of just PF's choice. And also adds validation checks at different places, these are needed to have proper secondary Qset allocation when interfaces in different domain i.e Host, VFIO, DPDK e.t.c exist at the same time. Some of the checks are - Check if RSS indirection table has valid entries. - When host bound interface requests additional Qsets, PF should assign only those which in host domain i.e both primary VF and secondary VFs should be using same driver. Hence added PCI driver checks. - If dataplane app terminates without proper shutdown then when restarted it will request the same or different SQsets as were assigned before. This is taken care of otherwise application won't recover. Removed 'sqs_used' which became redundant due to new SQset allocation scheme. Signed-off-by: Radoslaw Biernacki Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/nic.h|5 +- drivers/net/ethernet/cavium/thunder/nic_main.c | 193 +++--- drivers/net/ethernet/cavium/thunder/nicvf_main.c |2 +- 3 files changed, 170 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h index e2ac9bd..b63278a 100644 --- a/drivers/net/ethernet/cavium/thunder/nic.h +++ b/drivers/net/ethernet/cavium/thunder/nic.h @@ -463,11 +463,12 @@ struct bgx_link_status { u32 speed; }; -/* Get Extra Qset IDs */ +/* Allocate additional SQS to VF */ struct sqs_alloc { u8msg; - u8vf_id; + u8spec; /* 1 - For specific SQS allocation, 0 - For PF's choice */ u8qs_count; + u8svf[MAX_SQS_PER_VF]; /* SQS VF ids for specific allocation */ }; struct nicvf_ptr { diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 77ee260..d6a6914 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -29,9 +29,9 @@ struct nicpf { void __iomem*reg_base; /* Register start address */ u8 num_sqs_en; /* Secondary qsets enabled */ u64 nicvf[MAX_NUM_VFS_SUPPORTED]; +#defineNIC_VF_UNASSIGNED ((u8)0xFF) u8 vf_sqs[MAX_NUM_VFS_SUPPORTED][MAX_SQS_PER_VF]; u8 pqs_vf[MAX_NUM_VFS_SUPPORTED]; - boolsqs_used[MAX_NUM_VFS_SUPPORTED]; struct pkind_cfgpkind; #defineNIC_SET_VF_LMAC_MAP(bgx, lmac) (((bgx & 0xF) << 4) | (lmac & 0xF)) #defineNIC_GET_BGX_FROM_VF_LMAC_MAP(map) ((map >> 4) & 0xF) @@ -46,6 +46,7 @@ struct nicpf { u16 rssi_base[MAX_NUM_VFS_SUPPORTED]; u16 rss_ind_tbl_size; boolmbx_lock[MAX_NUM_VFS_SUPPORTED]; + struct pci_dev *vf_pdev[MAX_NUM_VFS_SUPPORTED]; /* MSI-X */ boolmsix_enabled; @@ -458,10 +459,18 @@ static void nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg) for (; rssi < (rssi_base + cfg->tbl_len); rssi++) { u8 svf = cfg->ind_tbl[idx] >> 3; - if (svf) + if (svf && (svf <= MAX_SQS_PER_VF)) { qset = nic->vf_sqs[cfg->vf_id][svf - 1]; - else + if ((qset >= MAX_NUM_VFS_SUPPORTED) || + (nic->pqs_vf[qset] != cfg->vf_id)) { + dev_err(>pdev->dev, + "Invalid rss table entry %d from VF %d\n", + cfg->ind_tbl[idx], cfg->vf_id); + qset = cfg->vf_id; + } + } else { qset = cfg->vf_id; + } nic_reg_write(nic, NIC_PF_RSSI_0_4097_RQ | (rssi << 3), (qset << 3) | (cfg->ind_tbl[idx] & 0x7)); idx++; @@ -550,7 +559,19 @@ static void nic_send_pnicvf(struct nicpf *nic, int sqs) static void nic_send_snicvf(struct nicpf *nic, struct nicvf_ptr *nicvf) { union nic_mbx mbx = {}; - int sqs_id = nic->vf_sqs[nicvf->vf_id][nicvf->sqs_id]; + int sqs_id; + + if (nicvf->sqs_id >= MAX_SQS_PER_VF) { + nic_mbx_send_nack(nic, nicvf->vf_id); + return; + } + + sqs_id = nic->vf_sqs[nicvf->vf_id][nicvf->sqs_id]; + if ((sqs_id < nic->num_vf_en) || + (nic->pqs_vf[sqs_id] != nicvf->vf_id)) { + nic_mbx_send_nack(nic, nicvf->vf_id);