linux/drivers/net/ethernet/freescale/gianfar_ethtool.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  drivers/net/ethernet/freescale/gianfar_ethtool.c
 *
 *  Gianfar Ethernet Driver
 *  Ethtool support for Gianfar Enet
 *  Based on e1000 ethtool support
 *
 *  Author: Andy Fleming
 *  Maintainer: Kumar Gala
 *  Modifier: Sandeep Gopalpet <[email protected]>
 *
 *  Copyright 2003-2006, 2008-2009, 2011 Freescale Semiconductor, Inc.
 */

#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/net_tstamp.h>
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/mm.h>

#include <asm/io.h>
#include <asm/irq.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/crc32.h>
#include <asm/types.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/phy.h>
#include <linux/sort.h>
#include <linux/if_vlan.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/fsl/ptp_qoriq.h>

#include "gianfar.h"

#define GFAR_MAX_COAL_USECS
#define GFAR_MAX_COAL_FRAMES

static const char stat_gstrings[][ETH_GSTRING_LEN] =;

/* Fill in a buffer with the strings which correspond to the
 * stats */
static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf)
{}

/* Fill in an array of 64-bit statistics from various sources.
 * This array will be appended to the end of the ethtool_stats
 * structure, and returned to user space
 */
static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
			    u64 *buf)
{}

static int gfar_sset_count(struct net_device *dev, int sset)
{}

/* Fills in the drvinfo structure with some basic info */
static void gfar_gdrvinfo(struct net_device *dev,
			  struct ethtool_drvinfo *drvinfo)
{}

/* Return the length of the register structure */
static int gfar_reglen(struct net_device *dev)
{}

/* Return a dump of the GFAR register space */
static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs,
			  void *regbuf)
{}

/* Convert microseconds to ethernet clock ticks, which changes
 * depending on what speed the controller is running at */
static unsigned int gfar_usecs2ticks(struct gfar_private *priv,
				     unsigned int usecs)
{}

/* Convert ethernet clock ticks to microseconds */
static unsigned int gfar_ticks2usecs(struct gfar_private *priv,
				     unsigned int ticks)
{}

/* Get the coalescing parameters, and put them in the cvals
 * structure.  */
static int gfar_gcoalesce(struct net_device *dev,
			  struct ethtool_coalesce *cvals,
			  struct kernel_ethtool_coalesce *kernel_coal,
			  struct netlink_ext_ack *extack)
{}

/* Change the coalescing values.
 * Both cvals->*_usecs and cvals->*_frames have to be > 0
 * in order for coalescing to be active
 */
static int gfar_scoalesce(struct net_device *dev,
			  struct ethtool_coalesce *cvals,
			  struct kernel_ethtool_coalesce *kernel_coal,
			  struct netlink_ext_ack *extack)
{}

/* Fills in rvals with the current ring parameters.  Currently,
 * rx, rx_mini, and rx_jumbo rings are the same size, as mini and
 * jumbo are ignored by the driver */
static void gfar_gringparam(struct net_device *dev,
			    struct ethtool_ringparam *rvals,
			    struct kernel_ethtool_ringparam *kernel_rvals,
			    struct netlink_ext_ack *extack)
{}

/* Change the current ring parameters, stopping the controller if
 * necessary so that we don't mess things up while we're in motion.
 */
static int gfar_sringparam(struct net_device *dev,
			   struct ethtool_ringparam *rvals,
			   struct kernel_ethtool_ringparam *kernel_rvals,
			   struct netlink_ext_ack *extack)
{}

static void gfar_gpauseparam(struct net_device *dev,
			     struct ethtool_pauseparam *epause)
{}

static int gfar_spauseparam(struct net_device *dev,
			    struct ethtool_pauseparam *epause)
{}

int gfar_set_features(struct net_device *dev, netdev_features_t features)
{}

static uint32_t gfar_get_msglevel(struct net_device *dev)
{}

static void gfar_set_msglevel(struct net_device *dev, uint32_t data)
{}

#ifdef CONFIG_PM
static void gfar_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{}

static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{}
#endif

static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
{}

static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow,
				       u64 class)
{}

static int gfar_set_hash_opts(struct gfar_private *priv,
			      struct ethtool_rxnfc *cmd)
{}

static int gfar_check_filer_hardware(struct gfar_private *priv)
{}

/* Write a mask to filer cache */
static void gfar_set_mask(u32 mask, struct filer_table *tab)
{}

/* Sets parse bits (e.g. IP or TCP) */
static void gfar_set_parse_bits(u32 value, u32 mask, struct filer_table *tab)
{}

static void gfar_set_general_attribute(u32 value, u32 mask, u32 flag,
				       struct filer_table *tab)
{}

/* For setting a tuple of value and mask of type flag
 * Example:
 * IP-Src = 10.0.0.0/255.0.0.0
 * value: 0x0A000000 mask: FF000000 flag: RQFPR_IPV4
 *
 * Ethtool gives us a value=0 and mask=~0 for don't care a tuple
 * For a don't care mask it gives us a 0
 *
 * The check if don't care and the mask adjustment if mask=0 is done for VLAN
 * and MAC stuff on an upper level (due to missing information on this level).
 * For these guys we can discard them if they are value=0 and mask=0.
 *
 * Further the all masks are one-padded for better hardware efficiency.
 */
static void gfar_set_attribute(u32 value, u32 mask, u32 flag,
			       struct filer_table *tab)
{}

/* Translates value and mask for UDP, TCP or SCTP */
static void gfar_set_basic_ip(struct ethtool_tcpip4_spec *value,
			      struct ethtool_tcpip4_spec *mask,
			      struct filer_table *tab)
{}

/* Translates value and mask for RAW-IP4 */
static void gfar_set_user_ip(struct ethtool_usrip4_spec *value,
			     struct ethtool_usrip4_spec *mask,
			     struct filer_table *tab)
{}

/* Translates value and mask for ETHER spec */
static void gfar_set_ether(struct ethhdr *value, struct ethhdr *mask,
			   struct filer_table *tab)
{}

static inline u32 vlan_tci_vid(struct ethtool_rx_flow_spec *rule)
{}

static inline u32 vlan_tci_vidm(struct ethtool_rx_flow_spec *rule)
{}

static inline u32 vlan_tci_cfi(struct ethtool_rx_flow_spec *rule)
{}

static inline u32 vlan_tci_cfim(struct ethtool_rx_flow_spec *rule)
{}

static inline u32 vlan_tci_prio(struct ethtool_rx_flow_spec *rule)
{}

static inline u32 vlan_tci_priom(struct ethtool_rx_flow_spec *rule)
{}

/* Convert a rule to binary filter format of gianfar */
static int gfar_convert_to_filer(struct ethtool_rx_flow_spec *rule,
				 struct filer_table *tab)
{}

/* Write the bit-pattern from software's buffer to hardware registers */
static int gfar_write_filer_table(struct gfar_private *priv,
				  struct filer_table *tab)
{}

static int gfar_check_capability(struct ethtool_rx_flow_spec *flow,
				 struct gfar_private *priv)
{}

static int gfar_process_filer_changes(struct gfar_private *priv)
{}

static void gfar_invert_masks(struct ethtool_rx_flow_spec *flow)
{}

static int gfar_add_cls(struct gfar_private *priv,
			struct ethtool_rx_flow_spec *flow)
{}

static int gfar_del_cls(struct gfar_private *priv, u32 loc)
{}

static int gfar_get_cls(struct gfar_private *priv, struct ethtool_rxnfc *cmd)
{}

static int gfar_get_cls_all(struct gfar_private *priv,
			    struct ethtool_rxnfc *cmd, u32 *rule_locs)
{}

static int gfar_set_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
{}

static int gfar_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
			u32 *rule_locs)
{}

static int gfar_get_ts_info(struct net_device *dev,
			    struct kernel_ethtool_ts_info *info)
{}

const struct ethtool_ops gfar_ethtool_ops =;