Commit 8edf049d authored by Sudarsana Kalluru's avatar Sudarsana Kalluru Committed by David S. Miller

qede: Add support for {get, set}_channels

Signed-off-by: default avatarSudarsana Kalluru <Sudarsana.Kalluru@qlogic.com>
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ee4db742
...@@ -116,6 +116,7 @@ struct qede_dev { ...@@ -116,6 +116,7 @@ struct qede_dev {
(edev)->dev_info.num_tc) (edev)->dev_info.num_tc)
struct qede_fastpath *fp_array; struct qede_fastpath *fp_array;
u16 req_rss;
u16 num_rss; u16 num_rss;
u8 num_tc; u8 num_tc;
#define QEDE_RSS_CNT(edev) ((edev)->num_rss) #define QEDE_RSS_CNT(edev) ((edev)->num_rss)
......
...@@ -366,6 +366,57 @@ int qede_change_mtu(struct net_device *ndev, int new_mtu) ...@@ -366,6 +366,57 @@ int qede_change_mtu(struct net_device *ndev, int new_mtu)
return 0; return 0;
} }
static void qede_get_channels(struct net_device *dev,
struct ethtool_channels *channels)
{
struct qede_dev *edev = netdev_priv(dev);
channels->max_combined = QEDE_MAX_RSS_CNT(edev);
channels->combined_count = QEDE_RSS_CNT(edev);
}
static int qede_set_channels(struct net_device *dev,
struct ethtool_channels *channels)
{
struct qede_dev *edev = netdev_priv(dev);
DP_VERBOSE(edev, (NETIF_MSG_IFUP | NETIF_MSG_IFDOWN),
"set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n",
channels->rx_count, channels->tx_count,
channels->other_count, channels->combined_count);
/* We don't support separate rx / tx, nor `other' channels. */
if (channels->rx_count || channels->tx_count ||
channels->other_count || (channels->combined_count == 0) ||
(channels->combined_count > QEDE_MAX_RSS_CNT(edev))) {
DP_VERBOSE(edev, (NETIF_MSG_IFUP | NETIF_MSG_IFDOWN),
"command parameters not supported\n");
return -EINVAL;
}
/* Check if there was a change in the active parameters */
if (channels->combined_count == QEDE_RSS_CNT(edev)) {
DP_VERBOSE(edev, (NETIF_MSG_IFUP | NETIF_MSG_IFDOWN),
"No change in active parameters\n");
return 0;
}
/* We need the number of queues to be divisible between the hwfns */
if (channels->combined_count % edev->dev_info.common.num_hwfns) {
DP_VERBOSE(edev, (NETIF_MSG_IFUP | NETIF_MSG_IFDOWN),
"Number of channels must be divisable by %04x\n",
edev->dev_info.common.num_hwfns);
return -EINVAL;
}
/* Set number of queues and reload if necessary */
edev->req_rss = channels->combined_count;
if (netif_running(dev))
qede_reload(edev, NULL, NULL);
return 0;
}
static const struct ethtool_ops qede_ethtool_ops = { static const struct ethtool_ops qede_ethtool_ops = {
.get_settings = qede_get_settings, .get_settings = qede_get_settings,
.set_settings = qede_set_settings, .set_settings = qede_set_settings,
...@@ -377,6 +428,8 @@ static const struct ethtool_ops qede_ethtool_ops = { ...@@ -377,6 +428,8 @@ static const struct ethtool_ops qede_ethtool_ops = {
.get_ethtool_stats = qede_get_ethtool_stats, .get_ethtool_stats = qede_get_ethtool_stats,
.get_sset_count = qede_get_sset_count, .get_sset_count = qede_get_sset_count,
.get_channels = qede_get_channels,
.set_channels = qede_set_channels,
}; };
void qede_set_ethtool_ops(struct net_device *dev) void qede_set_ethtool_ops(struct net_device *dev)
......
...@@ -1502,8 +1502,11 @@ static int qede_set_num_queues(struct qede_dev *edev) ...@@ -1502,8 +1502,11 @@ static int qede_set_num_queues(struct qede_dev *edev)
u16 rss_num; u16 rss_num;
/* Setup queues according to possible resources*/ /* Setup queues according to possible resources*/
rss_num = netif_get_num_default_rss_queues() * if (edev->req_rss)
edev->dev_info.common.num_hwfns; rss_num = edev->req_rss;
else
rss_num = netif_get_num_default_rss_queues() *
edev->dev_info.common.num_hwfns;
rss_num = min_t(u16, QEDE_MAX_RSS_CNT(edev), rss_num); rss_num = min_t(u16, QEDE_MAX_RSS_CNT(edev), rss_num);
......
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