#include <linux/bitrev.h>
#include <linux/completion.h>
#include <linux/crc32.h>
#include <linux/ethtool.h>
#include <linux/ip.h>
#include <linux/phy.h>
#include <linux/udp.h>
#include <net/pkt_cls.h>
#include <net/pkt_sched.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <net/tc_act/tc_gact.h>
#include "stmmac.h"
struct stmmachdr { … } __packed;
#define STMMAC_TEST_PKT_SIZE …
#define STMMAC_TEST_PKT_MAGIC …
#define STMMAC_LB_TIMEOUT …
struct stmmac_packet_attrs { … };
static u8 stmmac_test_next_id;
static struct sk_buff *stmmac_test_get_udp_skb(struct stmmac_priv *priv,
struct stmmac_packet_attrs *attr)
{ … }
static struct sk_buff *stmmac_test_get_arp_skb(struct stmmac_priv *priv,
struct stmmac_packet_attrs *attr)
{ … }
struct stmmac_test_priv { … };
static int stmmac_test_loopback_validate(struct sk_buff *skb,
struct net_device *ndev,
struct packet_type *pt,
struct net_device *orig_ndev)
{ … }
static int __stmmac_test_loopback(struct stmmac_priv *priv,
struct stmmac_packet_attrs *attr)
{ … }
static int stmmac_test_mac_loopback(struct stmmac_priv *priv)
{ … }
static int stmmac_test_phy_loopback(struct stmmac_priv *priv)
{ … }
static int stmmac_test_mmc(struct stmmac_priv *priv)
{ … }
static int stmmac_test_eee(struct stmmac_priv *priv)
{ … }
static int stmmac_filter_check(struct stmmac_priv *priv)
{ … }
static bool stmmac_hash_check(struct stmmac_priv *priv, unsigned char *addr)
{ … }
static bool stmmac_perfect_check(struct stmmac_priv *priv, unsigned char *addr)
{ … }
static int stmmac_test_hfilt(struct stmmac_priv *priv)
{ … }
static int stmmac_test_pfilt(struct stmmac_priv *priv)
{ … }
static int stmmac_test_mcfilt(struct stmmac_priv *priv)
{ … }
static int stmmac_test_ucfilt(struct stmmac_priv *priv)
{ … }
static int stmmac_test_flowctrl_validate(struct sk_buff *skb,
struct net_device *ndev,
struct packet_type *pt,
struct net_device *orig_ndev)
{ … }
static int stmmac_test_flowctrl(struct stmmac_priv *priv)
{ … }
static int stmmac_test_rss(struct stmmac_priv *priv)
{ … }
static int stmmac_test_vlan_validate(struct sk_buff *skb,
struct net_device *ndev,
struct packet_type *pt,
struct net_device *orig_ndev)
{ … }
static int __stmmac_test_vlanfilt(struct stmmac_priv *priv)
{ … }
static int stmmac_test_vlanfilt(struct stmmac_priv *priv)
{ … }
static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv)
{ … }
static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv)
{ … }
static int stmmac_test_dvlanfilt(struct stmmac_priv *priv)
{ … }
static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv)
{ … }
#ifdef CONFIG_NET_CLS_ACT
static int stmmac_test_rxp(struct stmmac_priv *priv)
{ … }
#else
static int stmmac_test_rxp(struct stmmac_priv *priv)
{
return -EOPNOTSUPP;
}
#endif
static int stmmac_test_desc_sai(struct stmmac_priv *priv)
{ … }
static int stmmac_test_desc_sar(struct stmmac_priv *priv)
{ … }
static int stmmac_test_reg_sai(struct stmmac_priv *priv)
{ … }
static int stmmac_test_reg_sar(struct stmmac_priv *priv)
{ … }
static int stmmac_test_vlanoff_common(struct stmmac_priv *priv, bool svlan)
{ … }
static int stmmac_test_vlanoff(struct stmmac_priv *priv)
{ … }
static int stmmac_test_svlanoff(struct stmmac_priv *priv)
{ … }
#ifdef CONFIG_NET_CLS_ACT
static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
u32 dst_mask, u32 src_mask)
{ … }
#else
static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
u32 dst_mask, u32 src_mask)
{
return -EOPNOTSUPP;
}
#endif
static int stmmac_test_l3filt_da(struct stmmac_priv *priv)
{ … }
static int stmmac_test_l3filt_sa(struct stmmac_priv *priv)
{ … }
#ifdef CONFIG_NET_CLS_ACT
static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
u32 dst_mask, u32 src_mask, bool udp)
{ … }
#else
static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
u32 dst_mask, u32 src_mask, bool udp)
{
return -EOPNOTSUPP;
}
#endif
static int stmmac_test_l4filt_da_tcp(struct stmmac_priv *priv)
{ … }
static int stmmac_test_l4filt_sa_tcp(struct stmmac_priv *priv)
{ … }
static int stmmac_test_l4filt_da_udp(struct stmmac_priv *priv)
{ … }
static int stmmac_test_l4filt_sa_udp(struct stmmac_priv *priv)
{ … }
static int stmmac_test_arp_validate(struct sk_buff *skb,
struct net_device *ndev,
struct packet_type *pt,
struct net_device *orig_ndev)
{ … }
static int stmmac_test_arpoffload(struct stmmac_priv *priv)
{ … }
static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue)
{ … }
static int stmmac_test_jumbo(struct stmmac_priv *priv)
{ … }
static int stmmac_test_mjumbo(struct stmmac_priv *priv)
{ … }
static int stmmac_test_sph(struct stmmac_priv *priv)
{ … }
static int stmmac_test_tbs(struct stmmac_priv *priv)
{ … }
#define STMMAC_LOOPBACK_NONE …
#define STMMAC_LOOPBACK_MAC …
#define STMMAC_LOOPBACK_PHY …
static const struct stmmac_test { … } stmmac_selftests[] = …;
void stmmac_selftest_run(struct net_device *dev,
struct ethtool_test *etest, u64 *buf)
{ … }
void stmmac_selftest_get_strings(struct stmmac_priv *priv, u8 *data)
{ … }
int stmmac_selftest_get_count(struct stmmac_priv *priv)
{ … }