aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2014-05-30 03:31:07 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-02 19:01:30 -0400
commite368d27ff007f7405cf668679f48ab3174a53922 (patch)
tree4e36ea6a5988393c8e5bdb56e5c36665bdcd3b38 /drivers/net/usb
parent289507d3364f96f4b8814726917d572f71350d87 (diff)
net: cdc_ncm: drop ethtool coalesce support
The ethtool coalesce API is not applicable for this driver. Forcing it to fit the NCM aggregation redefined the API in a driver specific way, which is much worse than defining a clean new API. These ethtool coalesce functions have therefore been replaced by a new sysfs API. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/cdc_ncm.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 631741c8ff22..aaa440d892b8 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -127,54 +127,8 @@ static void cdc_ncm_get_strings(struct net_device __always_unused *netdev, u32 s
127 } 127 }
128} 128}
129 129
130static int cdc_ncm_get_coalesce(struct net_device *netdev,
131 struct ethtool_coalesce *ec)
132{
133 struct usbnet *dev = netdev_priv(netdev);
134 struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
135
136 /* assuming maximum sized dgrams and ignoring NDPs */
137 ec->rx_max_coalesced_frames = ctx->rx_max / ctx->max_datagram_size;
138 ec->tx_max_coalesced_frames = ctx->tx_max / ctx->max_datagram_size;
139
140 /* the timer will fire CDC_NCM_TIMER_PENDING_CNT times in a row */
141 ec->tx_coalesce_usecs = ctx->timer_interval / (NSEC_PER_USEC / CDC_NCM_TIMER_PENDING_CNT);
142 return 0;
143}
144
145static void cdc_ncm_update_rxtx_max(struct usbnet *dev, u32 new_rx, u32 new_tx); 130static void cdc_ncm_update_rxtx_max(struct usbnet *dev, u32 new_rx, u32 new_tx);
146 131
147static int cdc_ncm_set_coalesce(struct net_device *netdev,
148 struct ethtool_coalesce *ec)
149{
150 struct usbnet *dev = netdev_priv(netdev);
151 struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
152 u32 new_rx_max = ctx->rx_max;
153 u32 new_tx_max = ctx->tx_max;
154
155 /* assuming maximum sized dgrams and a single NDP */
156 if (ec->rx_max_coalesced_frames)
157 new_rx_max = ec->rx_max_coalesced_frames * ctx->max_datagram_size;
158 if (ec->tx_max_coalesced_frames)
159 new_tx_max = ec->tx_max_coalesced_frames * ctx->max_datagram_size;
160
161 if (ec->tx_coalesce_usecs &&
162 (ec->tx_coalesce_usecs < CDC_NCM_TIMER_INTERVAL_MIN * CDC_NCM_TIMER_PENDING_CNT ||
163 ec->tx_coalesce_usecs > CDC_NCM_TIMER_INTERVAL_MAX * CDC_NCM_TIMER_PENDING_CNT))
164 return -EINVAL;
165
166 spin_lock_bh(&ctx->mtx);
167 ctx->timer_interval = ec->tx_coalesce_usecs * (NSEC_PER_USEC / CDC_NCM_TIMER_PENDING_CNT);
168 if (!ctx->timer_interval)
169 ctx->tx_timer_pending = 0;
170 spin_unlock_bh(&ctx->mtx);
171
172 /* inform device of new values */
173 if (new_rx_max != ctx->rx_max || new_tx_max != ctx->tx_max)
174 cdc_ncm_update_rxtx_max(dev, new_rx_max, new_tx_max);
175 return 0;
176}
177
178static const struct ethtool_ops cdc_ncm_ethtool_ops = { 132static const struct ethtool_ops cdc_ncm_ethtool_ops = {
179 .get_settings = usbnet_get_settings, 133 .get_settings = usbnet_get_settings,
180 .set_settings = usbnet_set_settings, 134 .set_settings = usbnet_set_settings,
@@ -187,8 +141,6 @@ static const struct ethtool_ops cdc_ncm_ethtool_ops = {
187 .get_sset_count = cdc_ncm_get_sset_count, 141 .get_sset_count = cdc_ncm_get_sset_count,
188 .get_strings = cdc_ncm_get_strings, 142 .get_strings = cdc_ncm_get_strings,
189 .get_ethtool_stats = cdc_ncm_get_ethtool_stats, 143 .get_ethtool_stats = cdc_ncm_get_ethtool_stats,
190 .get_coalesce = cdc_ncm_get_coalesce,
191 .set_coalesce = cdc_ncm_set_coalesce,
192}; 144};
193 145
194static u32 cdc_ncm_check_rx_max(struct usbnet *dev, u32 new_rx) 146static u32 cdc_ncm_check_rx_max(struct usbnet *dev, u32 new_rx)