Skip to content

Commit f934bb9

Browse files
bwallanJeff Kirsher
authored andcommitted
ice: fix changing of ring descriptor size (ethtool -G)
rx_mini_pending was set to an incorrect value. This was causing EINVAL to always be returned to 'ethtool -G'. The driver does not support mini or jumbo rings so the respective settings should be zero. Also, change the valid range of the number of descriptors in the rings to make the code simpler and easier for users to understand (this removes the valid settings of 8 and 16). Add a system log message indicating when the number is rounded-up from what the user specifies with the 'ethtool -G' command (i.e. when it is not a multiple of 32), and update the log message when a user-provided value is out of range to also indicate the stride. Signed-off-by: Bruce Allan <[email protected]> Signed-off-by: Anirudh Venkataramanan <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 32f13d0 commit f934bb9

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
extern const char ice_drv_ver[];
4040
#define ICE_BAR0 0
4141
#define ICE_DFLT_NUM_DESC 128
42-
#define ICE_MIN_NUM_DESC 8
43-
#define ICE_MAX_NUM_DESC 8160
4442
#define ICE_REQ_DESC_MULTIPLE 32
43+
#define ICE_MIN_NUM_DESC ICE_REQ_DESC_MULTIPLE
44+
#define ICE_MAX_NUM_DESC 8160
4545
#define ICE_DFLT_TRAFFIC_CLASS BIT(0)
4646
#define ICE_INT_NAME_STR_LEN (IFNAMSIZ + 16)
4747
#define ICE_ETHTOOL_FWVER_LEN 32

drivers/net/ethernet/intel/ice/ice_ethtool.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,9 +1198,11 @@ ice_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
11981198
ring->tx_max_pending = ICE_MAX_NUM_DESC;
11991199
ring->rx_pending = vsi->rx_rings[0]->count;
12001200
ring->tx_pending = vsi->tx_rings[0]->count;
1201-
ring->rx_mini_pending = ICE_MIN_NUM_DESC;
1201+
1202+
/* Rx mini and jumbo rings are not supported */
12021203
ring->rx_mini_max_pending = 0;
12031204
ring->rx_jumbo_max_pending = 0;
1205+
ring->rx_mini_pending = 0;
12041206
ring->rx_jumbo_pending = 0;
12051207
}
12061208

@@ -1218,14 +1220,23 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
12181220
ring->tx_pending < ICE_MIN_NUM_DESC ||
12191221
ring->rx_pending > ICE_MAX_NUM_DESC ||
12201222
ring->rx_pending < ICE_MIN_NUM_DESC) {
1221-
netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n",
1223+
netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d] (increment %d)\n",
12221224
ring->tx_pending, ring->rx_pending,
1223-
ICE_MIN_NUM_DESC, ICE_MAX_NUM_DESC);
1225+
ICE_MIN_NUM_DESC, ICE_MAX_NUM_DESC,
1226+
ICE_REQ_DESC_MULTIPLE);
12241227
return -EINVAL;
12251228
}
12261229

12271230
new_tx_cnt = ALIGN(ring->tx_pending, ICE_REQ_DESC_MULTIPLE);
1231+
if (new_tx_cnt != ring->tx_pending)
1232+
netdev_info(netdev,
1233+
"Requested Tx descriptor count rounded up to %d\n",
1234+
new_tx_cnt);
12281235
new_rx_cnt = ALIGN(ring->rx_pending, ICE_REQ_DESC_MULTIPLE);
1236+
if (new_rx_cnt != ring->rx_pending)
1237+
netdev_info(netdev,
1238+
"Requested Rx descriptor count rounded up to %d\n",
1239+
new_rx_cnt);
12291240

12301241
/* if nothing to do return success */
12311242
if (new_tx_cnt == vsi->tx_rings[0]->count &&

0 commit comments

Comments
 (0)