Skip to content

Commit 038b940

Browse files
Timur Tabidavem330
authored andcommitted
net: qcom/emac: add ethtool support for setting ring parameters
Implement the set_ringparam method, which allows the user to specify the size of the TX and RX descriptor rings. The values are constrained to the limits of the hardware. Since the driver does not use separate queues for mini or jumbo frames, attempts to set those values are rejected. If the interface is already running when the setting is changed, then the interface is reset. Signed-off-by: Timur Tabi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c4e7bee commit 038b940

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/net/ethernet/qualcomm/emac/emac-ethtool.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,29 @@ static void emac_get_ringparam(struct net_device *netdev,
145145
ring->tx_pending = adpt->tx_desc_cnt;
146146
}
147147

148+
static int emac_set_ringparam(struct net_device *netdev,
149+
struct ethtool_ringparam *ring)
150+
{
151+
struct emac_adapter *adpt = netdev_priv(netdev);
152+
153+
/* We don't have separate queues/rings for small/large frames, so
154+
* reject any attempt to specify those values separately.
155+
*/
156+
if (ring->rx_mini_pending || ring->rx_jumbo_pending)
157+
return -EINVAL;
158+
159+
adpt->tx_desc_cnt =
160+
clamp_val(ring->tx_pending, EMAC_MIN_TX_DESCS, EMAC_MAX_TX_DESCS);
161+
162+
adpt->rx_desc_cnt =
163+
clamp_val(ring->rx_pending, EMAC_MIN_RX_DESCS, EMAC_MAX_RX_DESCS);
164+
165+
if (netif_running(netdev))
166+
return emac_reinit_locked(adpt);
167+
168+
return 0;
169+
}
170+
148171
static void emac_get_pauseparam(struct net_device *netdev,
149172
struct ethtool_pauseparam *pause)
150173
{
@@ -219,6 +242,7 @@ static const struct ethtool_ops emac_ethtool_ops = {
219242
.get_ethtool_stats = emac_get_ethtool_stats,
220243

221244
.get_ringparam = emac_get_ringparam,
245+
.set_ringparam = emac_set_ringparam,
222246

223247
.get_pauseparam = emac_get_pauseparam,
224248
.set_pauseparam = emac_set_pauseparam,

0 commit comments

Comments
 (0)