* [PATCH net-next v2 0/3] enic: Additional ethtool support
@ 2017-11-01 15:44 Parvi Kaustubhi
2017-11-01 15:44 ` [PATCH net-next v2 1/3] enic: reset fetch index Parvi Kaustubhi
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Parvi Kaustubhi @ 2017-11-01 15:44 UTC (permalink / raw)
To: netdev, davem; +Cc: gvaradar, benve, Parvi Kaustubhi
This patch set allows the user to show or modify rx/tx ring sizes using
ethtool.
v2:
- remove unused variable to fix build warning.
- update list of maintainers for cisco vic ethernet nic driver.
Parvi Kaustubhi (3):
enic: reset fetch index
enic: Add support for 'ethtool -g/-G'
MAINTAINERS: update MAINTAINERS for cisco vic
MAINTAINERS | 2 +-
drivers/net/ethernet/cisco/enic/enic.h | 2 +-
drivers/net/ethernet/cisco/enic/enic_ethtool.c | 77 ++++++++++++++++++++++++++
drivers/net/ethernet/cisco/enic/vnic_rq.c | 16 +-----
4 files changed, 81 insertions(+), 16 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v2 1/3] enic: reset fetch index
2017-11-01 15:44 [PATCH net-next v2 0/3] enic: Additional ethtool support Parvi Kaustubhi
@ 2017-11-01 15:44 ` Parvi Kaustubhi
2017-11-03 10:28 ` David Laight
2017-11-01 15:44 ` [PATCH net-next v2 2/3] enic: Add support for 'ethtool -g/-G' Parvi Kaustubhi
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Parvi Kaustubhi @ 2017-11-01 15:44 UTC (permalink / raw)
To: netdev, davem; +Cc: gvaradar, benve, Parvi Kaustubhi
Since we are allowing rx ring size modification, reset fetch index
everytime. Otherwise it could have a stale value that can lead to a null
pointer dereference.
Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
Signed-off-by: Parvi Kaustubhi <pkaustub@cisco.com>
---
v2: remove unused variable to fix build warning
drivers/net/ethernet/cisco/enic/vnic_rq.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/vnic_rq.c b/drivers/net/ethernet/cisco/enic/vnic_rq.c
index 36bc2c7..f8aa326 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_rq.c
+++ b/drivers/net/ethernet/cisco/enic/vnic_rq.c
@@ -139,20 +139,8 @@ void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index,
unsigned int error_interrupt_enable,
unsigned int error_interrupt_offset)
{
- u32 fetch_index = 0;
-
- /* Use current fetch_index as the ring starting point */
- fetch_index = ioread32(&rq->ctrl->fetch_index);
-
- if (fetch_index == 0xFFFFFFFF) { /* check for hardware gone */
- /* Hardware surprise removal: reset fetch_index */
- fetch_index = 0;
- }
-
- vnic_rq_init_start(rq, cq_index,
- fetch_index, fetch_index,
- error_interrupt_enable,
- error_interrupt_offset);
+ vnic_rq_init_start(rq, cq_index, 0, 0, error_interrupt_enable,
+ error_interrupt_offset);
}
unsigned int vnic_rq_error_status(struct vnic_rq *rq)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v2 2/3] enic: Add support for 'ethtool -g/-G'
2017-11-01 15:44 [PATCH net-next v2 0/3] enic: Additional ethtool support Parvi Kaustubhi
2017-11-01 15:44 ` [PATCH net-next v2 1/3] enic: reset fetch index Parvi Kaustubhi
@ 2017-11-01 15:44 ` Parvi Kaustubhi
2017-11-01 15:44 ` [PATCH net-next v2 3/3] MAINTAINERS: update MAINTAINERS for cisco vic Parvi Kaustubhi
2017-11-02 5:17 ` [PATCH net-next v2 0/3] enic: Additional ethtool support David Miller
3 siblings, 0 replies; 6+ messages in thread
From: Parvi Kaustubhi @ 2017-11-01 15:44 UTC (permalink / raw)
To: netdev, davem; +Cc: gvaradar, benve, Parvi Kaustubhi
Add support for displaying and modifying rx and tx ring sizes using
ethtool.
Also, increasing version to 2.3.0.45
Signed-off-by: Parvi Kaustubhi <pkaustub@cisco.com>
---
v2: no change in patch2
drivers/net/ethernet/cisco/enic/enic.h | 2 +-
drivers/net/ethernet/cisco/enic/enic_ethtool.c | 77 ++++++++++++++++++++++++++
2 files changed, 78 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index ba032ac..6a95270 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -33,7 +33,7 @@
#define DRV_NAME "enic"
#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
-#define DRV_VERSION "2.3.0.42"
+#define DRV_VERSION "2.3.0.45"
#define DRV_COPYRIGHT "Copyright 2008-2013 Cisco Systems, Inc"
#define ENIC_BARS_MAX 6
diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
index fd3980c..462d0ce 100644
--- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
+++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
@@ -176,6 +176,81 @@ static void enic_get_strings(struct net_device *netdev, u32 stringset,
}
}
+static void enic_get_ringparam(struct net_device *netdev,
+ struct ethtool_ringparam *ring)
+{
+ struct enic *enic = netdev_priv(netdev);
+ struct vnic_enet_config *c = &enic->config;
+
+ ring->rx_max_pending = ENIC_MAX_RQ_DESCS;
+ ring->rx_pending = c->rq_desc_count;
+ ring->tx_max_pending = ENIC_MAX_WQ_DESCS;
+ ring->tx_pending = c->wq_desc_count;
+}
+
+static int enic_set_ringparam(struct net_device *netdev,
+ struct ethtool_ringparam *ring)
+{
+ struct enic *enic = netdev_priv(netdev);
+ struct vnic_enet_config *c = &enic->config;
+ int running = netif_running(netdev);
+ unsigned int rx_pending;
+ unsigned int tx_pending;
+ int err = 0;
+
+ if (ring->rx_mini_max_pending || ring->rx_mini_pending) {
+ netdev_info(netdev,
+ "modifying mini ring params is not supported");
+ return -EINVAL;
+ }
+ if (ring->rx_jumbo_max_pending || ring->rx_jumbo_pending) {
+ netdev_info(netdev,
+ "modifying jumbo ring params is not supported");
+ return -EINVAL;
+ }
+ rx_pending = c->rq_desc_count;
+ tx_pending = c->wq_desc_count;
+ if (ring->rx_pending > ENIC_MAX_RQ_DESCS ||
+ ring->rx_pending < ENIC_MIN_RQ_DESCS) {
+ netdev_info(netdev, "rx pending (%u) not in range [%u,%u]",
+ ring->rx_pending, ENIC_MIN_RQ_DESCS,
+ ENIC_MAX_RQ_DESCS);
+ return -EINVAL;
+ }
+ if (ring->tx_pending > ENIC_MAX_WQ_DESCS ||
+ ring->tx_pending < ENIC_MIN_WQ_DESCS) {
+ netdev_info(netdev, "tx pending (%u) not in range [%u,%u]",
+ ring->tx_pending, ENIC_MIN_WQ_DESCS,
+ ENIC_MAX_WQ_DESCS);
+ return -EINVAL;
+ }
+ if (running)
+ dev_close(netdev);
+ c->rq_desc_count =
+ ring->rx_pending & 0xffffffe0; /* must be aligned to groups of 32 */
+ c->wq_desc_count =
+ ring->tx_pending & 0xffffffe0; /* must be aligned to groups of 32 */
+ enic_free_vnic_resources(enic);
+ err = enic_alloc_vnic_resources(enic);
+ if (err) {
+ netdev_err(netdev,
+ "Failed to alloc vNIC resources, aborting\n");
+ enic_free_vnic_resources(enic);
+ goto err_out;
+ }
+ enic_init_vnic_resources(enic);
+ if (running) {
+ err = dev_open(netdev);
+ if (err)
+ goto err_out;
+ }
+ return 0;
+err_out:
+ c->rq_desc_count = rx_pending;
+ c->wq_desc_count = tx_pending;
+ return err;
+}
+
static int enic_get_sset_count(struct net_device *netdev, int sset)
{
switch (sset) {
@@ -509,6 +584,8 @@ static int enic_set_rxfh(struct net_device *netdev, const u32 *indir,
.set_msglevel = enic_set_msglevel,
.get_link = ethtool_op_get_link,
.get_strings = enic_get_strings,
+ .get_ringparam = enic_get_ringparam,
+ .set_ringparam = enic_set_ringparam,
.get_sset_count = enic_get_sset_count,
.get_ethtool_stats = enic_get_ethtool_stats,
.get_coalesce = enic_get_coalesce,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v2 3/3] MAINTAINERS: update MAINTAINERS for cisco vic
2017-11-01 15:44 [PATCH net-next v2 0/3] enic: Additional ethtool support Parvi Kaustubhi
2017-11-01 15:44 ` [PATCH net-next v2 1/3] enic: reset fetch index Parvi Kaustubhi
2017-11-01 15:44 ` [PATCH net-next v2 2/3] enic: Add support for 'ethtool -g/-G' Parvi Kaustubhi
@ 2017-11-01 15:44 ` Parvi Kaustubhi
2017-11-02 5:17 ` [PATCH net-next v2 0/3] enic: Additional ethtool support David Miller
3 siblings, 0 replies; 6+ messages in thread
From: Parvi Kaustubhi @ 2017-11-01 15:44 UTC (permalink / raw)
To: netdev, davem; +Cc: gvaradar, benve, Parvi Kaustubhi
Add myself to list of maintainers for cisco vic ethernet nic driver. Remove
Neel as he left.
Signed-off-by: Parvi Kaustubhi <pkaustub@cisco.com>
---
v2: Add patch for updating maintainers for cisco vic ethernet nic driver.
MAINTAINERS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index e3a7ca9..14d9d11 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3420,7 +3420,7 @@ F: drivers/scsi/snic/
CISCO VIC ETHERNET NIC DRIVER
M: Christian Benvenuti <benve@cisco.com>
M: Govindarajulu Varadarajan <_govind@gmx.com>
-M: Neel Patel <neepatel@cisco.com>
+M: Parvi Kaustubhi <pkaustub@cisco.com>
S: Supported
F: drivers/net/ethernet/cisco/enic/
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v2 0/3] enic: Additional ethtool support
2017-11-01 15:44 [PATCH net-next v2 0/3] enic: Additional ethtool support Parvi Kaustubhi
` (2 preceding siblings ...)
2017-11-01 15:44 ` [PATCH net-next v2 3/3] MAINTAINERS: update MAINTAINERS for cisco vic Parvi Kaustubhi
@ 2017-11-02 5:17 ` David Miller
3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-11-02 5:17 UTC (permalink / raw)
To: pkaustub; +Cc: netdev, gvaradar, benve
From: Parvi Kaustubhi <pkaustub@cisco.com>
Date: Wed, 1 Nov 2017 08:44:45 -0700
> This patch set allows the user to show or modify rx/tx ring sizes using
> ethtool.
>
> v2:
> - remove unused variable to fix build warning.
> - update list of maintainers for cisco vic ethernet nic driver.
Series applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH net-next v2 1/3] enic: reset fetch index
2017-11-01 15:44 ` [PATCH net-next v2 1/3] enic: reset fetch index Parvi Kaustubhi
@ 2017-11-03 10:28 ` David Laight
0 siblings, 0 replies; 6+ messages in thread
From: David Laight @ 2017-11-03 10:28 UTC (permalink / raw)
To: 'Parvi Kaustubhi', netdev@vger.kernel.org,
davem@davemloft.net
Cc: gvaradar@cisco.com, benve@cisco.com
From: Parvi Kaustubhi
> Sent: 01 November 2017 15:45
> Since we are allowing rx ring size modification, reset fetch index
> everytime. Otherwise it could have a stale value that can lead to a null
> pointer dereference.
>
> Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
> Signed-off-by: Parvi Kaustubhi <pkaustub@cisco.com>
> ---
> v2: remove unused variable to fix build warning
>
> drivers/net/ethernet/cisco/enic/vnic_rq.c | 16 ++--------------
> 1 file changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/cisco/enic/vnic_rq.c b/drivers/net/ethernet/cisco/enic/vnic_rq.c
> index 36bc2c7..f8aa326 100644
> --- a/drivers/net/ethernet/cisco/enic/vnic_rq.c
> +++ b/drivers/net/ethernet/cisco/enic/vnic_rq.c
> @@ -139,20 +139,8 @@ void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index,
> unsigned int error_interrupt_enable,
> unsigned int error_interrupt_offset)
> {
> - u32 fetch_index = 0;
> -
> - /* Use current fetch_index as the ring starting point */
> - fetch_index = ioread32(&rq->ctrl->fetch_index);
> -
> - if (fetch_index == 0xFFFFFFFF) { /* check for hardware gone */
> - /* Hardware surprise removal: reset fetch_index */
> - fetch_index = 0;
> - }
> -
> - vnic_rq_init_start(rq, cq_index,
> - fetch_index, fetch_index,
> - error_interrupt_enable,
> - error_interrupt_offset);
> + vnic_rq_init_start(rq, cq_index, 0, 0, error_interrupt_enable,
> + error_interrupt_offset);
ISTM that the two '0' arguments can be removed.
David
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-03 10:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-01 15:44 [PATCH net-next v2 0/3] enic: Additional ethtool support Parvi Kaustubhi
2017-11-01 15:44 ` [PATCH net-next v2 1/3] enic: reset fetch index Parvi Kaustubhi
2017-11-03 10:28 ` David Laight
2017-11-01 15:44 ` [PATCH net-next v2 2/3] enic: Add support for 'ethtool -g/-G' Parvi Kaustubhi
2017-11-01 15:44 ` [PATCH net-next v2 3/3] MAINTAINERS: update MAINTAINERS for cisco vic Parvi Kaustubhi
2017-11-02 5:17 ` [PATCH net-next v2 0/3] enic: Additional ethtool support David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).