#include <linux/kernel.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/timer.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/irqreturn.h>
#include <linux/interrupt.h>
#include <linux/if_ether.h>
#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/net_tstamp.h>
#include <linux/phy.h>
#include <linux/phy/phy.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/gpio/consumer.h>
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/of_net.h>
#include <linux/of_platform.h>
#include <linux/if_vlan.h>
#include <linux/kmemleak.h>
#include <linux/sys_soc.h>
#include <net/page_pool/helpers.h>
#include <linux/bpf.h>
#include <linux/bpf_trace.h>
#include <linux/pinctrl/consumer.h>
#include <net/pkt_cls.h>
#include "cpsw.h"
#include "cpsw_ale.h"
#include "cpsw_priv.h"
#include "cpsw_sl.h"
#include "cpts.h"
#include "davinci_cpdma.h"
#include <net/pkt_sched.h>
static int debug_level;
module_param(debug_level, int, 0);
MODULE_PARM_DESC(…) …;
static int ale_ageout = …;
module_param(ale_ageout, int, 0);
MODULE_PARM_DESC(…) …;
static int rx_packet_max = …;
module_param(rx_packet_max, int, 0);
MODULE_PARM_DESC(…) …;
static int descs_pool_size = …;
module_param(descs_pool_size, int, 0444);
MODULE_PARM_DESC(…) …;
#define for_each_slave(priv, func, arg...) …
static int cpsw_slave_index_priv(struct cpsw_common *cpsw,
struct cpsw_priv *priv)
{ … }
static int cpsw_get_slave_port(u32 slave_num)
{ … }
static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
__be16 proto, u16 vid);
static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
{ … }
static int cpsw_set_mc(struct net_device *ndev, const u8 *addr,
int vid, int add)
{ … }
static int cpsw_update_vlan_mc(struct net_device *vdev, int vid, void *ctx)
{ … }
static int cpsw_add_mc_addr(struct net_device *ndev, const u8 *addr, int num)
{ … }
static int cpsw_del_mc_addr(struct net_device *ndev, const u8 *addr, int num)
{ … }
static int cpsw_purge_vlan_mc(struct net_device *vdev, int vid, void *ctx)
{ … }
static int cpsw_purge_all_mc(struct net_device *ndev, const u8 *addr, int num)
{ … }
static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
{ … }
static unsigned int cpsw_rxbuf_total_len(unsigned int len)
{ … }
static void cpsw_rx_handler(void *token, int len, int status)
{ … }
static void _cpsw_adjust_link(struct cpsw_slave *slave,
struct cpsw_priv *priv, bool *link)
{ … }
static void cpsw_adjust_link(struct net_device *ndev)
{ … }
static inline void cpsw_add_dual_emac_def_ale_entries(
struct cpsw_priv *priv, struct cpsw_slave *slave,
u32 slave_port)
{ … }
static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
{ … }
static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
{ … }
static void cpsw_init_host_port(struct cpsw_priv *priv)
{ … }
static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_common *cpsw)
{ … }
static int cpsw_restore_vlans(struct net_device *vdev, int vid, void *arg)
{ … }
static void cpsw_restore(struct cpsw_priv *priv)
{ … }
static int cpsw_ndo_open(struct net_device *ndev)
{ … }
static int cpsw_ndo_stop(struct net_device *ndev)
{ … }
static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
struct net_device *ndev)
{ … }
static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p)
{ … }
static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv,
unsigned short vid)
{ … }
static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
__be16 proto, u16 vid)
{ … }
static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
__be16 proto, u16 vid)
{ … }
static int cpsw_ndo_xdp_xmit(struct net_device *ndev, int n,
struct xdp_frame **frames, u32 flags)
{ … }
#ifdef CONFIG_NET_POLL_CONTROLLER
static void cpsw_ndo_poll_controller(struct net_device *ndev)
{ … }
#endif
static const struct net_device_ops cpsw_netdev_ops = …;
static void cpsw_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *info)
{ … }
static int cpsw_set_pauseparam(struct net_device *ndev,
struct ethtool_pauseparam *pause)
{ … }
static int cpsw_set_channels(struct net_device *ndev,
struct ethtool_channels *chs)
{ … }
static const struct ethtool_ops cpsw_ethtool_ops = …;
static int cpsw_probe_dt(struct cpsw_platform_data *data,
struct platform_device *pdev)
{ … }
static void cpsw_remove_dt(struct platform_device *pdev)
{ … }
static int cpsw_probe_dual_emac(struct cpsw_priv *priv)
{ … }
static const struct of_device_id cpsw_of_mtable[] = …;
MODULE_DEVICE_TABLE(of, cpsw_of_mtable);
static const struct soc_device_attribute cpsw_soc_devices[] = …;
static int cpsw_probe(struct platform_device *pdev)
{ … }
static void cpsw_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int cpsw_suspend(struct device *dev)
{ … }
static int cpsw_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume);
static struct platform_driver cpsw_driver = …;
module_platform_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;