#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/kthread.h>
#include <linux/workqueue.h>
#include <linux/iommu.h>
#include <net/pkt_cls.h>
#include <linux/fsl/mc.h>
#include "dpaa2-switch.h"
#define DPSW_MIN_VER_MAJOR …
#define DPSW_MIN_VER_MINOR …
#define DEFAULT_VLAN_ID …
static u16 dpaa2_switch_port_get_fdb_id(struct ethsw_port_priv *port_priv)
{ … }
static struct dpaa2_switch_fdb *dpaa2_switch_fdb_get_unused(struct ethsw_core *ethsw)
{ … }
static struct dpaa2_switch_filter_block *
dpaa2_switch_filter_block_get_unused(struct ethsw_core *ethsw)
{ … }
static u16 dpaa2_switch_port_set_fdb(struct ethsw_port_priv *port_priv,
struct net_device *bridge_dev)
{ … }
static void dpaa2_switch_fdb_get_flood_cfg(struct ethsw_core *ethsw, u16 fdb_id,
enum dpsw_flood_type type,
struct dpsw_egress_flood_cfg *cfg)
{ … }
static int dpaa2_switch_fdb_set_egress_flood(struct ethsw_core *ethsw, u16 fdb_id)
{ … }
static void *dpaa2_iova_to_virt(struct iommu_domain *domain,
dma_addr_t iova_addr)
{ … }
static int dpaa2_switch_add_vlan(struct ethsw_port_priv *port_priv, u16 vid)
{ … }
static bool dpaa2_switch_port_is_up(struct ethsw_port_priv *port_priv)
{ … }
static int dpaa2_switch_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid)
{ … }
static int dpaa2_switch_port_add_vlan(struct ethsw_port_priv *port_priv,
u16 vid, u16 flags)
{ … }
static enum dpsw_stp_state br_stp_state_to_dpsw(u8 state)
{ … }
static int dpaa2_switch_port_set_stp_state(struct ethsw_port_priv *port_priv, u8 state)
{ … }
static int dpaa2_switch_dellink(struct ethsw_core *ethsw, u16 vid)
{ … }
static int dpaa2_switch_port_fdb_add_uc(struct ethsw_port_priv *port_priv,
const unsigned char *addr)
{ … }
static int dpaa2_switch_port_fdb_del_uc(struct ethsw_port_priv *port_priv,
const unsigned char *addr)
{ … }
static int dpaa2_switch_port_fdb_add_mc(struct ethsw_port_priv *port_priv,
const unsigned char *addr)
{ … }
static int dpaa2_switch_port_fdb_del_mc(struct ethsw_port_priv *port_priv,
const unsigned char *addr)
{ … }
static void dpaa2_switch_port_get_stats(struct net_device *netdev,
struct rtnl_link_stats64 *stats)
{ … }
static bool dpaa2_switch_port_has_offload_stats(const struct net_device *netdev,
int attr_id)
{ … }
static int dpaa2_switch_port_get_offload_stats(int attr_id,
const struct net_device *netdev,
void *sp)
{ … }
static int dpaa2_switch_port_change_mtu(struct net_device *netdev, int mtu)
{ … }
static int dpaa2_switch_port_link_state_update(struct net_device *netdev)
{ … }
static void dpaa2_switch_enable_ctrl_if_napi(struct ethsw_core *ethsw)
{ … }
static void dpaa2_switch_disable_ctrl_if_napi(struct ethsw_core *ethsw)
{ … }
static int dpaa2_switch_port_open(struct net_device *netdev)
{ … }
static int dpaa2_switch_port_stop(struct net_device *netdev)
{ … }
static int dpaa2_switch_port_parent_id(struct net_device *dev,
struct netdev_phys_item_id *ppid)
{ … }
static int dpaa2_switch_port_get_phys_name(struct net_device *netdev, char *name,
size_t len)
{ … }
struct ethsw_dump_ctx { … };
static int dpaa2_switch_fdb_dump_nl(struct fdb_dump_entry *entry,
struct ethsw_dump_ctx *dump)
{ … }
static int dpaa2_switch_port_fdb_valid_entry(struct fdb_dump_entry *entry,
struct ethsw_port_priv *port_priv)
{ … }
static int dpaa2_switch_fdb_iterate(struct ethsw_port_priv *port_priv,
dpaa2_switch_fdb_cb_t cb, void *data)
{ … }
static int dpaa2_switch_fdb_entry_dump(struct ethsw_port_priv *port_priv,
struct fdb_dump_entry *fdb_entry,
void *data)
{ … }
static int dpaa2_switch_port_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
struct net_device *net_dev,
struct net_device *filter_dev, int *idx)
{ … }
static int dpaa2_switch_fdb_entry_fast_age(struct ethsw_port_priv *port_priv,
struct fdb_dump_entry *fdb_entry,
void *data __always_unused)
{ … }
static void dpaa2_switch_port_fast_age(struct ethsw_port_priv *port_priv)
{ … }
static int dpaa2_switch_port_vlan_add(struct net_device *netdev, __be16 proto,
u16 vid)
{ … }
static int dpaa2_switch_port_vlan_kill(struct net_device *netdev, __be16 proto,
u16 vid)
{ … }
static int dpaa2_switch_port_set_mac_addr(struct ethsw_port_priv *port_priv)
{ … }
static void dpaa2_switch_free_fd(const struct ethsw_core *ethsw,
const struct dpaa2_fd *fd)
{ … }
static int dpaa2_switch_build_single_fd(struct ethsw_core *ethsw,
struct sk_buff *skb,
struct dpaa2_fd *fd)
{ … }
static netdev_tx_t dpaa2_switch_port_tx(struct sk_buff *skb,
struct net_device *net_dev)
{ … }
static int
dpaa2_switch_setup_tc_cls_flower(struct dpaa2_switch_filter_block *filter_block,
struct flow_cls_offload *f)
{ … }
static int
dpaa2_switch_setup_tc_cls_matchall(struct dpaa2_switch_filter_block *block,
struct tc_cls_matchall_offload *f)
{ … }
static int dpaa2_switch_port_setup_tc_block_cb_ig(enum tc_setup_type type,
void *type_data,
void *cb_priv)
{ … }
static LIST_HEAD(dpaa2_switch_block_cb_list);
static int
dpaa2_switch_port_acl_tbl_bind(struct ethsw_port_priv *port_priv,
struct dpaa2_switch_filter_block *block)
{ … }
static int
dpaa2_switch_port_acl_tbl_unbind(struct ethsw_port_priv *port_priv,
struct dpaa2_switch_filter_block *block)
{ … }
static int dpaa2_switch_port_block_bind(struct ethsw_port_priv *port_priv,
struct dpaa2_switch_filter_block *block)
{ … }
static int
dpaa2_switch_port_block_unbind(struct ethsw_port_priv *port_priv,
struct dpaa2_switch_filter_block *block)
{ … }
static int dpaa2_switch_setup_tc_block_bind(struct net_device *netdev,
struct flow_block_offload *f)
{ … }
static void dpaa2_switch_setup_tc_block_unbind(struct net_device *netdev,
struct flow_block_offload *f)
{ … }
static int dpaa2_switch_setup_tc_block(struct net_device *netdev,
struct flow_block_offload *f)
{ … }
static int dpaa2_switch_port_setup_tc(struct net_device *netdev,
enum tc_setup_type type,
void *type_data)
{ … }
static const struct net_device_ops dpaa2_switch_port_ops = …;
bool dpaa2_switch_port_dev_check(const struct net_device *netdev)
{ … }
static int dpaa2_switch_port_connect_mac(struct ethsw_port_priv *port_priv)
{ … }
static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv)
{ … }
static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
{ … }
static int dpaa2_switch_setup_irqs(struct fsl_mc_device *sw_dev)
{ … }
static void dpaa2_switch_teardown_irqs(struct fsl_mc_device *sw_dev)
{ … }
static int dpaa2_switch_port_set_learning(struct ethsw_port_priv *port_priv, bool enable)
{ … }
static int dpaa2_switch_port_attr_stp_state_set(struct net_device *netdev,
u8 state)
{ … }
static int dpaa2_switch_port_flood(struct ethsw_port_priv *port_priv,
struct switchdev_brport_flags flags)
{ … }
static int dpaa2_switch_port_pre_bridge_flags(struct net_device *netdev,
struct switchdev_brport_flags flags,
struct netlink_ext_ack *extack)
{ … }
static int dpaa2_switch_port_bridge_flags(struct net_device *netdev,
struct switchdev_brport_flags flags,
struct netlink_ext_ack *extack)
{ … }
static int dpaa2_switch_port_attr_set(struct net_device *netdev, const void *ctx,
const struct switchdev_attr *attr,
struct netlink_ext_ack *extack)
{ … }
int dpaa2_switch_port_vlans_add(struct net_device *netdev,
const struct switchdev_obj_port_vlan *vlan)
{ … }
static int dpaa2_switch_port_lookup_address(struct net_device *netdev, int is_uc,
const unsigned char *addr)
{ … }
static int dpaa2_switch_port_mdb_add(struct net_device *netdev,
const struct switchdev_obj_port_mdb *mdb)
{ … }
static int dpaa2_switch_port_obj_add(struct net_device *netdev,
const struct switchdev_obj *obj)
{ … }
static int dpaa2_switch_port_del_vlan(struct ethsw_port_priv *port_priv, u16 vid)
{ … }
int dpaa2_switch_port_vlans_del(struct net_device *netdev,
const struct switchdev_obj_port_vlan *vlan)
{ … }
static int dpaa2_switch_port_mdb_del(struct net_device *netdev,
const struct switchdev_obj_port_mdb *mdb)
{ … }
static int dpaa2_switch_port_obj_del(struct net_device *netdev,
const struct switchdev_obj *obj)
{ … }
static int dpaa2_switch_port_attr_set_event(struct net_device *netdev,
struct switchdev_notifier_port_attr_info *ptr)
{ … }
static int dpaa2_switch_port_bridge_join(struct net_device *netdev,
struct net_device *upper_dev,
struct netlink_ext_ack *extack)
{ … }
static int dpaa2_switch_port_clear_rxvlan(struct net_device *vdev, int vid, void *arg)
{ … }
static int dpaa2_switch_port_restore_rxvlan(struct net_device *vdev, int vid, void *arg)
{ … }
static void dpaa2_switch_port_pre_bridge_leave(struct net_device *netdev)
{ … }
static int dpaa2_switch_port_bridge_leave(struct net_device *netdev)
{ … }
static int dpaa2_switch_prevent_bridging_with_8021q_upper(struct net_device *netdev)
{ … }
static int
dpaa2_switch_prechangeupper_sanity_checks(struct net_device *netdev,
struct net_device *upper_dev,
struct netlink_ext_ack *extack)
{ … }
static int dpaa2_switch_port_prechangeupper(struct net_device *netdev,
struct netdev_notifier_changeupper_info *info)
{ … }
static int dpaa2_switch_port_changeupper(struct net_device *netdev,
struct netdev_notifier_changeupper_info *info)
{ … }
static int dpaa2_switch_port_netdevice_event(struct notifier_block *nb,
unsigned long event, void *ptr)
{ … }
struct ethsw_switchdev_event_work { … };
static void dpaa2_switch_event_work(struct work_struct *work)
{ … }
static int dpaa2_switch_port_event(struct notifier_block *nb,
unsigned long event, void *ptr)
{ … }
static int dpaa2_switch_port_obj_event(unsigned long event,
struct net_device *netdev,
struct switchdev_notifier_port_obj_info *port_obj_info)
{ … }
static int dpaa2_switch_port_blocking_event(struct notifier_block *nb,
unsigned long event, void *ptr)
{ … }
static struct sk_buff *dpaa2_switch_build_linear_skb(struct ethsw_core *ethsw,
const struct dpaa2_fd *fd)
{ … }
static void dpaa2_switch_tx_conf(struct dpaa2_switch_fq *fq,
const struct dpaa2_fd *fd)
{ … }
static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq,
const struct dpaa2_fd *fd)
{ … }
static void dpaa2_switch_detect_features(struct ethsw_core *ethsw)
{ … }
static int dpaa2_switch_setup_fqs(struct ethsw_core *ethsw)
{ … }
static void dpaa2_switch_free_bufs(struct ethsw_core *ethsw, u64 *buf_array, int count)
{ … }
static int dpaa2_switch_add_bufs(struct ethsw_core *ethsw, u16 bpid)
{ … }
static int dpaa2_switch_refill_bp(struct ethsw_core *ethsw)
{ … }
static int dpaa2_switch_seed_bp(struct ethsw_core *ethsw)
{ … }
static void dpaa2_switch_drain_bp(struct ethsw_core *ethsw)
{ … }
static int dpaa2_switch_setup_dpbp(struct ethsw_core *ethsw)
{ … }
static void dpaa2_switch_free_dpbp(struct ethsw_core *ethsw)
{ … }
static int dpaa2_switch_alloc_rings(struct ethsw_core *ethsw)
{ … }
static void dpaa2_switch_destroy_rings(struct ethsw_core *ethsw)
{ … }
static int dpaa2_switch_pull_fq(struct dpaa2_switch_fq *fq)
{ … }
static int dpaa2_switch_store_consume(struct dpaa2_switch_fq *fq)
{ … }
static int dpaa2_switch_poll(struct napi_struct *napi, int budget)
{ … }
static void dpaa2_switch_fqdan_cb(struct dpaa2_io_notification_ctx *nctx)
{ … }
static int dpaa2_switch_setup_dpio(struct ethsw_core *ethsw)
{ … }
static void dpaa2_switch_free_dpio(struct ethsw_core *ethsw)
{ … }
static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw)
{ … }
static void dpaa2_switch_remove_port(struct ethsw_core *ethsw,
u16 port_idx)
{ … }
static int dpaa2_switch_init(struct fsl_mc_device *sw_dev)
{ … }
static int dpaa2_switch_port_trap_mac_addr(struct ethsw_port_priv *port_priv,
const char *mac)
{ … }
static int dpaa2_switch_port_init(struct ethsw_port_priv *port_priv, u16 port)
{ … }
static void dpaa2_switch_ctrl_if_teardown(struct ethsw_core *ethsw)
{ … }
static void dpaa2_switch_teardown(struct fsl_mc_device *sw_dev)
{ … }
static void dpaa2_switch_remove(struct fsl_mc_device *sw_dev)
{ … }
static int dpaa2_switch_probe_port(struct ethsw_core *ethsw,
u16 port_idx)
{ … }
static int dpaa2_switch_probe(struct fsl_mc_device *sw_dev)
{ … }
static const struct fsl_mc_device_id dpaa2_switch_match_id_table[] = …;
MODULE_DEVICE_TABLE(fslmc, dpaa2_switch_match_id_table);
static struct fsl_mc_driver dpaa2_switch_drv = …;
static struct notifier_block dpaa2_switch_port_nb __read_mostly = …;
static struct notifier_block dpaa2_switch_port_switchdev_nb = …;
static struct notifier_block dpaa2_switch_port_switchdev_blocking_nb = …;
static int dpaa2_switch_register_notifiers(void)
{ … }
static void dpaa2_switch_unregister_notifiers(void)
{ … }
static int __init dpaa2_switch_driver_init(void)
{ … }
static void __exit dpaa2_switch_driver_exit(void)
{ … }
module_init(…) …;
module_exit(dpaa2_switch_driver_exit);
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;