| 1 |
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later |
| 2 |
/* |
| 3 |
* Copyright 2008 - 2016 Freescale Semiconductor Inc. |
| 4 |
*/ |
| 5 |
|
| 6 |
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 7 |
|
| 8 |
#include <linux/string.h> |
| 9 |
#include <linux/of.h> |
| 10 |
#include <linux/of_platform.h> |
| 11 |
#include <linux/platform_device.h> |
| 12 |
#include <linux/net_tstamp.h> |
| 13 |
#include <linux/fsl/ptp_qoriq.h> |
| 14 |
|
| 15 |
#include "dpaa_eth.h" |
| 16 |
#include "mac.h" |
| 17 |
|
| 18 |
static const char dpaa_stats_percpu[][ETH_GSTRING_LEN] = { |
| 19 |
"interrupts", |
| 20 |
"rx packets", |
| 21 |
"tx packets", |
| 22 |
"tx confirm", |
| 23 |
"tx S/G", |
| 24 |
"tx error", |
| 25 |
"rx error", |
| 26 |
"rx dropped", |
| 27 |
"tx dropped", |
| 28 |
}; |
| 29 |
|
| 30 |
static char dpaa_stats_global[][ETH_GSTRING_LEN] = { |
| 31 |
/* dpa rx errors */ |
| 32 |
"rx dma error", |
| 33 |
"rx frame physical error", |
| 34 |
"rx frame size error", |
| 35 |
"rx header error", |
| 36 |
|
| 37 |
/* demultiplexing errors */ |
| 38 |
"qman cg_tdrop", |
| 39 |
"qman wred", |
| 40 |
"qman error cond", |
| 41 |
"qman early window", |
| 42 |
"qman late window", |
| 43 |
"qman fq tdrop", |
| 44 |
"qman fq retired", |
| 45 |
"qman orp disabled", |
| 46 |
|
| 47 |
/* congestion related stats */ |
| 48 |
"congestion time (ms)", |
| 49 |
"entered congestion", |
| 50 |
"congested (0/1)" |
| 51 |
}; |
| 52 |
|
| 53 |
#define DPAA_STATS_PERCPU_LEN ARRAY_SIZE(dpaa_stats_percpu) |
| 54 |
#define DPAA_STATS_GLOBAL_LEN ARRAY_SIZE(dpaa_stats_global) |
| 55 |
|
| 56 |
static int dpaa_get_link_ksettings(struct net_device *net_dev, |
| 57 |
struct ethtool_link_ksettings *cmd) |
| 58 |
{ |
| 59 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 60 |
struct mac_device *mac_dev = priv->mac_dev; |
| 61 |
|
| 62 |
return phylink_ethtool_ksettings_get(mac_dev->phylink, cmd); |
| 63 |
} |
| 64 |
|
| 65 |
static int dpaa_set_link_ksettings(struct net_device *net_dev, |
| 66 |
const struct ethtool_link_ksettings *cmd) |
| 67 |
{ |
| 68 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 69 |
struct mac_device *mac_dev = priv->mac_dev; |
| 70 |
|
| 71 |
return phylink_ethtool_ksettings_set(mac_dev->phylink, cmd); |
| 72 |
} |
| 73 |
|
| 74 |
static void dpaa_get_drvinfo(struct net_device *net_dev, |
| 75 |
struct ethtool_drvinfo *drvinfo) |
| 76 |
{ |
| 77 |
strscpy(drvinfo->driver, KBUILD_MODNAME, |
| 78 |
sizeof(drvinfo->driver)); |
| 79 |
strscpy(drvinfo->bus_info, dev_name(net_dev->dev.parent->parent), |
| 80 |
sizeof(drvinfo->bus_info)); |
| 81 |
} |
| 82 |
|
| 83 |
static u32 dpaa_get_msglevel(struct net_device *net_dev) |
| 84 |
{ |
| 85 |
return ((struct dpaa_priv *)netdev_priv(net_dev))->msg_enable; |
| 86 |
} |
| 87 |
|
| 88 |
static void dpaa_set_msglevel(struct net_device *net_dev, |
| 89 |
u32 msg_enable) |
| 90 |
{ |
| 91 |
((struct dpaa_priv *)netdev_priv(net_dev))->msg_enable = msg_enable; |
| 92 |
} |
| 93 |
|
| 94 |
static int dpaa_nway_reset(struct net_device *net_dev) |
| 95 |
{ |
| 96 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 97 |
struct mac_device *mac_dev = priv->mac_dev; |
| 98 |
|
| 99 |
return phylink_ethtool_nway_reset(mac_dev->phylink); |
| 100 |
} |
| 101 |
|
| 102 |
static void dpaa_get_pauseparam(struct net_device *net_dev, |
| 103 |
struct ethtool_pauseparam *epause) |
| 104 |
{ |
| 105 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 106 |
struct mac_device *mac_dev = priv->mac_dev; |
| 107 |
|
| 108 |
phylink_ethtool_get_pauseparam(mac_dev->phylink, epause); |
| 109 |
} |
| 110 |
|
| 111 |
static int dpaa_set_pauseparam(struct net_device *net_dev, |
| 112 |
struct ethtool_pauseparam *epause) |
| 113 |
{ |
| 114 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 115 |
struct mac_device *mac_dev = priv->mac_dev; |
| 116 |
|
| 117 |
return phylink_ethtool_set_pauseparam(mac_dev->phylink, epause); |
| 118 |
} |
| 119 |
|
| 120 |
static int dpaa_get_sset_count(struct net_device *net_dev, int type) |
| 121 |
{ |
| 122 |
unsigned int total_stats, num_stats; |
| 123 |
|
| 124 |
num_stats = num_online_cpus() + 1; |
| 125 |
total_stats = num_stats * (DPAA_STATS_PERCPU_LEN + 1) + |
| 126 |
DPAA_STATS_GLOBAL_LEN; |
| 127 |
|
| 128 |
switch (type) { |
| 129 |
case ETH_SS_STATS: |
| 130 |
return total_stats; |
| 131 |
default: |
| 132 |
return -EOPNOTSUPP; |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
static void copy_stats(struct dpaa_percpu_priv *percpu_priv, int num_cpus, |
| 137 |
int crr_cpu, u64 bp_count, u64 *data) |
| 138 |
{ |
| 139 |
int num_values = num_cpus + 1; |
| 140 |
int crr = 0; |
| 141 |
|
| 142 |
/* update current CPU's stats and also add them to the total values */ |
| 143 |
data[crr * num_values + crr_cpu] = percpu_priv->in_interrupt; |
| 144 |
data[crr++ * num_values + num_cpus] += percpu_priv->in_interrupt; |
| 145 |
|
| 146 |
data[crr * num_values + crr_cpu] = percpu_priv->stats.rx_packets; |
| 147 |
data[crr++ * num_values + num_cpus] += percpu_priv->stats.rx_packets; |
| 148 |
|
| 149 |
data[crr * num_values + crr_cpu] = percpu_priv->stats.tx_packets; |
| 150 |
data[crr++ * num_values + num_cpus] += percpu_priv->stats.tx_packets; |
| 151 |
|
| 152 |
data[crr * num_values + crr_cpu] = percpu_priv->tx_confirm; |
| 153 |
data[crr++ * num_values + num_cpus] += percpu_priv->tx_confirm; |
| 154 |
|
| 155 |
data[crr * num_values + crr_cpu] = percpu_priv->tx_frag_skbuffs; |
| 156 |
data[crr++ * num_values + num_cpus] += percpu_priv->tx_frag_skbuffs; |
| 157 |
|
| 158 |
data[crr * num_values + crr_cpu] = percpu_priv->stats.tx_errors; |
| 159 |
data[crr++ * num_values + num_cpus] += percpu_priv->stats.tx_errors; |
| 160 |
|
| 161 |
data[crr * num_values + crr_cpu] = percpu_priv->stats.rx_errors; |
| 162 |
data[crr++ * num_values + num_cpus] += percpu_priv->stats.rx_errors; |
| 163 |
|
| 164 |
data[crr * num_values + crr_cpu] = percpu_priv->stats.rx_dropped; |
| 165 |
data[crr++ * num_values + num_cpus] += percpu_priv->stats.rx_dropped; |
| 166 |
|
| 167 |
data[crr * num_values + crr_cpu] = percpu_priv->stats.tx_dropped; |
| 168 |
data[crr++ * num_values + num_cpus] += percpu_priv->stats.tx_dropped; |
| 169 |
|
| 170 |
data[crr * num_values + crr_cpu] = bp_count; |
| 171 |
data[crr++ * num_values + num_cpus] += bp_count; |
| 172 |
} |
| 173 |
|
| 174 |
static void dpaa_get_ethtool_stats(struct net_device *net_dev, |
| 175 |
struct ethtool_stats *stats, u64 *data) |
| 176 |
{ |
| 177 |
struct dpaa_percpu_priv *percpu_priv; |
| 178 |
struct dpaa_rx_errors rx_errors; |
| 179 |
unsigned int num_cpus, offset; |
| 180 |
u64 bp_count, cg_time, cg_num; |
| 181 |
struct dpaa_ern_cnt ern_cnt; |
| 182 |
struct dpaa_bp *dpaa_bp; |
| 183 |
struct dpaa_priv *priv; |
| 184 |
int total_stats, i; |
| 185 |
bool cg_status; |
| 186 |
|
| 187 |
total_stats = dpaa_get_sset_count(net_dev, ETH_SS_STATS); |
| 188 |
priv = netdev_priv(net_dev); |
| 189 |
num_cpus = num_online_cpus(); |
| 190 |
|
| 191 |
memset(&bp_count, 0, sizeof(bp_count)); |
| 192 |
memset(&rx_errors, 0, sizeof(struct dpaa_rx_errors)); |
| 193 |
memset(&ern_cnt, 0, sizeof(struct dpaa_ern_cnt)); |
| 194 |
memset(data, 0, total_stats * sizeof(u64)); |
| 195 |
|
| 196 |
for_each_online_cpu(i) { |
| 197 |
percpu_priv = per_cpu_ptr(priv->percpu_priv, i); |
| 198 |
dpaa_bp = priv->dpaa_bp; |
| 199 |
if (!dpaa_bp->percpu_count) |
| 200 |
continue; |
| 201 |
bp_count = *(per_cpu_ptr(dpaa_bp->percpu_count, i)); |
| 202 |
rx_errors.dme += percpu_priv->rx_errors.dme; |
| 203 |
rx_errors.fpe += percpu_priv->rx_errors.fpe; |
| 204 |
rx_errors.fse += percpu_priv->rx_errors.fse; |
| 205 |
rx_errors.phe += percpu_priv->rx_errors.phe; |
| 206 |
|
| 207 |
ern_cnt.cg_tdrop += percpu_priv->ern_cnt.cg_tdrop; |
| 208 |
ern_cnt.wred += percpu_priv->ern_cnt.wred; |
| 209 |
ern_cnt.err_cond += percpu_priv->ern_cnt.err_cond; |
| 210 |
ern_cnt.early_window += percpu_priv->ern_cnt.early_window; |
| 211 |
ern_cnt.late_window += percpu_priv->ern_cnt.late_window; |
| 212 |
ern_cnt.fq_tdrop += percpu_priv->ern_cnt.fq_tdrop; |
| 213 |
ern_cnt.fq_retired += percpu_priv->ern_cnt.fq_retired; |
| 214 |
ern_cnt.orp_zero += percpu_priv->ern_cnt.orp_zero; |
| 215 |
|
| 216 |
copy_stats(percpu_priv, num_cpus, i, bp_count, data); |
| 217 |
} |
| 218 |
|
| 219 |
offset = (num_cpus + 1) * (DPAA_STATS_PERCPU_LEN + 1); |
| 220 |
memcpy(data + offset, &rx_errors, sizeof(struct dpaa_rx_errors)); |
| 221 |
|
| 222 |
offset += sizeof(struct dpaa_rx_errors) / sizeof(u64); |
| 223 |
memcpy(data + offset, &ern_cnt, sizeof(struct dpaa_ern_cnt)); |
| 224 |
|
| 225 |
/* gather congestion related counters */ |
| 226 |
cg_num = 0; |
| 227 |
cg_status = false; |
| 228 |
cg_time = jiffies_to_msecs(priv->cgr_data.congested_jiffies); |
| 229 |
if (qman_query_cgr_congested(&priv->cgr_data.cgr, &cg_status) == 0) { |
| 230 |
cg_num = priv->cgr_data.cgr_congested_count; |
| 231 |
|
| 232 |
/* reset congestion stats (like QMan API does */ |
| 233 |
priv->cgr_data.congested_jiffies = 0; |
| 234 |
priv->cgr_data.cgr_congested_count = 0; |
| 235 |
} |
| 236 |
|
| 237 |
offset += sizeof(struct dpaa_ern_cnt) / sizeof(u64); |
| 238 |
data[offset++] = cg_time; |
| 239 |
data[offset++] = cg_num; |
| 240 |
data[offset++] = cg_status; |
| 241 |
} |
| 242 |
|
| 243 |
static void dpaa_get_strings(struct net_device *net_dev, u32 stringset, |
| 244 |
u8 *data) |
| 245 |
{ |
| 246 |
unsigned int i, j, num_cpus; |
| 247 |
|
| 248 |
num_cpus = num_online_cpus(); |
| 249 |
|
| 250 |
for (i = 0; i < DPAA_STATS_PERCPU_LEN; i++) { |
| 251 |
for (j = 0; j < num_cpus; j++) |
| 252 |
ethtool_sprintf(&data, "%s [CPU %d]", |
| 253 |
dpaa_stats_percpu[i], j); |
| 254 |
|
| 255 |
ethtool_sprintf(&data, "%s [TOTAL]", dpaa_stats_percpu[i]); |
| 256 |
} |
| 257 |
for (i = 0; i < num_cpus; i++) |
| 258 |
ethtool_sprintf(&data, "bpool [CPU %d]", i); |
| 259 |
|
| 260 |
ethtool_puts(&data, "bpool [TOTAL]"); |
| 261 |
|
| 262 |
for (i = 0; i < DPAA_STATS_GLOBAL_LEN; i++) |
| 263 |
ethtool_puts(&data, dpaa_stats_global[i]); |
| 264 |
} |
| 265 |
|
| 266 |
static int dpaa_get_rxfh_fields(struct net_device *dev, |
| 267 |
struct ethtool_rxfh_fields *cmd) |
| 268 |
{ |
| 269 |
struct dpaa_priv *priv = netdev_priv(dev); |
| 270 |
|
| 271 |
cmd->data = 0; |
| 272 |
|
| 273 |
switch (cmd->flow_type) { |
| 274 |
case TCP_V4_FLOW: |
| 275 |
case TCP_V6_FLOW: |
| 276 |
case UDP_V4_FLOW: |
| 277 |
case UDP_V6_FLOW: |
| 278 |
if (priv->keygen_in_use) |
| 279 |
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; |
| 280 |
fallthrough; |
| 281 |
case IPV4_FLOW: |
| 282 |
case IPV6_FLOW: |
| 283 |
case SCTP_V4_FLOW: |
| 284 |
case SCTP_V6_FLOW: |
| 285 |
case AH_ESP_V4_FLOW: |
| 286 |
case AH_ESP_V6_FLOW: |
| 287 |
case AH_V4_FLOW: |
| 288 |
case AH_V6_FLOW: |
| 289 |
case ESP_V4_FLOW: |
| 290 |
case ESP_V6_FLOW: |
| 291 |
if (priv->keygen_in_use) |
| 292 |
cmd->data |= RXH_IP_SRC | RXH_IP_DST; |
| 293 |
break; |
| 294 |
default: |
| 295 |
cmd->data = 0; |
| 296 |
break; |
| 297 |
} |
| 298 |
|
| 299 |
return 0; |
| 300 |
} |
| 301 |
|
| 302 |
static void dpaa_set_hash(struct net_device *net_dev, bool enable) |
| 303 |
{ |
| 304 |
struct mac_device *mac_dev; |
| 305 |
struct fman_port *rxport; |
| 306 |
struct dpaa_priv *priv; |
| 307 |
|
| 308 |
priv = netdev_priv(net_dev); |
| 309 |
mac_dev = priv->mac_dev; |
| 310 |
rxport = mac_dev->port[0]; |
| 311 |
|
| 312 |
fman_port_use_kg_hash(rxport, enable); |
| 313 |
priv->keygen_in_use = enable; |
| 314 |
} |
| 315 |
|
| 316 |
static int dpaa_set_rxfh_fields(struct net_device *dev, |
| 317 |
const struct ethtool_rxfh_fields *nfc, |
| 318 |
struct netlink_ext_ack *extack) |
| 319 |
{ |
| 320 |
int ret = -EINVAL; |
| 321 |
|
| 322 |
/* we support hashing on IPv4/v6 src/dest IP and L4 src/dest port */ |
| 323 |
if (nfc->data & |
| 324 |
~(RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3)) |
| 325 |
return -EINVAL; |
| 326 |
|
| 327 |
switch (nfc->flow_type) { |
| 328 |
case TCP_V4_FLOW: |
| 329 |
case TCP_V6_FLOW: |
| 330 |
case UDP_V4_FLOW: |
| 331 |
case UDP_V6_FLOW: |
| 332 |
case IPV4_FLOW: |
| 333 |
case IPV6_FLOW: |
| 334 |
case SCTP_V4_FLOW: |
| 335 |
case SCTP_V6_FLOW: |
| 336 |
case AH_ESP_V4_FLOW: |
| 337 |
case AH_ESP_V6_FLOW: |
| 338 |
case AH_V4_FLOW: |
| 339 |
case AH_V6_FLOW: |
| 340 |
case ESP_V4_FLOW: |
| 341 |
case ESP_V6_FLOW: |
| 342 |
dpaa_set_hash(dev, !!nfc->data); |
| 343 |
ret = 0; |
| 344 |
break; |
| 345 |
default: |
| 346 |
break; |
| 347 |
} |
| 348 |
|
| 349 |
return ret; |
| 350 |
} |
| 351 |
|
| 352 |
static int dpaa_get_ts_info(struct net_device *net_dev, |
| 353 |
struct kernel_ethtool_ts_info *info) |
| 354 |
{ |
| 355 |
struct device *dev = net_dev->dev.parent; |
| 356 |
struct device_node *mac_node = dev->of_node; |
| 357 |
struct device_node *fman_node = NULL, *ptp_node = NULL; |
| 358 |
struct platform_device *ptp_dev = NULL; |
| 359 |
struct ptp_qoriq *ptp = NULL; |
| 360 |
|
| 361 |
info->phc_index = -1; |
| 362 |
|
| 363 |
fman_node = of_get_parent(mac_node); |
| 364 |
if (fman_node) { |
| 365 |
ptp_node = of_parse_phandle(fman_node, "ptimer-handle", 0); |
| 366 |
of_node_put(fman_node); |
| 367 |
} |
| 368 |
|
| 369 |
if (ptp_node) { |
| 370 |
ptp_dev = of_find_device_by_node(ptp_node); |
| 371 |
of_node_put(ptp_node); |
| 372 |
} |
| 373 |
|
| 374 |
if (ptp_dev) { |
| 375 |
ptp = platform_get_drvdata(ptp_dev); |
| 376 |
put_device(&ptp_dev->dev); |
| 377 |
} |
| 378 |
|
| 379 |
if (ptp) |
| 380 |
info->phc_index = ptp->phc_index; |
| 381 |
|
| 382 |
info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | |
| 383 |
SOF_TIMESTAMPING_RX_HARDWARE | |
| 384 |
SOF_TIMESTAMPING_RAW_HARDWARE; |
| 385 |
info->tx_types = (1 << HWTSTAMP_TX_OFF) | |
| 386 |
(1 << HWTSTAMP_TX_ON); |
| 387 |
info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) | |
| 388 |
(1 << HWTSTAMP_FILTER_ALL); |
| 389 |
|
| 390 |
return 0; |
| 391 |
} |
| 392 |
|
| 393 |
static int dpaa_get_coalesce(struct net_device *dev, |
| 394 |
struct ethtool_coalesce *c, |
| 395 |
struct kernel_ethtool_coalesce *kernel_coal, |
| 396 |
struct netlink_ext_ack *extack) |
| 397 |
{ |
| 398 |
struct qman_portal *portal; |
| 399 |
u32 period; |
| 400 |
u8 thresh; |
| 401 |
|
| 402 |
portal = qman_get_affine_portal(smp_processor_id()); |
| 403 |
qman_portal_get_iperiod(portal, &period); |
| 404 |
qman_dqrr_get_ithresh(portal, &thresh); |
| 405 |
|
| 406 |
c->rx_coalesce_usecs = period; |
| 407 |
c->rx_max_coalesced_frames = thresh; |
| 408 |
|
| 409 |
return 0; |
| 410 |
} |
| 411 |
|
| 412 |
static int dpaa_set_coalesce(struct net_device *dev, |
| 413 |
struct ethtool_coalesce *c, |
| 414 |
struct kernel_ethtool_coalesce *kernel_coal, |
| 415 |
struct netlink_ext_ack *extack) |
| 416 |
{ |
| 417 |
const cpumask_t *cpus = qman_affine_cpus(); |
| 418 |
struct qman_portal *portal; |
| 419 |
u32 period, prev_period; |
| 420 |
u8 thresh, prev_thresh; |
| 421 |
bool *needs_revert; |
| 422 |
int cpu, res; |
| 423 |
|
| 424 |
needs_revert = kzalloc_objs(bool, num_possible_cpus()); |
| 425 |
if (!needs_revert) |
| 426 |
return -ENOMEM; |
| 427 |
|
| 428 |
period = c->rx_coalesce_usecs; |
| 429 |
thresh = c->rx_max_coalesced_frames; |
| 430 |
|
| 431 |
/* save previous values */ |
| 432 |
portal = qman_get_affine_portal(smp_processor_id()); |
| 433 |
qman_portal_get_iperiod(portal, &prev_period); |
| 434 |
qman_dqrr_get_ithresh(portal, &prev_thresh); |
| 435 |
|
| 436 |
/* set new values */ |
| 437 |
for_each_cpu_and(cpu, cpus, cpu_online_mask) { |
| 438 |
portal = qman_get_affine_portal(cpu); |
| 439 |
res = qman_portal_set_iperiod(portal, period); |
| 440 |
if (res) |
| 441 |
goto revert_values; |
| 442 |
res = qman_dqrr_set_ithresh(portal, thresh); |
| 443 |
if (res) { |
| 444 |
qman_portal_set_iperiod(portal, prev_period); |
| 445 |
goto revert_values; |
| 446 |
} |
| 447 |
needs_revert[cpu] = true; |
| 448 |
} |
| 449 |
|
| 450 |
kfree(needs_revert); |
| 451 |
|
| 452 |
return 0; |
| 453 |
|
| 454 |
revert_values: |
| 455 |
/* restore previous values */ |
| 456 |
for_each_cpu_and(cpu, cpus, cpu_online_mask) { |
| 457 |
if (!needs_revert[cpu]) |
| 458 |
continue; |
| 459 |
portal = qman_get_affine_portal(cpu); |
| 460 |
/* previous values will not fail, ignore return value */ |
| 461 |
qman_portal_set_iperiod(portal, prev_period); |
| 462 |
qman_dqrr_set_ithresh(portal, prev_thresh); |
| 463 |
} |
| 464 |
|
| 465 |
kfree(needs_revert); |
| 466 |
|
| 467 |
return res; |
| 468 |
} |
| 469 |
|
| 470 |
static void dpaa_get_pause_stats(struct net_device *net_dev, |
| 471 |
struct ethtool_pause_stats *s) |
| 472 |
{ |
| 473 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 474 |
struct mac_device *mac_dev = priv->mac_dev; |
| 475 |
|
| 476 |
if (mac_dev->get_pause_stats) |
| 477 |
mac_dev->get_pause_stats(mac_dev->fman_mac, s); |
| 478 |
} |
| 479 |
|
| 480 |
static void dpaa_get_rmon_stats(struct net_device *net_dev, |
| 481 |
struct ethtool_rmon_stats *s, |
| 482 |
const struct ethtool_rmon_hist_range **ranges) |
| 483 |
{ |
| 484 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 485 |
struct mac_device *mac_dev = priv->mac_dev; |
| 486 |
|
| 487 |
if (mac_dev->get_rmon_stats) |
| 488 |
mac_dev->get_rmon_stats(mac_dev->fman_mac, s, ranges); |
| 489 |
} |
| 490 |
|
| 491 |
static void dpaa_get_eth_ctrl_stats(struct net_device *net_dev, |
| 492 |
struct ethtool_eth_ctrl_stats *s) |
| 493 |
{ |
| 494 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 495 |
struct mac_device *mac_dev = priv->mac_dev; |
| 496 |
|
| 497 |
if (mac_dev->get_eth_ctrl_stats) |
| 498 |
mac_dev->get_eth_ctrl_stats(mac_dev->fman_mac, s); |
| 499 |
} |
| 500 |
|
| 501 |
static void dpaa_get_eth_mac_stats(struct net_device *net_dev, |
| 502 |
struct ethtool_eth_mac_stats *s) |
| 503 |
{ |
| 504 |
struct dpaa_priv *priv = netdev_priv(net_dev); |
| 505 |
struct mac_device *mac_dev = priv->mac_dev; |
| 506 |
|
| 507 |
if (mac_dev->get_eth_mac_stats) |
| 508 |
mac_dev->get_eth_mac_stats(mac_dev->fman_mac, s); |
| 509 |
} |
| 510 |
|
| 511 |
const struct ethtool_ops dpaa_ethtool_ops = { |
| 512 |
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS | |
| 513 |
ETHTOOL_COALESCE_RX_MAX_FRAMES, |
| 514 |
.get_drvinfo = dpaa_get_drvinfo, |
| 515 |
.get_msglevel = dpaa_get_msglevel, |
| 516 |
.set_msglevel = dpaa_set_msglevel, |
| 517 |
.nway_reset = dpaa_nway_reset, |
| 518 |
.get_pauseparam = dpaa_get_pauseparam, |
| 519 |
.set_pauseparam = dpaa_set_pauseparam, |
| 520 |
.get_link = ethtool_op_get_link, |
| 521 |
.get_sset_count = dpaa_get_sset_count, |
| 522 |
.get_ethtool_stats = dpaa_get_ethtool_stats, |
| 523 |
.get_strings = dpaa_get_strings, |
| 524 |
.get_link_ksettings = dpaa_get_link_ksettings, |
| 525 |
.set_link_ksettings = dpaa_set_link_ksettings, |
| 526 |
.get_rxfh_fields = dpaa_get_rxfh_fields, |
| 527 |
.set_rxfh_fields = dpaa_set_rxfh_fields, |
| 528 |
.get_ts_info = dpaa_get_ts_info, |
| 529 |
.get_coalesce = dpaa_get_coalesce, |
| 530 |
.set_coalesce = dpaa_set_coalesce, |
| 531 |
.get_pause_stats = dpaa_get_pause_stats, |
| 532 |
.get_rmon_stats = dpaa_get_rmon_stats, |
| 533 |
.get_eth_ctrl_stats = dpaa_get_eth_ctrl_stats, |
| 534 |
.get_eth_mac_stats = dpaa_get_eth_mac_stats, |
| 535 |
}; |