1 |
From 9430a32721724cf7909970408c0213cb19278317 Mon Sep 17 00:00:00 2001 |
2 |
From: Bruce Allan <bruce.w.allan@intel.com> |
3 |
Date: Wed, 19 Sep 2018 17:23:11 -0700 |
4 |
Subject: [PATCH 042/145] ice: fix changing of ring descriptor size (ethtool |
5 |
-G) |
6 |
|
7 |
[ Upstream commit f934bb9b8b6136edd261b2dc2c9ad4dbc39ffc66 ] |
8 |
|
9 |
rx_mini_pending was set to an incorrect value. This was causing EINVAL to |
10 |
always be returned to 'ethtool -G'. The driver does not support mini or |
11 |
jumbo rings so the respective settings should be zero. |
12 |
|
13 |
Also, change the valid range of the number of descriptors in the rings to |
14 |
make the code simpler and easier for users to understand (this removes the |
15 |
valid settings of 8 and 16). Add a system log message indicating when the |
16 |
number is rounded-up from what the user specifies with the 'ethtool -G' |
17 |
command (i.e. when it is not a multiple of 32), and update the log message |
18 |
when a user-provided value is out of range to also indicate the stride. |
19 |
|
20 |
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> |
21 |
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> |
22 |
Tested-by: Andrew Bowers <andrewx.bowers@intel.com> |
23 |
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> |
24 |
Signed-off-by: Sasha Levin <sashal@kernel.org> |
25 |
--- |
26 |
drivers/net/ethernet/intel/ice/ice.h | 4 ++-- |
27 |
drivers/net/ethernet/intel/ice/ice_ethtool.c | 17 ++++++++++++++--- |
28 |
2 files changed, 16 insertions(+), 5 deletions(-) |
29 |
|
30 |
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h |
31 |
index 868f4a1d0f72..67591722c625 100644 |
32 |
--- a/drivers/net/ethernet/intel/ice/ice.h |
33 |
+++ b/drivers/net/ethernet/intel/ice/ice.h |
34 |
@@ -39,9 +39,9 @@ |
35 |
extern const char ice_drv_ver[]; |
36 |
#define ICE_BAR0 0 |
37 |
#define ICE_DFLT_NUM_DESC 128 |
38 |
-#define ICE_MIN_NUM_DESC 8 |
39 |
-#define ICE_MAX_NUM_DESC 8160 |
40 |
#define ICE_REQ_DESC_MULTIPLE 32 |
41 |
+#define ICE_MIN_NUM_DESC ICE_REQ_DESC_MULTIPLE |
42 |
+#define ICE_MAX_NUM_DESC 8160 |
43 |
#define ICE_DFLT_TRAFFIC_CLASS BIT(0) |
44 |
#define ICE_INT_NAME_STR_LEN (IFNAMSIZ + 16) |
45 |
#define ICE_ETHTOOL_FWVER_LEN 32 |
46 |
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c |
47 |
index c71a9b528d6d..9d6754f65a1a 100644 |
48 |
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c |
49 |
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c |
50 |
@@ -478,9 +478,11 @@ ice_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) |
51 |
ring->tx_max_pending = ICE_MAX_NUM_DESC; |
52 |
ring->rx_pending = vsi->rx_rings[0]->count; |
53 |
ring->tx_pending = vsi->tx_rings[0]->count; |
54 |
- ring->rx_mini_pending = ICE_MIN_NUM_DESC; |
55 |
+ |
56 |
+ /* Rx mini and jumbo rings are not supported */ |
57 |
ring->rx_mini_max_pending = 0; |
58 |
ring->rx_jumbo_max_pending = 0; |
59 |
+ ring->rx_mini_pending = 0; |
60 |
ring->rx_jumbo_pending = 0; |
61 |
} |
62 |
|
63 |
@@ -498,14 +500,23 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) |
64 |
ring->tx_pending < ICE_MIN_NUM_DESC || |
65 |
ring->rx_pending > ICE_MAX_NUM_DESC || |
66 |
ring->rx_pending < ICE_MIN_NUM_DESC) { |
67 |
- netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n", |
68 |
+ netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d] (increment %d)\n", |
69 |
ring->tx_pending, ring->rx_pending, |
70 |
- ICE_MIN_NUM_DESC, ICE_MAX_NUM_DESC); |
71 |
+ ICE_MIN_NUM_DESC, ICE_MAX_NUM_DESC, |
72 |
+ ICE_REQ_DESC_MULTIPLE); |
73 |
return -EINVAL; |
74 |
} |
75 |
|
76 |
new_tx_cnt = ALIGN(ring->tx_pending, ICE_REQ_DESC_MULTIPLE); |
77 |
+ if (new_tx_cnt != ring->tx_pending) |
78 |
+ netdev_info(netdev, |
79 |
+ "Requested Tx descriptor count rounded up to %d\n", |
80 |
+ new_tx_cnt); |
81 |
new_rx_cnt = ALIGN(ring->rx_pending, ICE_REQ_DESC_MULTIPLE); |
82 |
+ if (new_rx_cnt != ring->rx_pending) |
83 |
+ netdev_info(netdev, |
84 |
+ "Requested Rx descriptor count rounded up to %d\n", |
85 |
+ new_rx_cnt); |
86 |
|
87 |
/* if nothing to do return success */ |
88 |
if (new_tx_cnt == vsi->tx_rings[0]->count && |
89 |
-- |
90 |
2.19.1 |
91 |
|