Commit aeaf59b7 authored by Dany Madden's avatar Dany Madden Committed by Jakub Kicinski

Revert "ibmvnic: Add ethtool private flag for driver-defined queue limits"

This reverts commit 723ad916

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: 723ad916 ("ibmvnic: Add ethtool private flag for driver-defined queue limits")
Signed-off-by: default avatarDany Madden <drt@linux.ibm.com>
Link: https://lore.kernel.org/r/20220427235146.23189-1-drt@linux.ibm.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 66a2f5ef
...@@ -3210,13 +3210,8 @@ static void ibmvnic_get_ringparam(struct net_device *netdev, ...@@ -3210,13 +3210,8 @@ static void ibmvnic_get_ringparam(struct net_device *netdev,
{ {
struct ibmvnic_adapter *adapter = netdev_priv(netdev); struct ibmvnic_adapter *adapter = netdev_priv(netdev);
if (adapter->priv_flags & IBMVNIC_USE_SERVER_MAXES) { ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq;
ring->rx_max_pending = adapter->max_rx_add_entries_per_subcrq; ring->tx_max_pending = adapter->max_tx_entries_per_subcrq;
ring->tx_max_pending = adapter->max_tx_entries_per_subcrq;
} else {
ring->rx_max_pending = IBMVNIC_MAX_QUEUE_SZ;
ring->tx_max_pending = IBMVNIC_MAX_QUEUE_SZ;
}
ring->rx_mini_max_pending = 0; ring->rx_mini_max_pending = 0;
ring->rx_jumbo_max_pending = 0; ring->rx_jumbo_max_pending = 0;
ring->rx_pending = adapter->req_rx_add_entries_per_subcrq; ring->rx_pending = adapter->req_rx_add_entries_per_subcrq;
...@@ -3231,23 +3226,21 @@ static int ibmvnic_set_ringparam(struct net_device *netdev, ...@@ -3231,23 +3226,21 @@ static int ibmvnic_set_ringparam(struct net_device *netdev,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
struct ibmvnic_adapter *adapter = netdev_priv(netdev); struct ibmvnic_adapter *adapter = netdev_priv(netdev);
int ret;
ret = 0; if (ring->rx_pending > adapter->max_rx_add_entries_per_subcrq ||
ring->tx_pending > adapter->max_tx_entries_per_subcrq) {
netdev_err(netdev, "Invalid request.\n");
netdev_err(netdev, "Max tx buffers = %llu\n",
adapter->max_rx_add_entries_per_subcrq);
netdev_err(netdev, "Max rx buffers = %llu\n",
adapter->max_tx_entries_per_subcrq);
return -EINVAL;
}
adapter->desired.rx_entries = ring->rx_pending; adapter->desired.rx_entries = ring->rx_pending;
adapter->desired.tx_entries = ring->tx_pending; adapter->desired.tx_entries = ring->tx_pending;
ret = wait_for_reset(adapter); return wait_for_reset(adapter);
if (!ret &&
(adapter->req_rx_add_entries_per_subcrq != ring->rx_pending ||
adapter->req_tx_entries_per_subcrq != ring->tx_pending))
netdev_info(netdev,
"Could not match full ringsize request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n",
ring->rx_pending, ring->tx_pending,
adapter->req_rx_add_entries_per_subcrq,
adapter->req_tx_entries_per_subcrq);
return ret;
} }
static void ibmvnic_get_channels(struct net_device *netdev, static void ibmvnic_get_channels(struct net_device *netdev,
...@@ -3255,14 +3248,8 @@ static void ibmvnic_get_channels(struct net_device *netdev, ...@@ -3255,14 +3248,8 @@ static void ibmvnic_get_channels(struct net_device *netdev,
{ {
struct ibmvnic_adapter *adapter = netdev_priv(netdev); struct ibmvnic_adapter *adapter = netdev_priv(netdev);
if (adapter->priv_flags & IBMVNIC_USE_SERVER_MAXES) { channels->max_rx = adapter->max_rx_queues;
channels->max_rx = adapter->max_rx_queues; channels->max_tx = adapter->max_tx_queues;
channels->max_tx = adapter->max_tx_queues;
} else {
channels->max_rx = IBMVNIC_MAX_QUEUES;
channels->max_tx = IBMVNIC_MAX_QUEUES;
}
channels->max_other = 0; channels->max_other = 0;
channels->max_combined = 0; channels->max_combined = 0;
channels->rx_count = adapter->req_rx_queues; channels->rx_count = adapter->req_rx_queues;
...@@ -3275,22 +3262,11 @@ static int ibmvnic_set_channels(struct net_device *netdev, ...@@ -3275,22 +3262,11 @@ static int ibmvnic_set_channels(struct net_device *netdev,
struct ethtool_channels *channels) struct ethtool_channels *channels)
{ {
struct ibmvnic_adapter *adapter = netdev_priv(netdev); struct ibmvnic_adapter *adapter = netdev_priv(netdev);
int ret;
ret = 0;
adapter->desired.rx_queues = channels->rx_count; adapter->desired.rx_queues = channels->rx_count;
adapter->desired.tx_queues = channels->tx_count; adapter->desired.tx_queues = channels->tx_count;
ret = wait_for_reset(adapter); return wait_for_reset(adapter);
if (!ret &&
(adapter->req_rx_queues != channels->rx_count ||
adapter->req_tx_queues != channels->tx_count))
netdev_info(netdev,
"Could not match full channels request. Requested: RX %d, TX %d; Allowed: RX %llu, TX %llu\n",
channels->rx_count, channels->tx_count,
adapter->req_rx_queues, adapter->req_tx_queues);
return ret;
} }
static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data) static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data)
...@@ -3298,43 +3274,32 @@ static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data) ...@@ -3298,43 +3274,32 @@ static void ibmvnic_get_strings(struct net_device *dev, u32 stringset, u8 *data)
struct ibmvnic_adapter *adapter = netdev_priv(dev); struct ibmvnic_adapter *adapter = netdev_priv(dev);
int i; int i;
switch (stringset) { if (stringset != ETH_SS_STATS)
case ETH_SS_STATS: return;
for (i = 0; i < ARRAY_SIZE(ibmvnic_stats);
i++, data += ETH_GSTRING_LEN)
memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN);
for (i = 0; i < adapter->req_tx_queues; i++) { for (i = 0; i < ARRAY_SIZE(ibmvnic_stats); i++, data += ETH_GSTRING_LEN)
snprintf(data, ETH_GSTRING_LEN, "tx%d_packets", i); memcpy(data, ibmvnic_stats[i].name, ETH_GSTRING_LEN);
data += ETH_GSTRING_LEN;
snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i); for (i = 0; i < adapter->req_tx_queues; i++) {
data += ETH_GSTRING_LEN; snprintf(data, ETH_GSTRING_LEN, "tx%d_packets", i);
data += ETH_GSTRING_LEN;
snprintf(data, ETH_GSTRING_LEN, snprintf(data, ETH_GSTRING_LEN, "tx%d_bytes", i);
"tx%d_dropped_packets", i); data += ETH_GSTRING_LEN;
data += ETH_GSTRING_LEN;
}
for (i = 0; i < adapter->req_rx_queues; i++) { snprintf(data, ETH_GSTRING_LEN, "tx%d_dropped_packets", i);
snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i); data += ETH_GSTRING_LEN;
data += ETH_GSTRING_LEN; }
snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i); for (i = 0; i < adapter->req_rx_queues; i++) {
data += ETH_GSTRING_LEN; snprintf(data, ETH_GSTRING_LEN, "rx%d_packets", i);
data += ETH_GSTRING_LEN;
snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i); snprintf(data, ETH_GSTRING_LEN, "rx%d_bytes", i);
data += ETH_GSTRING_LEN; data += ETH_GSTRING_LEN;
}
break;
case ETH_SS_PRIV_FLAGS: snprintf(data, ETH_GSTRING_LEN, "rx%d_interrupts", i);
for (i = 0; i < ARRAY_SIZE(ibmvnic_priv_flags); i++) data += ETH_GSTRING_LEN;
strcpy(data + i * ETH_GSTRING_LEN,
ibmvnic_priv_flags[i]);
break;
default:
return;
} }
} }
...@@ -3347,8 +3312,6 @@ static int ibmvnic_get_sset_count(struct net_device *dev, int sset) ...@@ -3347,8 +3312,6 @@ static int ibmvnic_get_sset_count(struct net_device *dev, int sset)
return ARRAY_SIZE(ibmvnic_stats) + return ARRAY_SIZE(ibmvnic_stats) +
adapter->req_tx_queues * NUM_TX_STATS + adapter->req_tx_queues * NUM_TX_STATS +
adapter->req_rx_queues * NUM_RX_STATS; adapter->req_rx_queues * NUM_RX_STATS;
case ETH_SS_PRIV_FLAGS:
return ARRAY_SIZE(ibmvnic_priv_flags);
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -3401,26 +3364,6 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev, ...@@ -3401,26 +3364,6 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev,
} }
} }
static u32 ibmvnic_get_priv_flags(struct net_device *netdev)
{
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
return adapter->priv_flags;
}
static int ibmvnic_set_priv_flags(struct net_device *netdev, u32 flags)
{
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
bool which_maxes = !!(flags & IBMVNIC_USE_SERVER_MAXES);
if (which_maxes)
adapter->priv_flags |= IBMVNIC_USE_SERVER_MAXES;
else
adapter->priv_flags &= ~IBMVNIC_USE_SERVER_MAXES;
return 0;
}
static const struct ethtool_ops ibmvnic_ethtool_ops = { static const struct ethtool_ops ibmvnic_ethtool_ops = {
.get_drvinfo = ibmvnic_get_drvinfo, .get_drvinfo = ibmvnic_get_drvinfo,
.get_msglevel = ibmvnic_get_msglevel, .get_msglevel = ibmvnic_get_msglevel,
...@@ -3434,8 +3377,6 @@ static const struct ethtool_ops ibmvnic_ethtool_ops = { ...@@ -3434,8 +3377,6 @@ static const struct ethtool_ops ibmvnic_ethtool_ops = {
.get_sset_count = ibmvnic_get_sset_count, .get_sset_count = ibmvnic_get_sset_count,
.get_ethtool_stats = ibmvnic_get_ethtool_stats, .get_ethtool_stats = ibmvnic_get_ethtool_stats,
.get_link_ksettings = ibmvnic_get_link_ksettings, .get_link_ksettings = ibmvnic_get_link_ksettings,
.get_priv_flags = ibmvnic_get_priv_flags,
.set_priv_flags = ibmvnic_set_priv_flags,
}; };
/* Routines for managing CRQs/sCRQs */ /* Routines for managing CRQs/sCRQs */
......
...@@ -41,11 +41,6 @@ ...@@ -41,11 +41,6 @@
#define IBMVNIC_RESET_DELAY 100 #define IBMVNIC_RESET_DELAY 100
static const char ibmvnic_priv_flags[][ETH_GSTRING_LEN] = {
#define IBMVNIC_USE_SERVER_MAXES 0x1
"use-server-maxes"
};
struct ibmvnic_login_buffer { struct ibmvnic_login_buffer {
__be32 len; __be32 len;
__be32 version; __be32 version;
...@@ -883,7 +878,6 @@ struct ibmvnic_adapter { ...@@ -883,7 +878,6 @@ struct ibmvnic_adapter {
struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl; struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl;
dma_addr_t ip_offload_ctrl_tok; dma_addr_t ip_offload_ctrl_tok;
u32 msg_enable; u32 msg_enable;
u32 priv_flags;
/* Vital Product Data (VPD) */ /* Vital Product Data (VPD) */
struct ibmvnic_vpd *vpd; struct ibmvnic_vpd *vpd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment