drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
Extension
.c
Size
14644 bytes
Lines
536
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (res) {
			qman_portal_set_iperiod(portal, prev_period);
			goto revert_values;
		}
		needs_revert[cpu] = true;
	}

	kfree(needs_revert);

	return 0;

revert_values:
	/* restore previous values */
	for_each_cpu_and(cpu, cpus, cpu_online_mask) {
		if (!needs_revert[cpu])
			continue;
		portal = qman_get_affine_portal(cpu);
		/* previous values will not fail, ignore return value */
		qman_portal_set_iperiod(portal, prev_period);
		qman_dqrr_set_ithresh(portal, prev_thresh);
	}

	kfree(needs_revert);

	return res;
}

static void dpaa_get_pause_stats(struct net_device *net_dev,
				 struct ethtool_pause_stats *s)
{
	struct dpaa_priv *priv = netdev_priv(net_dev);
	struct mac_device *mac_dev = priv->mac_dev;

	if (mac_dev->get_pause_stats)
		mac_dev->get_pause_stats(mac_dev->fman_mac, s);
}

static void dpaa_get_rmon_stats(struct net_device *net_dev,
				struct ethtool_rmon_stats *s,
				const struct ethtool_rmon_hist_range **ranges)
{
	struct dpaa_priv *priv = netdev_priv(net_dev);
	struct mac_device *mac_dev = priv->mac_dev;

	if (mac_dev->get_rmon_stats)
		mac_dev->get_rmon_stats(mac_dev->fman_mac, s, ranges);
}

static void dpaa_get_eth_ctrl_stats(struct net_device *net_dev,
				    struct ethtool_eth_ctrl_stats *s)
{
	struct dpaa_priv *priv = netdev_priv(net_dev);
	struct mac_device *mac_dev = priv->mac_dev;

	if (mac_dev->get_eth_ctrl_stats)
		mac_dev->get_eth_ctrl_stats(mac_dev->fman_mac, s);
}

static void dpaa_get_eth_mac_stats(struct net_device *net_dev,
				   struct ethtool_eth_mac_stats *s)
{
	struct dpaa_priv *priv = netdev_priv(net_dev);
	struct mac_device *mac_dev = priv->mac_dev;

	if (mac_dev->get_eth_mac_stats)
		mac_dev->get_eth_mac_stats(mac_dev->fman_mac, s);
}

const struct ethtool_ops dpaa_ethtool_ops = {
	.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS |
				     ETHTOOL_COALESCE_RX_MAX_FRAMES,
	.get_drvinfo = dpaa_get_drvinfo,
	.get_msglevel = dpaa_get_msglevel,
	.set_msglevel = dpaa_set_msglevel,
	.nway_reset = dpaa_nway_reset,
	.get_pauseparam = dpaa_get_pauseparam,
	.set_pauseparam = dpaa_set_pauseparam,
	.get_link = ethtool_op_get_link,
	.get_sset_count = dpaa_get_sset_count,
	.get_ethtool_stats = dpaa_get_ethtool_stats,
	.get_strings = dpaa_get_strings,
	.get_link_ksettings = dpaa_get_link_ksettings,
	.set_link_ksettings = dpaa_set_link_ksettings,
	.get_rxfh_fields = dpaa_get_rxfh_fields,
	.set_rxfh_fields = dpaa_set_rxfh_fields,
	.get_ts_info = dpaa_get_ts_info,
	.get_coalesce = dpaa_get_coalesce,
	.set_coalesce = dpaa_set_coalesce,
	.get_pause_stats = dpaa_get_pause_stats,
	.get_rmon_stats = dpaa_get_rmon_stats,

Annotation

Implementation Notes