Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1383893 > unrolled thread
| Started by | sunil.kovvuri@gmail.com |
|---|---|
| First post | 2016-04-21 09:00 +0200 |
| Last post | 2016-04-21 21:40 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2 0/4] net: thunderx: Add multiqset support for DPDK sunil.kovvuri@gmail.com - 2016-04-21 09:00 +0200
[PATCH v2 3/4] net: thunderx: add sysfs attribute for SQS/SVF assigments sunil.kovvuri@gmail.com - 2016-04-21 09:00 +0200
[PATCH v2 1/4] net: thunderx: Introduce a mailbox message to reset VF counters sunil.kovvuri@gmail.com - 2016-04-21 09:00 +0200
Re: [PATCH v2 0/4] net: thunderx: Add multiqset support for DPDK David Miller <davem@davemloft.net> - 2016-04-21 21:40 +0200
| From | sunil.kovvuri@gmail.com |
|---|---|
| Date | 2016-04-21 09:00 +0200 |
| Subject | [PATCH v2 0/4] net: thunderx: Add multiqset support for DPDK |
| Message-ID | <rqgKK-4Hu-11@gated-at.bofh.it> |
From: Sunil Goutham <sgoutham@cavium.com> This patch series mainly adds support for userspace application like DPDK with a VNIC VF attached to request additional QSets for having morethan the default 8 queues. Changes from v1: Fixed compilation issue reported by kbuild test robot due to changes in 2nd patch. Now 'nic_get_vf_pdev' fn() is under CONFIG_PCI_IOV. Jerin Jacob (1): net: thunderx: Introduce a mailbox message to reset VF counters Radoslaw Biernacki (3): net: thunderx: Add multiqset support for dataplane apps net: thunderx: add sysfs attribute for SQS/SVF assigments net: thunderx: Improvement for MBX interface debug messages drivers/net/ethernet/cavium/thunder/nic.h | 32 ++- drivers/net/ethernet/cavium/thunder/nic_main.c | 325 +++++++++++++++++++--- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 10 +- 3 files changed, 328 insertions(+), 39 deletions(-)
[toc] | [next] | [standalone]
| From | sunil.kovvuri@gmail.com |
|---|---|
| Date | 2016-04-21 09:00 +0200 |
| Subject | [PATCH v2 3/4] net: thunderx: add sysfs attribute for SQS/SVF assigments |
| Message-ID | <rqgKK-4Hu-19@gated-at.bofh.it> |
| In reply to | #1383893 |
From: Radoslaw Biernacki <rad@semihalf.com>
With this sysfs attribute (sriov_sqs_assignment) administrator will be
able to read the current assigment of SQS/SVF for a given VF. This is
useful to decide which VFs needs to be attached to UIO for a successful
allocation of secondary Qsets
Signed-off-by: Radoslaw Biernacki <rad@semihalf.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
drivers/net/ethernet/cavium/thunder/nic_main.c | 67 +++++++++++++++++++++++-
1 files changed, 66 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index cd5e7a4..02e9a75 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -1163,6 +1163,60 @@ static void nic_poll_for_link(struct work_struct *work)
queue_delayed_work(nic->check_link, &nic->dwork, HZ * 2);
}
+ssize_t sriov_sqs_assignment_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+ struct pci_dev *vf_dev;
+ struct pci_driver *vf_drv;
+ struct nicpf *nic = pci_get_drvdata(pdev);
+ size_t vf, off, svf_idx;
+
+ off = scnprintf(buf, PAGE_SIZE, "%u\n", nic->num_vf_en);
+
+ for (vf = 0; vf < nic->num_vf_en; vf++) {
+ vf_dev = nic->vf_pdev[vf];
+ vf_drv = vf_dev ? pci_dev_driver(vf_dev) : NULL;
+ if (off >= PAGE_SIZE)
+ break;
+ off += scnprintf(&buf[off], PAGE_SIZE - off,
+ "%zu %04x:%02x:%02x.%d %s %c:",
+ vf, pci_domain_nr(vf_dev->bus),
+ vf_dev->bus->number, PCI_SLOT(vf_dev->devfn),
+ PCI_FUNC(vf_dev->devfn),
+ vf_drv ? vf_drv->name : "no-driver",
+ nic->vf_enabled[vf] ? '+' : '-');
+ for (svf_idx = 0; svf_idx < MAX_SQS_PER_VF; svf_idx++) {
+ if (off >= PAGE_SIZE)
+ break;
+ if (nic->vf_sqs[vf][svf_idx] == NIC_VF_UNASSIGNED)
+ break;
+ off += scnprintf(&buf[off], PAGE_SIZE - off, " %d",
+ nic->vf_sqs[vf][svf_idx]);
+ }
+ if (off >= PAGE_SIZE)
+ break;
+ off += scnprintf(&buf[off], PAGE_SIZE - off, "\n");
+ }
+
+ for (vf = nic->num_vf_en; vf < nic->num_vf_en + nic->num_sqs_en; vf++) {
+ vf_dev = nic->vf_pdev[vf];
+ vf_drv = vf_dev ? pci_dev_driver(vf_dev) : NULL;
+ if (off >= PAGE_SIZE)
+ break;
+ off += scnprintf(&buf[off], PAGE_SIZE - off,
+ "%zu %04x:%02x:%02x.%d %s: %u\n",
+ vf, pci_domain_nr(vf_dev->bus),
+ vf_dev->bus->number, PCI_SLOT(vf_dev->devfn),
+ PCI_FUNC(vf_dev->devfn),
+ vf_drv ? vf_drv->name : "no-driver",
+ nic->pqs_vf[vf]);
+ }
+
+ return off;
+}
+DEVICE_ATTR_RO(sriov_sqs_assignment);
+
static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct device *dev = &pdev->dev;
@@ -1239,12 +1293,18 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (err)
goto err_unregister_interrupts;
+ err = device_create_file(dev, &dev_attr_sriov_sqs_assignment);
+ if (err) {
+ err = -ENOMEM;
+ goto err_disable_sriov;
+ }
+
/* Register a physical link status poll fn() */
nic->check_link = alloc_workqueue("check_link_status",
WQ_UNBOUND | WQ_MEM_RECLAIM, 1);
if (!nic->check_link) {
err = -ENOMEM;
- goto err_disable_sriov;
+ goto err_remove_sysfs_attr;
}
INIT_DELAYED_WORK(&nic->dwork, nic_poll_for_link);
@@ -1252,6 +1312,8 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0;
+err_remove_sysfs_attr:
+ device_remove_file(dev, &dev_attr_sriov_sqs_assignment);
err_disable_sriov:
if (nic->flags & NIC_SRIOV_ENABLED) {
nic_put_vf_pdev(nic);
@@ -1270,6 +1332,9 @@ err_disable_device:
static void nic_remove(struct pci_dev *pdev)
{
struct nicpf *nic = pci_get_drvdata(pdev);
+ struct device *dev = &pdev->dev;
+
+ device_remove_file(dev, &dev_attr_sriov_sqs_assignment);
if (nic->flags & NIC_SRIOV_ENABLED) {
nic_put_vf_pdev(nic);
--
1.7.1
[toc] | [prev] | [next] | [standalone]
| From | sunil.kovvuri@gmail.com |
|---|---|
| Date | 2016-04-21 09:00 +0200 |
| Subject | [PATCH v2 1/4] net: thunderx: Introduce a mailbox message to reset VF counters |
| Message-ID | <rqgKK-4Hu-21@gated-at.bofh.it> |
| In reply to | #1383893 |
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Write access to VF statistics counter register is only allowed from PF.
Added a new mailbox message to reset VF's Rx/Tx counters, this is used
by userspace DPDK.
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
drivers/net/ethernet/cavium/thunder/nic.h | 27 ++++++++++++++
drivers/net/ethernet/cavium/thunder/nic_main.c | 45 ++++++++++++++++++++++++
2 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 83025bb..e2ac9bd 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -368,6 +368,7 @@ struct nicvf {
#define NIC_MBOX_MSG_PNICVF_PTR 0x14 /* Get primary qset nicvf ptr */
#define NIC_MBOX_MSG_SNICVF_PTR 0x15 /* Send sqet nicvf ptr to PVF */
#define NIC_MBOX_MSG_LOOPBACK 0x16 /* Set interface in loopback */
+#define NIC_MBOX_MSG_RESET_STAT_COUNTER 0x17 /* Reset statistics counters */
#define NIC_MBOX_MSG_CFG_DONE 0xF0 /* VF configuration done */
#define NIC_MBOX_MSG_SHUTDOWN 0xF1 /* VF is being shutdown */
@@ -484,6 +485,31 @@ struct set_loopback {
bool enable;
};
+/* Reset statistics counters */
+struct reset_stat_cfg {
+ u8 msg;
+ /* Bitmap to select NIC_PF_VNIC(vf_id)_RX_STAT(0..13) */
+ u16 rx_stat_mask;
+ /* Bitmap to select NIC_PF_VNIC(vf_id)_TX_STAT(0..4) */
+ u8 tx_stat_mask;
+ /* Bitmap to select NIC_PF_QS(0..127)_RQ(0..7)_STAT(0..1)
+ * bit14, bit15 NIC_PF_QS(vf_id)_RQ7_STAT(0..1)
+ * bit12, bit13 NIC_PF_QS(vf_id)_RQ6_STAT(0..1)
+ * ..
+ * bit2, bit3 NIC_PF_QS(vf_id)_RQ1_STAT(0..1)
+ * bit0, bit1 NIC_PF_QS(vf_id)_RQ0_STAT(0..1)
+ */
+ u16 rq_stat_mask;
+ /* Bitmap to select NIC_PF_QS(0..127)_SQ(0..7)_STAT(0..1)
+ * bit14, bit15 NIC_PF_QS(vf_id)_SQ7_STAT(0..1)
+ * bit12, bit13 NIC_PF_QS(vf_id)_SQ6_STAT(0..1)
+ * ..
+ * bit2, bit3 NIC_PF_QS(vf_id)_SQ1_STAT(0..1)
+ * bit0, bit1 NIC_PF_QS(vf_id)_SQ0_STAT(0..1)
+ */
+ u16 sq_stat_mask;
+};
+
/* 128 bit shared memory between PF and each VF */
union nic_mbx {
struct { u8 msg; } msg;
@@ -501,6 +527,7 @@ union nic_mbx {
struct sqs_alloc sqs_alloc;
struct nicvf_ptr nicvf;
struct set_loopback lbk;
+ struct reset_stat_cfg reset_stat;
};
#define NIC_NODE_ID_MASK 0x03
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 95f17f8..77ee260 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -616,6 +616,48 @@ static int nic_config_loopback(struct nicpf *nic, struct set_loopback *lbk)
return 0;
}
+/* Reset statistics counters */
+static int nic_reset_stat_counters(struct nicpf *nic,
+ int vf, struct reset_stat_cfg *cfg)
+{
+ int i, stat, qnum;
+ u64 reg_addr;
+
+ for (i = 0; i < RX_STATS_ENUM_LAST; i++) {
+ if (cfg->rx_stat_mask & BIT(i)) {
+ reg_addr = NIC_PF_VNIC_0_127_RX_STAT_0_13 |
+ (vf << NIC_QS_ID_SHIFT) |
+ (i << 3);
+ nic_reg_write(nic, reg_addr, 0);
+ }
+ }
+
+ for (i = 0; i < TX_STATS_ENUM_LAST; i++) {
+ if (cfg->tx_stat_mask & BIT(i)) {
+ reg_addr = NIC_PF_VNIC_0_127_TX_STAT_0_4 |
+ (vf << NIC_QS_ID_SHIFT) |
+ (i << 3);
+ nic_reg_write(nic, reg_addr, 0);
+ }
+ }
+
+ for (i = 0; i <= 15; i++) {
+ qnum = i >> 1;
+ stat = i & 1 ? 1 : 0;
+ reg_addr = (vf << NIC_QS_ID_SHIFT) |
+ (qnum << NIC_Q_NUM_SHIFT) | (stat << 3);
+ if (cfg->rq_stat_mask & BIT(i)) {
+ reg_addr |= NIC_PF_QSET_0_127_RQ_0_7_STAT_0_1;
+ nic_reg_write(nic, reg_addr, 0);
+ }
+ if (cfg->sq_stat_mask & BIT(i)) {
+ reg_addr |= NIC_PF_QSET_0_127_SQ_0_7_STAT_0_1;
+ nic_reg_write(nic, reg_addr, 0);
+ }
+ }
+ return 0;
+}
+
static void nic_enable_vf(struct nicpf *nic, int vf, bool enable)
{
int bgx, lmac;
@@ -757,6 +799,9 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
case NIC_MBOX_MSG_LOOPBACK:
ret = nic_config_loopback(nic, &mbx.lbk);
break;
+ case NIC_MBOX_MSG_RESET_STAT_COUNTER:
+ ret = nic_reset_stat_counters(nic, vf, &mbx.reset_stat);
+ break;
default:
dev_err(&nic->pdev->dev,
"Invalid msg from VF%d, msg 0x%x\n", vf, mbx.msg.msg);
--
1.7.1
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-04-21 21:40 +0200 |
| Message-ID | <rqsCe-69j-13@gated-at.bofh.it> |
| In reply to | #1383893 |
From: sunil.kovvuri@gmail.com Date: Thu, 21 Apr 2016 12:27:48 +0530 > This patch series mainly adds support for userspace application > like DPDK with a VNIC VF attached to request additional QSets > for having morethan the default 8 queues. I don't think it's appropriate to add facilities for non-upstream features, especially DPDK. Thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web