#include <linux/io.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/timer.h>
#include <linux/module.h>
#include <linux/irqreturn.h>
#include <linux/interrupt.h>
#include <linux/if_ether.h>
#include <linux/etherdevice.h>
#include <linux/net_tstamp.h>
#include <linux/phy.h>
#include <linux/phy/phy.h>
#include <linux/delay.h>
#include <linux/pinctrl/consumer.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/switchdev.h>
#include <net/page_pool/helpers.h>
#include <net/pkt_cls.h>
#include <net/devlink.h>
#include "cpsw.h"
#include "cpsw_ale.h"
#include "cpsw_priv.h"
#include "cpsw_sl.h"
#include "cpsw_switchdev.h"
#include "cpts.h"
#include "davinci_cpdma.h"
#include <net/pkt_sched.h>
static int debug_level;
static int ale_ageout = …;
static int rx_packet_max = …;
static int descs_pool_size = …;
struct cpsw_devlink { … };
enum cpsw_devlink_param_id { … };
static int cpsw_slave_index_priv(struct cpsw_common *cpsw,
struct cpsw_priv *priv)
{ … }
static bool cpsw_is_switch_en(struct cpsw_common *cpsw)
{ … }
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 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_restore_vlans(struct net_device *vdev, int vid, void *arg)
{ … }
static void cpsw_restore(struct cpsw_priv *priv)
{ … }
static void cpsw_init_stp_ale_entry(struct cpsw_common *cpsw)
{ … }
static void cpsw_init_host_port_switch(struct cpsw_common *cpsw)
{ … }
static void cpsw_init_host_port_dual_mac(struct cpsw_common *cpsw)
{ … }
static void cpsw_init_host_port(struct cpsw_priv *priv)
{ … }
static void cpsw_port_add_dual_emac_def_ale_entries(struct cpsw_priv *priv,
struct cpsw_slave *slave)
{ … }
static void cpsw_port_add_switch_def_ale_entries(struct cpsw_priv *priv,
struct cpsw_slave *slave)
{ … }
static void cpsw_adjust_link(struct net_device *ndev)
{ … }
static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
{ … }
static int cpsw_ndo_stop(struct net_device *ndev)
{ … }
static int cpsw_ndo_open(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 int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
__be16 proto, u16 vid)
{ … }
static int cpsw_ndo_get_phys_port_name(struct net_device *ndev, char *name,
size_t len)
{ … }
#ifdef CONFIG_NET_POLL_CONTROLLER
static void cpsw_ndo_poll_controller(struct net_device *ndev)
{ … }
#endif
static int cpsw_ndo_xdp_xmit(struct net_device *ndev, int n,
struct xdp_frame **frames, u32 flags)
{ … }
static int cpsw_get_port_parent_id(struct net_device *ndev,
struct netdev_phys_item_id *ppid)
{ … }
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_common *cpsw)
{ … }
static void cpsw_remove_dt(struct cpsw_common *cpsw)
{ … }
static int cpsw_create_ports(struct cpsw_common *cpsw)
{ … }
static void cpsw_unregister_ports(struct cpsw_common *cpsw)
{ … }
static int cpsw_register_ports(struct cpsw_common *cpsw)
{ … }
bool cpsw_port_dev_check(const struct net_device *ndev)
{ … }
static void cpsw_port_offload_fwd_mark_update(struct cpsw_common *cpsw)
{ … }
static int cpsw_netdevice_port_link(struct net_device *ndev,
struct net_device *br_ndev,
struct netlink_ext_ack *extack)
{ … }
static void cpsw_netdevice_port_unlink(struct net_device *ndev)
{ … }
static int cpsw_netdevice_event(struct notifier_block *unused,
unsigned long event, void *ptr)
{ … }
static struct notifier_block cpsw_netdevice_nb __read_mostly = …;
static int cpsw_register_notifiers(struct cpsw_common *cpsw)
{ … }
static void cpsw_unregister_notifiers(struct cpsw_common *cpsw)
{ … }
static const struct devlink_ops cpsw_devlink_ops = …;
static int cpsw_dl_switch_mode_get(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx)
{ … }
static int cpsw_dl_switch_mode_set(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{ … }
static int cpsw_dl_ale_ctrl_get(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx)
{ … }
static int cpsw_dl_ale_ctrl_set(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{ … }
static const struct devlink_param cpsw_devlink_params[] = …;
static int cpsw_register_devlink(struct cpsw_common *cpsw)
{ … }
static void cpsw_unregister_devlink(struct cpsw_common *cpsw)
{ … }
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)
{ … }
static int __maybe_unused cpsw_suspend(struct device *dev)
{ … }
static int __maybe_unused cpsw_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume);
static struct platform_driver cpsw_driver = …;
module_platform_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;