/****************************************************************************** ** ** FILE NAME : mcast_helper.h ** AUTHOR : ** DESCRIPTION : Multicast Helper module header file ** COPYRIGHT : Copyright (c) 2020-2021, MaxLinear, Inc. ** Copyright (c) 2014 2015 Lantiq Beteiligungs-GmbH & Co. KG ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** *******************************************************************************/ /* * mcast_helper.h - the header file with the ioctl definitions. * */ #ifndef _MCAST_HELPER_H #define _MCAST_HELPER_H #include #include #include #include #include #include /* Device information for IOCTL */ #define DEVICE_NAME "mcast" #define FIRST_MINOR 0 #define MINOR_CNT 1 #define MCH_MAGIC 'M' #define MCH_MEMBER_ENTRY_ADD _IOR(MCH_MAGIC, 0, char *) #define MCH_MEMBER_ENTRY_UPDATE _IOR(MCH_MAGIC, 1, char *) #define MCH_MEMBER_ENTRY_REMOVE _IOR(MCH_MAGIC, 2, char *) #define MCH_SERVER_ENTRY_GET _IOR(MCH_MAGIC, 3, char *) #define SUCCESS (0) #define FAILURE (-1) typedef struct _mcast_mac_t { /* Host MAC address */ u8 macaddr[ETH_ALEN]; /* mcast_mac map list */ struct list_head list; #if IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) /* RCU head */ struct rcu_head rcu; #endif } mcast_mac_t; typedef struct _mcast_member_t { /* Member netdevice */ struct net_device *mem_dev; #ifdef CONFIG_MCAST_HELPER_ACL /* Flag indicates acl status blocked(1)/unblocked(0) */ u32 acl_blocked; #endif /* MAC address count */ u32 macaddr_count; /* mcast_member interface map list */ struct list_head list; #if IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) /* RCU head */ struct rcu_head rcu; #endif /* Host MAC address list */ struct list_head macaddr_list; } mcast_member_t; typedef struct _mcast_gid_t { /* MultiCast Group Index */ u32 gid; #if IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) /* Member VLAN */ u16 eg_vlan; #endif /* Five tuple stream info */ mcast_stream_t mc_stream; #ifdef CONFIG_MCAST_HELPER_ACL /* Output interface bitmap */ u64 oif_bitmap; /* Probe Packet generate flag enable(1)/disable(0) */ u32 probe_flag; #endif #if IS_ENABLED(CONFIG_MCAST_SNOOPING) /* Callback indication for the stream */ int br_callback_flag; #endif /* mcast_gid map list */ struct list_head list; #if IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) /* RCU head */ struct rcu_head rcu; #endif /* DS member interface list */ struct list_head mc_mem_list; } mcast_gid_t; typedef struct _mcast_rec_t { /* Member netdevice name */ char mem_ifname[IFNAMSIZ]; /* RX member netdevice name */ char rx_ifname[IFNAMSIZ]; /* Destination IP (GA) - IPV4 or IPV6 */ ip_addr_t group_ip; /* Source IP - IPV4 or IPV6 (optional) */ ip_addr_t src_ip; /* Protocol number */ u32 proto; /* Source port */ u32 src_port; /* Destination port */ u32 dst_port; /* Host MAC address */ u8 macaddr[ETH_ALEN]; } mcast_rec_t; #if IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) /* External APIs or callback pointers */ extern int mcast_helper_invoke_callback(u32 grpidx, struct net_device *netdev, void *mc_stream, u32 flag); extern void (*mcast_helper_br_learning_hook)(struct sk_buff *skb, struct net_device *dev, u8 *host_mac); extern int (*mcast_helper_sig_check_update_ptr)(struct sk_buff *skb); #endif #endif /* _MCAST_HELPER_H */