Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.15 120 lines 3.5 kB view raw
1/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ 2/* 3 * Microsemi Ocelot Switch driver 4 * 5 * Copyright (c) 2017 Microsemi Corporation 6 */ 7 8#ifndef _MSCC_OCELOT_H_ 9#define _MSCC_OCELOT_H_ 10 11#include <linux/bitops.h> 12#include <linux/etherdevice.h> 13#include <linux/if_vlan.h> 14#include <linux/net_tstamp.h> 15#include <linux/phylink.h> 16#include <linux/platform_device.h> 17#include <linux/regmap.h> 18 19#include <soc/mscc/ocelot_qsys.h> 20#include <soc/mscc/ocelot_sys.h> 21#include <soc/mscc/ocelot_dev.h> 22#include <soc/mscc/ocelot_ana.h> 23#include <soc/mscc/ocelot_ptp.h> 24#include <soc/mscc/ocelot.h> 25#include "ocelot_rew.h" 26#include "ocelot_qs.h" 27 28#define OCELOT_BUFFER_CELL_SZ 60 29 30#define OCELOT_STATS_CHECK_DELAY (2 * HZ) 31 32#define OCELOT_PTP_QUEUE_SZ 128 33 34struct ocelot_port_tc { 35 bool block_shared; 36 unsigned long offload_cnt; 37 38 unsigned long police_id; 39}; 40 41struct ocelot_port_private { 42 struct ocelot_port port; 43 struct net_device *dev; 44 struct phylink *phylink; 45 struct phylink_config phylink_config; 46 u8 chip_port; 47 struct ocelot_port_tc tc; 48}; 49 50struct ocelot_dump_ctx { 51 struct net_device *dev; 52 struct sk_buff *skb; 53 struct netlink_callback *cb; 54 int idx; 55}; 56 57/* MAC table entry types. 58 * ENTRYTYPE_NORMAL is subject to aging. 59 * ENTRYTYPE_LOCKED is not subject to aging. 60 * ENTRYTYPE_MACv4 is not subject to aging. For IPv4 multicast. 61 * ENTRYTYPE_MACv6 is not subject to aging. For IPv6 multicast. 62 */ 63enum macaccess_entry_type { 64 ENTRYTYPE_NORMAL = 0, 65 ENTRYTYPE_LOCKED, 66 ENTRYTYPE_MACv4, 67 ENTRYTYPE_MACv6, 68}; 69 70/* A (PGID) port mask structure, encoding the 2^ocelot->num_phys_ports 71 * possibilities of egress port masks for L2 multicast traffic. 72 * For a switch with 9 user ports, there are 512 possible port masks, but the 73 * hardware only has 46 individual PGIDs that it can forward multicast traffic 74 * to. So we need a structure that maps the limited PGID indices to the port 75 * destinations requested by the user for L2 multicast. 76 */ 77struct ocelot_pgid { 78 unsigned long ports; 79 int index; 80 refcount_t refcount; 81 struct list_head list; 82}; 83 84struct ocelot_multicast { 85 struct list_head list; 86 enum macaccess_entry_type entry_type; 87 unsigned char addr[ETH_ALEN]; 88 u16 vid; 89 u16 ports; 90 struct ocelot_pgid *pgid; 91}; 92 93int ocelot_port_fdb_do_dump(const unsigned char *addr, u16 vid, 94 bool is_static, void *data); 95int ocelot_mact_learn(struct ocelot *ocelot, int port, 96 const unsigned char mac[ETH_ALEN], 97 unsigned int vid, enum macaccess_entry_type type); 98int ocelot_mact_forget(struct ocelot *ocelot, 99 const unsigned char mac[ETH_ALEN], unsigned int vid); 100struct net_device *ocelot_port_to_netdev(struct ocelot *ocelot, int port); 101int ocelot_netdev_to_port(struct net_device *dev); 102 103u32 ocelot_port_readl(struct ocelot_port *port, u32 reg); 104void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg); 105 106int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target, 107 struct device_node *portnp); 108void ocelot_release_port(struct ocelot_port *ocelot_port); 109int ocelot_devlink_init(struct ocelot *ocelot); 110void ocelot_devlink_teardown(struct ocelot *ocelot); 111int ocelot_port_devlink_init(struct ocelot *ocelot, int port, 112 enum devlink_port_flavour flavour); 113void ocelot_port_devlink_teardown(struct ocelot *ocelot, int port); 114 115extern struct notifier_block ocelot_netdevice_nb; 116extern struct notifier_block ocelot_switchdev_nb; 117extern struct notifier_block ocelot_switchdev_blocking_nb; 118extern const struct devlink_ops ocelot_devlink_ops; 119 120#endif