Skip to content

Commit aeaf59b

Browse files
Dany Maddenkuba-moo
authored andcommitted
Revert "ibmvnic: Add ethtool private flag for driver-defined queue limits"
This reverts commit 723ad91 When client requests channel or ring size larger than what the server can support the server will cap the request to the supported max. So, the client would not be able to successfully request resources that exceed the server limit. Fixes: 723ad91 ("ibmvnic: Add ethtool private flag for driver-defined queue limits") Signed-off-by: Dany Madden <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 66a2f5e commit aeaf59b

File tree

2 files changed

+35
-100
lines changed

2 files changed

+35
-100
lines changed

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 35 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -3210,13 +3210,8 @@ static void ibmvnic_get_ringparam(struct net_device *netdev,
32103210
{
32113211
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
32123212

3213-
if (adapter->priv_flags & IBMVNIC_USE_SERVER_MAXES) {
3214-
ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq;
3215-
ring->tx_max_pending = adapter->max_tx_entries_per_subcrq;
3216-
} else {
3217-
ring->rx_max_pending = IBMVNIC_MAX_QUEUE_SZ;
3218-
ring->tx_max_pending = IBMVNIC_MAX_QUEUE_SZ;
3219-
}
3213+
ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq;
3214+
ring->tx_max_pending = adapter->max_tx_entries_per_subcrq;
32203215
ring->rx_mini_max_pending = 0;
32213216
ring->rx_jumbo_max_pending = 0;
32223217
ring->rx_pending = adapter->req_rx_add_entries_per_subcrq;
@@ -3231,38 +3226,30 @@ static int ibmvnic_set_ringparam(struct net_device *netdev,
32313226
struct netlink_ext_ack *extack)
32323227
{
32333228
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
3234-
int ret;
32353229

3236-
ret = 0;
3230+
if (ring->rx_pending > adapter->max_rx_add_entries_per_subcrq ||
3231+
ring->tx_pending > adapter->max_tx_entries_per_subcrq) {
3232+
netdev_err(netdev, "Invalid request.\n");
3233+
netdev_err(netdev, "Max tx buffers = %llu\n",
3234+
adapter->max_rx_add_entries_per_subcrq);
3235+
netdev_err(netdev, "Max rx buffers = %llu\n",
3236+
adapter->max_tx_entries_per_subcrq);
3237+
return -EINVAL;
3238+
}
3239+
32373240
adapter->desired.rx_entries = ring->rx_pending;
32383241
adapter->desired.tx_entries = ring->tx_pending;
32393242

3240-
ret = wait_for_reset(adapter);
3241-
3242-
if (!ret &&
3243-
(adapter->req_rx_add_entries_per_subcrq != ring->rx_pending ||
3244-
adapter->req_tx_entries_per_subcrq != ring->tx_pending))
3245-
netdev_info(netdev,
3246-
"Could not match full ringsize request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n",
3247-
ring->rx_pending, ring->tx_pending,
3248-
adapter->req_rx_add_entries_per_subcrq,
3249-
adapter->req_tx_entries_per_subcrq);
3250-
return ret;
3243+
return wait_for_reset(adapter);
32513244
}
32523245

32533246
static void ibmvnic_get_channels(struct net_device *netdev,
32543247
struct ethtool_channels *channels)
32553248
{
32563249
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
32573250

3258-
if (adapter->priv_flags & IBMVNIC_USE_SERVER_MAXES) {
3259-
channels->max_rx = adapter->max_rx_queues;
3260-
channels->max_tx = adapter->max_tx_queues;
3261-
} else {
3262-
channels->max_rx = IBMVNIC_MAX_QUEUES;
3263-
channels->max_tx = IBMVNIC_MAX_QUEUES;
3264-
}
3265-
3251+
channels->max_rx = adapter->max_rx_queues;
3252+
channels->max_tx = adapter->max_tx_queues;
32663253
channels->max_other = 0;
32673254
channels->max_combined = 0;
32683255
channels->rx_count = adapter->req_rx_queues;
@@ -3275,66 +3262,44 @@ static int ibmvnic_set_channels(struct net_device *netdev,
32753262
struct ethtool_channels *channels)
32763263
{
32773264
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
3278-
int ret;
32793265

3280-
ret = 0;
32813266
adapter->desired.rx_queues = channels->rx_count;
32823267
adapter->desired.tx_queues = channels->tx_count;
32833268

3284-
ret = wait_for_reset(adapter);
3285-
3286-
if (!ret &&
3287-
(adapter->req_rx_queues != channels->rx_count ||
3288-
adapter->req_tx_queues != channels->tx_count))
3289-
netdev_info(netdev,
3290-
"Could not match full channels request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n",
3291-
channels->rx_count, channels->tx_count,
3292-
adapter->req_rx_queues, adapter->req_tx_queues);
3293-
return ret;
3269+
return wait_for_reset(adapter);
32943270
}
32953271

32963272
static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data)
32973273
{
32983274
struct ibmvnic_adapter *adapter = netdev_priv(dev);
32993275
int i;
33003276

3301-
switch (stringset) {
3302-
case ETH_SS_STATS:
3303-
for (i = 0; i < ARRAY_SIZE(ibmvnic_stats);
3304-
i++, data += ETH_GSTRING_LEN)
3305-
memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN);
3277+
if (stringset != ETH_SS_STATS)
3278+
return;
33063279

3307-
for (i = 0; i < adapter->req_tx_queues; i++) {
3308-
snprintf(data, ETH_GSTRING_LEN, "tx%d_packets", i);
3309-
data += ETH_GSTRING_LEN;
3280+
for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++, data += ETH_GSTRING_LEN)
3281+
memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN);
33103282

3311-
snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i);
3312-
data += ETH_GSTRING_LEN;
3283+
for (i = 0; i < adapter->req_tx_queues; i++) {
3284+
snprintf(data, ETH_GSTRING_LEN, "tx%d_packets", i);
3285+
data += ETH_GSTRING_LEN;
33133286

3314-
snprintf(data, ETH_GSTRING_LEN,
3315-
"tx%d_dropped_packets", i);
3316-
data += ETH_GSTRING_LEN;
3317-
}
3287+
snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i);
3288+
data += ETH_GSTRING_LEN;
33183289

3319-
for (i = 0; i < adapter->req_rx_queues; i++) {
3320-
snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i);
3321-
data += ETH_GSTRING_LEN;
3290+
snprintf(data, ETH_GSTRING_LEN, "tx%d_dropped_packets", i);
3291+
data += ETH_GSTRING_LEN;
3292+
}
33223293

3323-
snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i);
3324-
data += ETH_GSTRING_LEN;
3294+
for (i = 0; i < adapter->req_rx_queues; i++) {
3295+
snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i);
3296+
data += ETH_GSTRING_LEN;
33253297

3326-
snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i);
3327-
data += ETH_GSTRING_LEN;
3328-
}
3329-
break;
3298+
snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i);
3299+
data += ETH_GSTRING_LEN;
33303300

3331-
case ETH_SS_PRIV_FLAGS:
3332-
for (i = 0; i < ARRAY_SIZE(ibmvnic_priv_flags); i++)
3333-
strcpy(data + i * ETH_GSTRING_LEN,
3334-
ibmvnic_priv_flags[i]);
3335-
break;
3336-
default:
3337-
return;
3301+
snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i);
3302+
data += ETH_GSTRING_LEN;
33383303
}
33393304
}
33403305

@@ -3347,8 +3312,6 @@ static int ibmvnic_get_sset_count(struct net_device *dev, int sset)
33473312
return ARRAY_SIZE(ibmvnic_stats) +
33483313
adapter->req_tx_queues * NUM_TX_STATS +
33493314
adapter->req_rx_queues * NUM_RX_STATS;
3350-
case ETH_SS_PRIV_FLAGS:
3351-
return ARRAY_SIZE(ibmvnic_priv_flags);
33523315
default:
33533316
return -EOPNOTSUPP;
33543317
}
@@ -3401,26 +3364,6 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev,
34013364
}
34023365
}
34033366

3404-
static u32 ibmvnic_get_priv_flags(struct net_device *netdev)
3405-
{
3406-
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
3407-
3408-
return adapter->priv_flags;
3409-
}
3410-
3411-
static int ibmvnic_set_priv_flags(struct net_device *netdev, u32 flags)
3412-
{
3413-
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
3414-
bool which_maxes = !!(flags & IBMVNIC_USE_SERVER_MAXES);
3415-
3416-
if (which_maxes)
3417-
adapter->priv_flags |= IBMVNIC_USE_SERVER_MAXES;
3418-
else
3419-
adapter->priv_flags &= ~IBMVNIC_USE_SERVER_MAXES;
3420-
3421-
return 0;
3422-
}
3423-
34243367
static const struct ethtool_ops ibmvnic_ethtool_ops = {
34253368
.get_drvinfo = ibmvnic_get_drvinfo,
34263369
.get_msglevel = ibmvnic_get_msglevel,
@@ -3434,8 +3377,6 @@ static const struct ethtool_ops ibmvnic_ethtool_ops = {
34343377
.get_sset_count = ibmvnic_get_sset_count,
34353378
.get_ethtool_stats = ibmvnic_get_ethtool_stats,
34363379
.get_link_ksettings = ibmvnic_get_link_ksettings,
3437-
.get_priv_flags = ibmvnic_get_priv_flags,
3438-
.set_priv_flags = ibmvnic_set_priv_flags,
34393380
};
34403381

34413382
/* Routines for managing CRQs/sCRQs */

drivers/net/ethernet/ibm/ibmvnic.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@
4141

4242
#define IBMVNIC_RESET_DELAY 100
4343

44-
static const char ibmvnic_priv_flags[][ETH_GSTRING_LEN] = {
45-
#define IBMVNIC_USE_SERVER_MAXES 0x1
46-
"use-server-maxes"
47-
};
48-
4944
struct ibmvnic_login_buffer {
5045
__be32 len;
5146
__be32 version;
@@ -883,7 +878,6 @@ struct ibmvnic_adapter {
883878
struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl;
884879
dma_addr_t ip_offload_ctrl_tok;
885880
u32 msg_enable;
886-
u32 priv_flags;
887881

888882
/* Vital Product Data (VPD) */
889883
struct ibmvnic_vpd *vpd;

0 commit comments

Comments
 (0)