#include <linux/list.h>
#include <linux/ethtool.h>
#include <linux/if_ether.h>
#include <linux/in.h>
#include <linux/netdevice.h>
#include <net/dsa.h>
#include <linux/bitmap.h>
#include <net/flow_offload.h>
#include <net/switchdev.h>
#include <uapi/linux/if_bridge.h>
#include "bcm_sf2.h"
#include "bcm_sf2_regs.h"
struct cfp_rule { … };
struct cfp_udf_slice_layout { … };
struct cfp_udf_layout { … };
static const u8 zero_slice[UDFS_PER_SLICE] = …;
static const struct cfp_udf_layout udf_tcpip4_layout = …;
static const struct cfp_udf_layout udf_tcpip6_layout = …;
static inline unsigned int bcm_sf2_get_num_udf_slices(const u8 *layout)
{ … }
static inline u32 udf_upper_bits(int num_udf)
{ … }
static inline u32 udf_lower_bits(int num_udf)
{ … }
static unsigned int bcm_sf2_get_slice_number(const struct cfp_udf_layout *l,
unsigned int start)
{ … }
static void bcm_sf2_cfp_udf_set(struct bcm_sf2_priv *priv,
const struct cfp_udf_layout *layout,
unsigned int slice_num)
{ … }
static int bcm_sf2_cfp_op(struct bcm_sf2_priv *priv, unsigned int op)
{ … }
static inline void bcm_sf2_cfp_rule_addr_set(struct bcm_sf2_priv *priv,
unsigned int addr)
{ … }
static inline unsigned int bcm_sf2_cfp_rule_size(struct bcm_sf2_priv *priv)
{ … }
static int bcm_sf2_cfp_act_pol_set(struct bcm_sf2_priv *priv,
unsigned int rule_index,
int src_port,
unsigned int port_num,
unsigned int queue_num,
bool fwd_map_change)
{ … }
static void bcm_sf2_cfp_slice_ipv4(struct bcm_sf2_priv *priv,
struct flow_dissector_key_ipv4_addrs *addrs,
struct flow_dissector_key_ports *ports,
const __be16 vlan_tci,
unsigned int slice_num, u8 num_udf,
bool mask)
{ … }
static int bcm_sf2_cfp_ipv4_rule_set(struct bcm_sf2_priv *priv, int port,
unsigned int port_num,
unsigned int queue_num,
struct ethtool_rx_flow_spec *fs)
{ … }
static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv,
const __be32 *ip6_addr, const __be16 port,
const __be16 vlan_tci,
unsigned int slice_num, u32 udf_bits,
bool mask)
{ … }
static struct cfp_rule *bcm_sf2_cfp_rule_find(struct bcm_sf2_priv *priv,
int port, u32 location)
{ … }
static int bcm_sf2_cfp_rule_cmp(struct bcm_sf2_priv *priv, int port,
struct ethtool_rx_flow_spec *fs)
{ … }
static int bcm_sf2_cfp_ipv6_rule_set(struct bcm_sf2_priv *priv, int port,
unsigned int port_num,
unsigned int queue_num,
struct ethtool_rx_flow_spec *fs)
{ … }
static int bcm_sf2_cfp_rule_insert(struct dsa_switch *ds, int port,
struct ethtool_rx_flow_spec *fs)
{ … }
static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
struct ethtool_rx_flow_spec *fs)
{ … }
static int bcm_sf2_cfp_rule_del_one(struct bcm_sf2_priv *priv, int port,
u32 loc, u32 *next_loc)
{ … }
static int bcm_sf2_cfp_rule_remove(struct bcm_sf2_priv *priv, int port,
u32 loc)
{ … }
static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, int port, u32 loc)
{ … }
static void bcm_sf2_invert_masks(struct ethtool_rx_flow_spec *flow)
{ … }
static int bcm_sf2_cfp_rule_get(struct bcm_sf2_priv *priv, int port,
struct ethtool_rxnfc *nfc)
{ … }
static int bcm_sf2_cfp_rule_get_all(struct bcm_sf2_priv *priv,
int port, struct ethtool_rxnfc *nfc,
u32 *rule_locs)
{ … }
int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc, u32 *rule_locs)
{ … }
int bcm_sf2_set_rxnfc(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc)
{ … }
int bcm_sf2_cfp_rst(struct bcm_sf2_priv *priv)
{ … }
void bcm_sf2_cfp_exit(struct dsa_switch *ds)
{ … }
int bcm_sf2_cfp_resume(struct dsa_switch *ds)
{ … }
static const struct bcm_sf2_cfp_stat { … } bcm_sf2_cfp_stats[] = …;
void bcm_sf2_cfp_get_strings(struct dsa_switch *ds, int port,
u32 stringset, uint8_t *data)
{ … }
void bcm_sf2_cfp_get_ethtool_stats(struct dsa_switch *ds, int port,
uint64_t *data)
{ … }
int bcm_sf2_cfp_get_sset_count(struct dsa_switch *ds, int port, int sset)
{ … }