From 51b6c503238baaf28c9f6ff35d95f1cb37cd92b0 Mon Sep 17 00:00:00 2001
From: Rahul Thakur <rahul.thakur@iopsys.eu>
Date: Tue, 4 Apr 2023 15:58:44 +0530
Subject: [PATCH] libethernet: update bcm

---
 bcm/bcm.c           |  23 +-
 bcm/bcmnet.h        | 582 -------------------------------
 bcm/bcmswapitypes.h | 829 --------------------------------------------
 bcm/bcmtypes.h      | 168 ---------
 bcm/net_port.h      | 101 ------
 5 files changed, 13 insertions(+), 1690 deletions(-)
 delete mode 100644 bcm/bcmnet.h
 delete mode 100644 bcm/bcmswapitypes.h
 delete mode 100644 bcm/bcmtypes.h
 delete mode 100644 bcm/net_port.h

diff --git a/bcm/bcm.c b/bcm/bcm.c
index 3790596..382392b 100644
--- a/bcm/bcm.c
+++ b/bcm/bcm.c
@@ -34,10 +34,10 @@
 #include <stdbool.h>
 #include <linux/mii.h>
 #include <easy/easy.h>
+#include <bcm/bcmswapitypes.h>
+#include <bcmnet.h>
 
 #include "../ethernet.h"
-#include "bcmswapitypes.h"
-#include "bcmnet.h"
 
 /* invalid stat counter values */
 #define INVALID_UINT64	UINT64_MAX
@@ -122,28 +122,31 @@ int bcm_eth_get_link_settings(const char *ifname, struct eth_link *link)
 	/* libethernet_dbg("port: %d  speed = %d  fullduplex = %d\n",
 			link->portid, link->speed, link->fullduplex); */
 
-	if (!!(data.phycfg & PHY_CFG_1000FD))
+	if (!!(data.phycfg & PHY_CAP_1000_FULL))
 		link->capability |= ETH_1000_Full;
 
-	if (!!(data.phycfg & PHY_CFG_1000HD))
+	if (!!(data.phycfg & PHY_CAP_1000_HALF))
 		link->capability |= ETH_1000_Half;
 
-	if (!!(data.phycfg & PHY_CFG_100FD))
+	if (!!(data.phycfg & PHY_CAP_100_FULL))
 		link->capability |= ETH_100_Full;
 
-	if (!!(data.phycfg & PHY_CFG_100HD))
+	if (!!(data.phycfg & PHY_CAP_100_HALF))
 		link->capability |= ETH_100_Half;
 
-	if (!!(data.phycfg & PHY_CFG_10FD))
+	if (!!(data.phycfg & PHY_CAP_10_FULL))
 		link->capability |= ETH_10_Full;
 
-	if (!!(data.phycfg & PHY_CFG_10HD))
+	if (!!(data.phycfg & PHY_CAP_10_HALF))
 		link->capability |= ETH_10_Half;
 
-	if (!!(data.phycfg & PHY_CFG_5000FD))
+	if (!!(data.phycfg & PHY_CAP_2500))
+		link->capability |= ETH_2500_Full;
+
+	if (!!(data.phycfg & PHY_CAP_5000))
 		link->capability |= ETH_5000_Full;
 
-	if (!!(data.phycfg & PHY_CFG_10000FD))
+	if (!!(data.phycfg & PHY_CAP_10000))
 		link->capability |= ETH_10000_Full;
 
 
diff --git a/bcm/bcmnet.h b/bcm/bcmnet.h
deleted file mode 100644
index ae67bd6..0000000
--- a/bcm/bcmnet.h
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
-    Copyright 2000-2011 Broadcom Corporation
-
-    <:label-BRCM:2011:DUAL/GPL:standard
-    
-    Unless you and Broadcom execute a separate written software license
-    agreement governing use of this software, this software is licensed
-    to you under the terms of the GNU General Public License version 2
-    (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
-    with the following added to such license:
-    
-       As a special exception, the copyright holders of this software give
-       you permission to link this software with independent modules, and
-       to copy and distribute the resulting executable under terms of your
-       choice, provided that you also meet, for each linked independent
-       module, the terms and conditions of the license of that module.
-       An independent module is a module which is not derived from this
-       software.  The special exception does not apply to any modifications
-       of the software.
-    
-    Not withstanding the above, under no circumstances may you combine
-    this software in any way with any other Broadcom software provided
-    under a license other than the GPL, without Broadcom's express prior
-    written consent.
-    
-    :>
-*/
-
-/***********************************************************************/
-/*                                                                     */
-/*   MODULE:  bcmnet.h                                                 */
-/*   DATE:    05/16/02                                                 */
-/*   PURPOSE: network interface ioctl definition                       */
-/*                                                                     */
-/***********************************************************************/
-#ifndef _IF_NET_H_
-#define _IF_NET_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <linux/sockios.h>
-#if defined(CONFIG_COMPAT)
-#include <linux/compat.h>
-#endif
-#include "skb_defines.h"
-#include "bcmPktDma_defines.h"
-#include "bcmtypes.h"
-
-#define LINKSTATE_DOWN      0
-#define LINKSTATE_UP        1
-
-#ifndef IFNAMSIZ
-#define IFNAMSIZ  16
-#endif
-
-/*---------------------------------------------------------------------*/
-/* Ethernet Switch Type                                                */
-/*---------------------------------------------------------------------*/
-#define ESW_TYPE_UNDEFINED                  0
-#define ESW_TYPE_BCM5325M                   1
-#define ESW_TYPE_BCM5325E                   2
-#define ESW_TYPE_BCM5325F                   3
-#define ESW_TYPE_BCM53101                   4
-
-#define ETHERNET_ROOT_DEVICE_NAME     "bcmsw"
-
-/*
- * Ioctl definitions.
- */
-/* Note1: The maximum device private ioctls allowed are 16 */
-/* Note2: SIOCDEVPRIVATE is reserved */
-enum {
-    SIOCGLINKSTATE = SIOCDEVPRIVATE + 1,
-    SIOCSCLEARMIBCNTR,
-    SIOCMIBINFO,
-    SIOCGENABLEVLAN,
-    SIOCGDISABLEVLAN,
-    SIOCGQUERYNUMVLANPORTS,
-    SIOCGQUERYNUMPORTS,
-    SIOCPORTMIRROR,
-    SIOCSWANPORT,
-    SIOCGWANPORT,
-    SIOCETHCTLOPS,
-    SIOCGPONIF,
-    SIOCETHSWCTLOPS,
-    SIOCGSWITCHPORT,
-    SIOCIFREQ_EXT,
-    SIOCLAST,
-};
-
-/* Various operations through the SIOCETHCTLOPS */
-enum {
-    ETHGETNUMTXDMACHANNELS = 0,
-    ETHSETNUMTXDMACHANNELS,
-    ETHGETNUMRXDMACHANNELS,
-    ETHSETNUMRXDMACHANNELS,   
-    ETHGETSOFTWARESTATS,
-    ETHGETMIIREG,
-    ETHSETMIIREG,
-    ETHSETLINKSTATE,
-    ETHGETCOREID,
-    ETHGETPHYEEE,
-    ETHSETPHYEEEON,
-    ETHSETPHYEEEOFF,
-    ETHGETPHYEEERESOLUTION,
-    ETHSETPHYWOLSLEEP,
-    ETHGETPHYAPD,
-    ETHSETPHYAPDON,
-    ETHSETPHYAPDOFF,
-    ETHGETPHYPWR,
-    ETHSETPHYPWRON,
-    ETHSETPHYPWROFF,
-    ETHMOVESUBPORT,
-    ETHPHYMAP,
-    ETHGETPHYID,
-    ETHG9991CARRIERON,
-    ETHG9991CARRIEROFF,
-    ETHCDGET,
-    ETHCDSET,
-    ETHCDRUN,
-    ETHGETSFPINFO,
-    ETHPHYMACSEC,
-    ETHWIRESPEEDGET,
-    ETHWIRESPEEDSET,
-};
-
-struct ethctl_data {
-    /* ethctl ioctl operation */
-    int op;
-    /* number of DMA channels */
-    int num_channels;
-    /* return value for get operations */
-    int ret_val;
-    /* value for set operations */
-    int val;
-    int sub_port;
-    unsigned int phy_addr;
-    unsigned int phy_reg;
-    /* flags to indicate to ioctl functions */
-    unsigned int flags;
-    union {
-        char ifname[IFNAMSIZ];
-#define ETHCTL_FLAG_MPMAC_SET    (1<<0)
-        char mpmac[6];
-    };
-    BCM_IOC_PTR(char *, buf);
-    int buf_size;
-    int pair_len[4];
-};
-
-typedef enum {
-    SFP_TYPE_XPON,
-    SFP_TYPE_ETHERNET,
-    SFP_TYPE_UNKNOWN,
-    SFP_TYPE_NOT_ETHERNET,  /* Active Ethernet Port not defined in board paramters */
-    SFP_TYPE_NO_MODULE,
-} sfp_type_t;
-
-enum {
-    CD_INVALID,
-    CD_OK,
-    CD_OPEN,
-    CD_INTRA_SHORT,
-    CD_INTER_SHORT,
-    CD_ENABLED,
-    CD_DISABLED,
-    CD_NOT_SUPPORTED,
-    CD_ALL_PAIR_OK=0x1111,
-    CD_ALL_PAIR_OPEN=0x2222,
-};
-#define CD_CODE_PAIR_GET(v, p)          (((v)>>((p)*4))&0xf)
-#define CD_CODE_PAIR_SET(v, p)          (((v)&0xf)<<((p)*4))
-
-/* Flags for Cable Diagnostic */
-#define INTERFACE_NEXT    (1<<0)
-#define CD_LINK_UP           (1<<1)
-/* ethctl ret_val definitions */
-enum {
-    ETHCTL_RET_OK   = 0,
-    ETHMOVESUBPORT_RET_INVALID_EP,
-    ETHMOVESUBPORT_RET_SRCDEV_UP,
-    ETHMOVESUBPORT_RET_DSTDEV_UP,
-    ETHMOVESUBPORT_RET_MAC2MAC,
-    ETHMOVESUBPORT_RET_NOT_MOVEABLE,
-};
-
-/* PHY type */
-enum {
-    ETHCTL_FLAG_ACCESS_INT_PHY              = 0,
-    ETHCTL_FLAG_ACCESS_EXT_PHY              = (1<<0),
-    ETHCTL_FLAG_ACCESS_EXTSW_PHY            = (1<<1),
-    ETHCTL_FLAG_ACCESS_I2C_PHY              = (1<<2),
-    ETHCTL_FLAG_ACCESS_SERDES               = (1<<3),
-    ETHCTL_FLAG_ACCESS_SERDES_POWER_MODE    = (1<<4),
-    ETHCTL_FLAG_ACCESS_32BIT                = (1<<5),
-    ETHCTL_FLAG_ACCESS_10GSERDES            = (1<<6),
-    ETHCTL_FLAG_ACCESS_10GPCS               = (1<<7),
-    ETHCTL_FLAG_ACCESS_SILENT_START         = (1<<8),
-};
-#define ETHCTL_FLAG_ANY_SERDES  (ETHCTL_FLAG_ACCESS_SERDES|ETHCTL_FLAG_ACCESS_10GSERDES)
-
-enum ethctl_error {
-    ETHCTL_ERROR_POWER_SAVING_DOWN = -100,
-    ETHCTL_ERROR_POWER_ADMIN_DOWN = -101,
-};
-
-enum {
-    SERDES_NO_POWER_SAVING, 
-    SERDES_BASIC_POWER_SAVING, 
-    SERDES_ADVANCED_POWER_SAVING, 
-    SERDES_FORCE_OFF,
-    SERDES_POWER_MODE_MAX};
-
-/* Various operations through the SIOCGPONIF */
-enum {
-    GETFREEGEMIDMAP = 0,
-    SETGEMIDMAP,
-    GETGEMIDMAP,
-    CREATEGPONVPORT,
-    DELETEGPONVPORT,
-    DELETEALLGPONVPORTS,
-    SETMCASTGEMID,
-};
-
-struct interface_data{
-    char ifname[IFNAMSIZ];
-    int switch_port_id;
-};
-
-/* Definition for IFREQ extension structure to
-   support more IFREQs than kernel allocated 16 types */
-struct ifreq_ext {
-    int opcode;
-    /* add union struct for different opcode's data below if needed */
-    union 
-    {
-        struct {
-            BCM_IOC_PTR(char *, stringBuf);
-            int bufLen;
-        };
-    };
-};
-typedef struct ifreq_ext ifreq_ext_t;
-
-/* Definition for opcode */
-enum
-{
-    SIOCGPORTWANONLY,
-    SIOCGPORTWANPREFERRED,
-    SIOCGPORTLANONLY,
-};
-
-/* The enet driver subdivides queue field (mark[4:0]) in the skb->mark into
-   priority and channel */
-/* priority = queue[2:0] (=>mark[2:0]) */
-#define SKBMARK_Q_PRIO_S        (SKBMARK_Q_S)
-#define SKBMARK_Q_PRIO_M        (0x07 << SKBMARK_Q_PRIO_S)
-#define SKBMARK_GET_Q_PRIO(MARK) \
-    ((MARK & SKBMARK_Q_PRIO_M) >> SKBMARK_Q_PRIO_S)
-#define SKBMARK_SET_Q_PRIO(MARK, Q) \
-    ((MARK & ~SKBMARK_Q_PRIO_M) | (Q << SKBMARK_Q_PRIO_S))
-/* channel = queue[4:3] (=>mark[4:3]) */
-#define SKBMARK_Q_CH_S          (SKBMARK_Q_S + 3)
-#define SKBMARK_Q_CH_M          (0x03 << SKBMARK_Q_CH_S)
-#define SKBMARK_GET_Q_CHANNEL(MARK) ((MARK & SKBMARK_Q_CH_M) >> SKBMARK_Q_CH_S)
-#define SKBMARK_SET_Q_CHANNEL(MARK, CH) \
-    ((MARK & ~SKBMARK_Q_CH_M) | (CH << SKBMARK_Q_CH_S))
-
-#define SPEED_10MBIT        10000000
-#define SPEED_100MBIT       100000000
-#define SPEED_200MBIT       200000000
-#define SPEED_1000MBIT      1000000000
-#define SPEED_2500MBIT      2500000000u
-#define SPEED_5000MBIT      5000000000ull
-#define SPEED_10000MBIT     10000000000ull
-#define SPEED_DOWN          0
-
-#define BCMNET_DUPLEX_HALF         0
-#define BCMNET_DUPLEX_FULL         1
-
-// Use for Auto negotiation capability
-#define AN_10M_HALF           0x0001
-#define AN_10M_FULL           0x0002
-#define AN_100M_HALF          0x0004
-#define AN_100M_FULL          0x0008
-#define AN_1000M_HALF         0x0010
-#define AN_1000M_FULL         0x0020
-#define AN_2500               0x0040
-#define AN_5000               0x0080
-#define AN_10000              0x0100
-#define AN_AUTONEG            0x0200
-#define AN_FLOW_CONTROL       0x0400
-#define AN_FLOW_CONTROL_ASYM  0x0800
-#define AN_REPEATER           0x1000
-
-#define AUTONEG_CTRL_MASK 0x01
-#define AUTONEG_RESTART_MASK 0x02
-
-
-typedef struct IoctlMibInfo
-{
-    uint32 ulIfLastChange;
-    uint64 ulIfSpeed;
-    uint32 ulIfDuplex;
-} IOCTL_MIB_INFO, *PIOCTL_MIB_INFO;
-
-
-#define MIRROR_INTF_SIZE    32
-#define MIRROR_DIR_IN       0
-#define MIRROR_DIR_OUT      1
-#define MIRROR_DISABLED     0
-#define MIRROR_ENABLED      1
-
-typedef struct _MirrorCfg
-{
-    char szMonitorInterface[MIRROR_INTF_SIZE];
-    char szMirrorInterface[MIRROR_INTF_SIZE];
-    int nDirection;
-    int nStatus;
-#if defined(DMP_X_ITU_ORG_GPON_1) && defined(CONFIG_BCM_MAX_GEM_PORTS)
-    /* +1 is when CONFIG_BCM_MAX_GEM_PORTS is not a multiple of 8 */
-    unsigned char nGemPortMaskArray[(CONFIG_BCM_MAX_GEM_PORTS/8)+1]; 
-#endif
-} MirrorCfg ;
-
-int sfp_i2c_phy_read( int reg, int *data);
-int sfp_i2c_phy_write( int reg, int data);
-
-int bcmeapi_init_wan(void);
-
-/* VLAN TPIDs that need to be checked
-   ETH_P_8021Q  0x8100
-   ETH_P_8021AD 0x88A8
-   ETH_P_QINQ1  0x9100
-   ETH_P_QINQ2  0x9200
- */
-#define BCM_VLAN_TPID_CHECK(x) ( (x) == htons(ETH_P_8021Q) \
-                                || (x) == htons(ETH_P_8021AD)  \
-                             /* || (x) == htons(ETH_P_QINQ1) */\
-                             /* || (x) == htons(ETH_P_QINQ2) */)
-
-#define check_arp_lcp_pkt(pkt_p, ret_val)   {                                                                       \
-            unsigned char l3_offset = sizeof(struct ethhdr);                                                        \
-            struct vlan_hdr    *vlanhdr = (struct vlan_hdr *)(pkt_p + l3_offset - sizeof(struct vlan_hdr));         \
-            ret_val = 0;                                                                                            \
-            /* Skip over all the VLAN Tags */                                                                       \
-            while ( BCM_VLAN_TPID_CHECK(vlanhdr->h_vlan_encapsulated_proto) )                                       \
-            {                                                                                                       \
-                vlanhdr = (struct vlan_hdr *)(pkt_p + l3_offset);                                                   \
-                l3_offset +=  sizeof(struct vlan_hdr);                                                              \
-            }                                                                                                       \
-            if (vlanhdr->h_vlan_encapsulated_proto == htons(ETH_P_ARP))                                             \
-            {                                                                                                       \
-                ret_val = 1;                                                                                        \
-            }                                                                                                       \
-            else if ( vlanhdr->h_vlan_encapsulated_proto == htons(ETH_P_PPP_DISC) )                                 \
-            {                                                                                                       \
-                ret_val = 1;                                                                                        \
-            }                                                                                                       \
-            else if ( vlanhdr->h_vlan_encapsulated_proto == htons(ETH_P_PPP_SES) )                                  \
-            {                                                                                                       \
-                struct pppoe_hdr *pppoe = (struct pppoe_hdr *)(pkt_p + l3_offset);                                  \
-                                                                                                                    \
-                if ( ! (pppoe->tag[0].tag_type  == htons(PPP_IP) || pppoe->tag[0].tag_type  == htons(PPP_IPV6)) )   \
-                {                                                                                                   \
-                    ret_val = 1;                                                                                    \
-                }                                                                                                   \
-            }                                                                                                       \
-    }
-
-enum Bcm63xxEnetStats {
-    ET_TX_BYTES = 0,
-    ET_TX_PACKETS,
-    ET_TX_ERRORS,
-    ET_TX_CAPACITY,
-    ET_RX_BYTES,
-    ET_RX_PACKETS, 
-    ET_RX_ERRORS,
-    ET_MAX
-};
-
-typedef struct mac_limit_arg{
-    uint32 cmd;
-    uint32 val;
-    union {
-        void *mac_limit;
-        char rsvd[8];
-    };
-}mac_limit_arg_t;
-
-enum mac_limit_cmd{
-    MAC_LIMIT_IOCTL_GET = 0,
-    MAC_LIMIT_IOCTL_SET,
-    MAC_LIMIT_IOCTL_CLR,
-    MAC_LIMIT_IOCTL_EN
-};
-
-enum mac_limit_set_op{
-    MAC_LIMIT_SET_MAX = 0,
-    MAC_LIMIT_SET_MIN,
-};
-
-/*------------------------------------------------------------------------*/
-/* BCM net character device for ioctl to get/set netdev BRCM private info */
-/*------------------------------------------------------------------------*/
-#define BCMNET_DRV_MAJOR            377
-#define BCMNET_DRV_NAME             "bcmnet"
-#define BCMNET_DRV_DEVICE_NAME      "/dev/" BCMNET_DRV_NAME
-
-typedef enum bcmnet_ioctl_cmd
-{
-    BCMNET_IOCTL_GET_EXT_FLAGS,
-    BCMNET_IOCTL_GET_LAST_CHANGE,
-    BCMNET_IOCTL_CLR_STATS,
-    BCMNET_IOCTL_ADD_NETDEV_PATH,
-    BCMNET_IOCTL_MAC_LIMIT,
-    BCMNET_IOCTL_MAX
-} bcmnet_ioctl_cmd_t;
-
-typedef struct {
-    unsigned int unused : 25;
-    unsigned int is_bcm_dev : 1;
-    unsigned int is_wlan : 1;
-    unsigned int is_hw_switch : 1;
-    unsigned int is_hw_fdb : 1;
-    unsigned int is_ppp : 1;
-    unsigned int is_vlan : 1;
-    unsigned int is_wan : 1;
-} bcmnet_extflags;
-
-typedef struct {
-    char if_name[IFNAMSIZ];
-    union {
-        struct {
-            bcmnet_extflags ret_val;
-        }st_get_ext_flags;
-        struct {
-            unsigned long last_change;
-        }st_get_last_change;
-        struct {
-            char next_if_name[IFNAMSIZ];
-        }st_add_netdev_path;
-        mac_limit_arg_t st_mac_limit;
-    };
-}bcmnet_info_t;
-
-#if defined(CONFIG_COMPAT)
-typedef struct mac_limit_compat_arg{
-    uint32 cmd;
-    uint32 val;
-    union {
-        compat_uptr_t mac_limit;
-        char rsvd[8];
-    };
-}compat_mac_limit_arg_t;
-
-typedef struct {
-    char if_name[IFNAMSIZ];
-    union {
-        struct {
-            bcmnet_extflags ret_val;
-        }st_get_ext_flags;
-        struct {
-            unsigned long last_change;
-        }st_get_last_change;
-        struct {
-            char next_if_name[IFNAMSIZ];
-        }st_add_netdev_path;
-        compat_mac_limit_arg_t st_mac_limit;
-    };
-}compat_bcmnet_info_t;
-#endif
-
-#if !defined(__KERNEL__)
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <string.h>
-
-
-// return 0 if successful, -1 - error
-static inline int bcmnet_ioctl_get_ext_flags(char const* if_name, bcmnet_extflags* flags)
-{
-    bcmnet_info_t info;
-    int fd, err;
-
-    fd = open(BCMNET_DRV_DEVICE_NAME, O_RDWR);
-    if (fd < 0)
-        return -1;
-
-    strncpy(info.if_name, if_name, IFNAMSIZ);
-    err = ioctl(fd, BCMNET_IOCTL_GET_EXT_FLAGS, &info);
-    close(fd);
-    if (err == -1)
-        return err;
-    *flags = info.st_get_ext_flags.ret_val;
-    return 0;
-}
-
-// return 1 - dev is WAN, 0 - dev is not WAN, -1 - error
-static inline int bcmnet_ioctl_iswandev(char const* if_name)
-{
-    bcmnet_extflags flags;
-    int ret;
-
-    ret = bcmnet_ioctl_get_ext_flags(if_name, &flags);
-    if (ret < 0)
-        return -1;
-
-    return flags.is_wan;
-}
-
-// return 1 - dev is VLAN, 0 - dev is not VLAN, -1 - error
-static inline int bcmnet_ioctl_isvlandev(char const* if_name)
-{
-    bcmnet_extflags flags;
-    int ret;
-
-    ret = bcmnet_ioctl_get_ext_flags(if_name, &flags);
-    if (ret < 0)
-        return -1;
-
-    return flags.is_vlan;
-}
-
-// return last transction jiffies, 0 if there is error
-static inline unsigned long bcmnet_ioctl_get_last_change(char* if_name)
-{
-    bcmnet_info_t info;
-    int fd, err;
-
-    fd = open(BCMNET_DRV_DEVICE_NAME, O_RDWR);
-    if (fd < 0)
-        return 0;
-
-    strncpy(info.if_name, if_name, IFNAMSIZ);
-    err = ioctl(fd, BCMNET_IOCTL_GET_LAST_CHANGE, &info);
-    close(fd);
-    if (err == -1)
-        return 0;
-    return info.st_get_last_change.last_change;
-}
-
-static inline void bcmnet_ioctl_clr_stat(char* if_name)
-{
-    bcmnet_info_t info;
-    int fd;
-
-    fd = open(BCMNET_DRV_DEVICE_NAME, O_RDWR);
-    if (fd < 0)
-        return;
-
-    strncpy(info.if_name, if_name, IFNAMSIZ);
-    ioctl(fd, BCMNET_IOCTL_CLR_STATS, &info);
-    close(fd);
-}
-
-static inline int bcmnet_ioctl_add_netdev_path(char const* dev_name, char const* next_dev_name)
-{
-    bcmnet_info_t info;
-    int fd, err;
-
-    fd = open(BCMNET_DRV_DEVICE_NAME, O_RDWR);
-    if (fd < 0)
-        return -1;
-
-    strncpy(info.if_name, dev_name, IFNAMSIZ);
-    strncpy(info.st_add_netdev_path.next_if_name, next_dev_name, IFNAMSIZ);
-    err = ioctl(fd, BCMNET_IOCTL_ADD_NETDEV_PATH, &info);
-    close(fd);
-    return err;
-}
-
-#endif //!__KERNEL__
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IF_NET_H_ */
diff --git a/bcm/bcmswapitypes.h b/bcm/bcmswapitypes.h
deleted file mode 100644
index 3c5ddd8..0000000
--- a/bcm/bcmswapitypes.h
+++ /dev/null
@@ -1,829 +0,0 @@
-/* 
-* <:copyright-BRCM:2011:DUAL/GPL:standard
-* 
-*    Copyright (c) 2011 Broadcom 
-*    All Rights Reserved
-* 
-* Unless you and Broadcom execute a separate written software license
-* agreement governing use of this software, this software is licensed
-* to you under the terms of the GNU General Public License version 2
-* (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
-* with the following added to such license:
-* 
-*    As a special exception, the copyright holders of this software give
-*    you permission to link this software with independent modules, and
-*    to copy and distribute the resulting executable under terms of your
-*    choice, provided that you also meet, for each linked independent
-*    module, the terms and conditions of the license of that module.
-*    An independent module is a module which is not derived from this
-*    software.  The special exception does not apply to any modifications
-*    of the software.
-* 
-* Not withstanding the above, under no circumstances may you combine
-* this software in any way with any other Broadcom software provided
-* under a license other than the GPL, without Broadcom's express prior
-* written consent.
-* 
-* :>
-*/
-
-
-#ifndef __BCM_SWAPI_TYPES_H__
-#define __BCM_SWAPI_TYPES_H__
-
-#include "bcmtypes.h"
-#include "net_port.h"
-
-/*
- * BCM API error codes.
- *
- * Note: An error code may be converted to a string by passing the code
- * to bcm_errmsg().
- */
-typedef enum bcm_error_e {
-  BCM_E_NONE = 0,
-  BCM_E_INTERNAL,
-  BCM_E_MEMORY,
-  BCM_E_UNIT,
-  BCM_E_PARAM,
-  BCM_E_EMPTY,
-  BCM_E_FULL,
-  BCM_E_NOT_FOUND,
-  BCM_E_EXISTS,
-  BCM_E_TIMEOUT,
-  BCM_E_BUSY,
-  BCM_E_FAIL,
-  BCM_E_DISABLED,
-  BCM_E_BADID,
-  BCM_E_RESOURCE,
-  BCM_E_CONFIG,
-  BCM_E_UNAVAIL,
-  BCM_E_INIT,
-  BCM_E_PORT
-} bcm_error_t;
-
-typedef int bcm_port_t;
-
-/* bcm_vlan_t */
-typedef unsigned short bcm_vlan_t;
-
-/* bcm_vlan_tag_t */
-typedef unsigned int bcm_vlan_tag_t;
-
-/* bcm_cos_t */
-typedef int bcm_cos_t;
-
-/* bcm_cos_queue_t */
-typedef int bcm_cos_queue_t;
-
-/* Various operations through the SIOCETHSWCTLOPS */
-enum {
-    ETHSWDUMPMIB = 0,
-    ETHSWPORTCREATE,
-    ETHSWPORTDELETE,
-    ETHSWPORTMCASTGEMSET,
-    ETHSWSWITCHING,
-    ETHSWCONTROL,
-    ETHSWPRIOCONTROL,
-    ETHSWPORTPAUSECAPABILITY,
-    ETHSWVLAN,
-    ETHSWPBVLAN,
-    ETHSWCOSSCHED,              /* 10 */
-    ETHSWCOSPORTMAP,
-    ETHSWSTATPORTCLR,
-    ETHSWPORTRXRATE,
-    ETHSWPORTTXRATE,
-    ETHSWTEST1,
-    ETHSWARLACCESS,
-    ETHSWCOSPRIORITYMETHOD,
-    ETHSWREGACCESS,
-    ETHSWPSEUDOMDIOACCESS,
-    ETHSWINFO,                  /* 20 */
-    ETHSWLINKSTATUS,
-    ETHSWPORTTRAFFICCTRL,
-    ETHSWPORTLOOPBACK,
-    ETHSWPHYMODE,
-    ETHSWMACLMT,
-    ETHSWJUMBO, 
-    ETHSWCOSDSCPPRIOMAP,
-    ETHSWPHYCFG,
-    ETHSWGETIFNAME,
-    ETHSWMULTIPORT,             /* 30 */ 
-    ETHSWUNITPORT,
-    ETHSWDOSCTRL,
-    ETHSWHWSTP,
-    ETHSWSOFTSWITCHING,
-    ETHSWEMACGET,
-    ETHSWEMACCLEAR,
-    ETHSWPHYAUTONEG,
-    ETHSWPORTSALDAL,
-    ETHSWPORTTRANSPARENT,
-    ETHSWPORTVLANISOLATION,     /* 40 */
-    ETHSWACBCONTROL,
-    ETHSWMIRROR,
-    ETHSWPORTTRUNK,
-    ETHSWIFSTP,
-    ETHSWCPUMETER,
-    ETHSWPORTSHAPERCFG,
-    ETHSWCOSPCPPRIOMAP,
-    ETHSWCOSPIDPRIOMAP,
-    ETHSWRDPAPORTGETFROMNAME,
-    ETHSWPHYAPD,                /* 50 */
-    ETHSWPHYEEE,
-    ETHSWDEEPGREENMODE,
-    ETHSWPHYAUTONEGCAPADV,
-    ETHSWQUEMON,
-    ETHSWQUEMAP,
-    ETHSWPORTSTORMCTRL,
-    ETHSWOAMIDXMAPPING,
-    ETHSWCFP,
-    ETHSWSWITCHFLAG,
-    ETHSWAUTOMDIX,              /* 60 */
-};
-
-typedef struct cfpArg_s {
-    unsigned int rc; 
-    unsigned int argFlag;
-    unsigned int unit;
-    unsigned int priority;
-    unsigned int index;
-    unsigned int l2_framing;
-    unsigned int l3_framing;
-    unsigned int chg_fpmap_ib;
-    unsigned int fpmap_ib;
-    unsigned int spmap;
-    unsigned int pppoe; 
-    unsigned int etype_sap;
-    unsigned int etype_sap_mask;
-    unsigned int svtag;
-    unsigned int svtag_mask;
-    unsigned int cvtag;
-    unsigned int cvtag_mask;
-    unsigned int ip_protocol;
-    unsigned int ip_protocol_mask;
-    unsigned int ipsa;
-    unsigned int ipsa_mask;
-    unsigned int ipda;
-    unsigned int ipda_mask;
-    unsigned int tcpudp_sport;
-    unsigned int tcpudp_sport_mask;
-    unsigned int tcpudp_dport;
-    unsigned int tcpudp_dport_mask;
-    unsigned int dscp;
-    unsigned int dscp_mask;
-    unsigned int new_dscp_ib;
-    unsigned int op;
-    unsigned long long da;
-    unsigned long long da_mask;
-    unsigned long long sa;
-    unsigned long long sa_mask;
-} cfpArg_t;
-enum {
-    CFP_RC_SUCCESS, 
-    CFP_RC_NON_EXISTING_INDEX, 
-    CFP_RC_CFP_FULL,
-    CFP_RC_UDF_FULL,
-};
-
-enum {CfpL3Ipv4, CfpL3Ipv6, CfpL3NoIP};
-enum {CfpL2EtherII, CfpL2SnapPublic, CfpL2LLC, CfpL2SnapPrivate};
-
-enum {
-    CFPOP_READ,
-    CFPOP_READ_NEXT,
-    CFPOP_ADD,
-    CFPOP_INSERT,
-    CFPOP_APPEND,
-    CFPOP_DELETE,
-    CFPOP_DELETE_ALL,
-};
-
-enum {
-    OPT_READ,
-    OPT_ADD,
-    OPT_APPEND,
-    OPT_INSERT,
-    OPT_DELETE,
-    OPT_DELETE_ALL,
-
-    OPT_PRIORITY,
-    OPT_INDEX,
-    OPT_SPMAP,
-    OPT_DA,
-
-    OPT_SA,
-    OPT_SVLAN_VID,
-    OPT_SVLAN_PCP,
-    OPT_SVLAN_TAG,
-
-    OPT_CVLAN_VID,
-    OPT_CVLAN_PCP,
-    OPT_CVLAN_TAG,
-    OPT_L2,
-
-    OPT_PPPOE,
-    OPT_ETYPE,
-    OPT_L3,
-    OPT_DSCP,
-
-    OPT_IP_PROTOCOL,
-    OPT_IPSA,
-    OPT_IPDA,
-    OPT_TCPUDP_SPORT,
-
-    OPT_TCPUDP_DPORT,
-    OPT_NEW_DSCP_IB,
-    OPT_CHANGE_FPMAP_IB,
-    OPT_FPMAP_IB,
-};
-
-enum {
-    CFP_ARG_SPMAP_M =    (1<<0),
-    CFP_ARG_DA_M  =      (1<<1),
-    CFP_ARG_SA_M  =      (1<<2),
-    CFP_ARG_IP_PROTOCOL_M =  (1<<3),
-
-    CFP_ARG_L2_FRAMING_M = (1<<4),
-    CFP_ARG_L3_FRAMING_M = (1<<5),
-    CFP_ARG_DSCP_M = (1<<6),
-    CFP_ARG_PRIORITY_M = (1<<7),
-
-    CFP_ARG_INDEX_M = (1<<8),
-    CFP_ARG_IPSA_M = (1<<9),
-    CFP_ARG_IPDA_M = (1<<10),
-    CFP_ARG_TCPUDP_SPORT_M = (1<<11),
-
-    CFP_ARG_TCPUDP_DPORT_M = (1<<12),
-    CFP_ARG_NEW_DSCP_IB_M = (1<<13),
-    CFP_ARG_CHG_FPMAP_IB_M = (1<<14),
-    CFP_ARG_FPMAP_IB_M = (1<<15),
-
-    CFP_ARG_SVLAN_TAG_M = (1<<16),
-    CFP_ARG_CVLAN_TAG_M = (1<<17),
-    CFP_ARG_PPPOE_M     = (1<<18),
-    CFP_ARG_ETYPE_SAP_M = (1<<19),
-
-    CFP_ARG_OP_M =        (1<<20),
-};
-
-#define CFP_ARG_MUST_ARGS_M (CFP_ARG_OP_M|CFP_ARG_NEW_DSCP_IB_M|CFP_ARG_CHG_FPMAP_IB_M)
-#define CFP_ARG_IP_FLAGS (CFP_ARG_DSCP_M|CFP_ARG_IPSA_M|CFP_ARG_IPDA_M|CFP_ARG_TCPUDP_SPORT_M|CFP_ARG_TCPUDP_DPORT_M)
-#define CFP_ARG_NON_IP_FLAGS CFP_ARG_ETYPE_SAP_M
-
-enum {
-    CFP_CHG_FPMAP_NO_CHG = 0,
-    CFP_CHG_FPMAP_RMV_ARL,
-    CFP_CHG_FPMAP_RPL_ARL,
-    CFP_CHG_FPMAP_ADD_ARL,
-};
-
-#define OPT_UDF_MASK = (CFP_ARG_DA_M | CFP_ARG_SA_M)
-
-#define BMCR_SPEED2500      0x0080  /* Command Parameter definition */
-#define BMCR_SPEED10000     0x0020  /* Command Parameter definition */
-
-/*************************************************
- *  Flow Control Diagnosis Definitions           *
- *************************************************/
-enum {
-    QUE_CUR_COUNT,
-    QUE_PEAK_COUNT,
-    SYS_TOTAL_PEAK_COUNT,
-    SYS_TOTAL_USED_COUNT,
-
-    PORT_PEAK_RX_BUFFER,
-    QUE_FINAL_CONGESTED_STATUS,
-    PORT_PAUSE_HISTORY,
-    PORT_PAUSE_QUAN_HISTORY,
-
-    PORT_RX_BASE_PAUSE_HISTORY,
-    PORT_RX_BUFFER_ERROR_HISTORY,
-    QUE_CONGESTED_STATUS,
-    QUE_TOTAL_CONGESTED_STATUS,
-
-    QUE_MON_MAX_TYPES,
-};
-
-enum {
-    PORT_LIMIT_EN,
-    PORT_LIMIT,
-    PORT_ACTION,
-    PORT_LEARNED_COUNT,
-    PORT_OVER_LIMIT_PKT_COUNT,
-	PORT_RST_OVER_LIMIT_PKT_COUNT,
-    GLOBAL_LIMIT,
-    GLOBAL_LEARNED_COUNT,
-	GLOBAL_RST_OVER_LIMIT_PKT_COUNT,
-
-    MACLMT_MAX_TYPES,
-};
-    
-#if defined(CONFIG_BCM963138) || defined(CONFIG_BCM963148) || defined(CONFIG_BCM94908) || defined(CONFIG_BCM963158) || \
-    defined(CONFIG_BCM963178) || defined(CONFIG_BCM947622) || defined(CONFIG_BCM963146) || defined(CONFIG_BCM96756) || \
-    defined(CHIP_63138) || defined(CHIP_63148) || defined(CHIP_4908) || defined(CHIP_63158) || defined(CHIP_63178)  || defined(CHIP_47622) || defined(CHIP_63146) || defined(CHIP_6756)
-#define BCM_COS_COUNT  8
-#else
-#define BCM_COS_COUNT  4
-#endif
-enum {
-    QOS_SCHED_SP_CAP        = 1 << 0,
-    QOS_SCHED_WRR_CAP       = 1 << 1,
-    QOS_SCHED_WDR_CAP       = 1 << 2,
-    QOS_SCHED_COMBO         = 1 << 3,
-    QOS_PORT_SHAPER_CAP     = 1 << 4,
-    QOS_QUEUE_SHAPER_CAP    = 1 << 5,
-};
-
-/* PHY Configuration Mode value between User Space and driver */
-enum phy_cfg_flag {
-    PHY_CFG_AUTO_NEGO   = 1 << 0,
-    PHY_CFG_10FD        = 1 << 1,
-    PHY_CFG_10HD        = 1 << 2,
-    PHY_CFG_100FD       = 1 << 3,
-
-    PHY_CFG_100HD       = 1 << 4,
-    PHY_CFG_1000FD      = 1 << 5,
-    PHY_CFG_1000HD      = 1 << 6,
-    PHY_CFG_2500FD      = 1 << 7,
-    PHY_CFG_5000FD      = 1 << 8,
-    PHY_CFG_10000FD     = 1 << 9,
-};
-
-#ifndef IFNAMSIZ
-#define IFNAMSIZ  16
-#endif
-
-struct ethswctl_data
-{
-    /* NOTE : Common attribute for all messages */
-    /* ethswctl ioctl operation */
-    int op;
-
-    /* page number */
-    int page;
-
-    /* switch unit number */
-    int unit;
-
-    /* switch port number */
-    int port;
-
-    /* sub_port number, ex. cross_bar port, trunk port */
-    int sub_unit, sub_port;
-
-    int addressing_flag;
-    #define ETHSW_ADDRESSING_DEV        (1<<0)      /* Linux device valid */
-    #define ETHSW_ADDRESSING_SUBPORT    (1<<1)      /* Sub port valid */
-
-    /* Action type */
-    int type;
-
-    /* NOTE : Do not add new params to this structure above for
-       new command - this is kept for backward compatibility.
-       Define a new structure for new command within union below. */
-    union
-    {
-        cfpArg_t cfpArgs;
-        struct
-        {
-#define TYPE_SUBSET  0
-#define TYPE_ALL     1
-#define TYPE_DISABLE 0
-#define TYPE_ENABLE  1
-#define TYPE_GET     2
-#define TYPE_SET     3
-#define TYPE_DUMP    4
-#define TYPE_FLUSH   5
-#define TYPE_CLEAR   6
-            int sub_type;
-#define SUBTYPE_ISRCFG      0
-#define SUBTYPE_RXDUMP      1
-#define SUBTYPE_RESETMIB    2
-#define SUBTYPE_RESETSWITCH 3
-            /* hardware switching enable/disable status */
-            int status;
-#define STATUS_DISABLED 0
-#define STATUS_ENABLED  1
-            int vlan_tag;
-            int vlan_param;
-            int replace_type;
-/* Defines for indicating the parameter in tag replace register */
-#define  REPLACE_VLAN_TAG    0
-#define  REPLACE_VLAN_TPID   1
-#define  REPLACE_VLAN_TCI    2
-#define  REPLACE_VLAN_VID    3
-#define  REPLACE_VLAN_8021P  4
-#define  REPLACE_VLAN_CFI  5
-            int op_map;
-            int ret_val;
-            int val;
-            int max_pkts_per_iter;
-            int rx_queues;
-            int weights[BCM_COS_COUNT];
-#define MAX_WRR_WEIGHTS 16
-            int weight_pkts[BCM_COS_COUNT];
-            unsigned char qos_egrq_sched_cap[BCM_COS_COUNT];
-            int priority;
-            int sw_port_type;
-            int pkt_type_mask;
-            int sw_ctrl_type;
-            /* scheduling value for ETHSETSCHEDULING */
-            int scheduling;
-            int vid;
-            unsigned char mac[6];
-            unsigned char data[8];
-            int chip_id;
-            int spi_id;
-            int bus_num;
-            int fwd_map;
-            int untag_map;
-            int queue;
-            int channel;
-            int numq;
-            uint32 limit;
-            uint32 burst_size;
-            uint64 counter_val;
-            unsigned int vendor_id;
-            unsigned int dev_id;
-            unsigned int rev_id;
-            int counter_type;
-            unsigned int offset;
-            int length;
-            int speed;
-            int duplex;
-            unsigned int port_map;
-            unsigned int phy_portmap;
-            int cfgSpeed;
-            int cfgDuplex;
-            int phyCap;
-            int phycfg;
-            int epon_port;
-            char ifname[IFNAMSIZ];
-#define AUTONEG_CTRL_MASK 0x01
-#define AUTONEG_RESTART_MASK 0x02
-            unsigned char autoneg_info;
-            unsigned short autoneg_local;
-            unsigned short autoneg_ad;
-            BCM_IOC_PTR(void *, vptr);
-        };
-        struct dos_ctrl_params
-        {
-            unsigned char da_eq_sa_drop_en;
-            unsigned char ip_lan_drop_en;   
-            unsigned char tcp_blat_drop_en; 
-            unsigned char udp_blat_drop_en; 
-            unsigned char tcp_null_scan_drop_en;
-            unsigned char tcp_xmas_scan_drop_en;
-            unsigned char tcp_synfin_scan_drop_en;
-            unsigned char tcp_synerr_drop_en; 
-            unsigned char tcp_shorthdr_drop_en;
-            unsigned char tcp_fragerr_drop_en; 
-            unsigned char icmpv4_frag_drop_en; 
-            unsigned char icmpv6_frag_drop_en; 
-            unsigned char icmpv4_longping_drop_en;
-            unsigned char icmpv6_longping_drop_en;
-            unsigned char dos_disable_lrn;
-        }dosCtrl;
-        struct up_len_s
-        {
-            BCM_IOC_PTR(void *, uptr);
-            unsigned int len;
-        }up_len;
-        struct port_qos_sched_s
-        {
-            unsigned short sched_mode;        // configured val  -- SP/WRR
-            unsigned short num_spq;           // configured SP q value in Combo mode
-            unsigned short wrr_type;          // WRR or WDR?              
-            unsigned short weights_upper;     // when setting, upper/lower 4 weights -- useful for CLI
-            unsigned short max_egress_spq;    // CAP -  max SP q in Combo mode 
-            unsigned short max_egress_q;      // CAP - per port max queues supported 
-            unsigned int port_qos_caps;       // CAP - scheduling/shaping capabilities
-        } port_qos_sched;
-
-        struct emac_stats
-        {
-            uint64 rx_byte;              /**< Receive Byte Counter */
-            uint64 rx_packet;            /**< Receive Packet Counter */
-            uint64 rx_frame_64;          /**< Receive 64 Byte Frame Counter */
-            uint64 rx_frame_65_127;      /**< Receive 65 to 127 Byte Frame Counter */
-            uint64 rx_frame_128_255;     /**< Receive 128 to 255 Byte Frame Counter */
-            uint64 rx_frame_256_511;     /**< Receive 256 to 511 Byte Frame Counter */
-            uint64 rx_frame_512_1023;    /**< Receive 512 to 1023 Byte Frame Counter */
-            uint64 rx_frame_1024_1518;   /**< Receive 1024 to 1518 Byte Frame Counter */
-            uint64 rx_frame_1519_mtu;   /**< Receive 1519 to MTU  Frame Counter */
-            uint64 rx_multicast_packet;  /**< Receive Multicast Packet */
-            uint64 rx_broadcast_packet;  /**< Receive Broadcast Packet */
-            uint64 rx_unicast_packet;    /**< Receive Unicast Packet */
-            uint64 rx_alignment_error;   /**< Receive Alignment error */
-            uint64 rx_frame_length_error;/**< Receive Frame Length Error Counter */
-            uint64 rx_code_error;        /**< Receive Code Error Counter */
-            uint64 rx_carrier_sense_error;/**< Receive Carrier sense error */
-            uint64 rx_fcs_error;         /**< Receive FCS Error Counter */
-            uint64 rx_undersize_packet;  /**< Receive Undersize Packet */
-            uint64 rx_oversize_packet;   /**< Receive Oversize Packet */
-            uint64 rx_fragments;         /**< Receive Fragments */
-            uint64 rx_jabber;            /**< Receive Jabber counter */
-            uint64 rx_overflow;          /**< Receive Overflow counter */
-            uint64 rx_control_frame;     /**< Receive Control Frame Counter */
-            uint64 rx_pause_control_frame;/**< Receive Pause Control Frame */
-            uint64 rx_unknown_opcode;    /**< Receive Unknown opcode */
-
-            uint64 tx_byte;              /**< Transmit Byte Counter */
-            uint64 tx_packet;            /**< Transmit Packet Counter */
-            uint64 tx_frame_64;          /**< Transmit 64 Byte Frame Counter */
-            uint64 tx_frame_65_127;      /**< Transmit 65 to 127 Byte Frame Counter */
-            uint64 tx_frame_128_255;     /**< Transmit 128 to 255 Byte Frame Counter */
-            uint64 tx_frame_256_511;     /**< Transmit 256 to 511 Byte Frame Counter */
-            uint64 tx_frame_512_1023;    /**< Transmit 512 to 1023 Byte Frame Counter */
-            uint64 tx_frame_1024_1518;   /**< Transmit 1024 to 1518 Byte Frame Counter */
-            uint64 tx_frame_1519_mtu;   /**< Transmit 1519 to MTU Frame Counter */
-            uint64 tx_fcs_error;         /**< Transmit FCS Error */
-            uint64 tx_multicast_packet;  /**< Transmit Multicast Packet */
-            uint64 tx_broadcast_packet;  /**< Transmit Broadcast Packet */
-            uint64 tx_unicast_packet;    /**< Transmit Unicast Packet */
-            uint64 tx_total_collision;   /**< Transmit Total Collision Counter */
-            uint64 tx_jabber_frame;      /**< Transmit Jabber Frame */
-            uint64 tx_oversize_frame;    /**< Transmit Oversize Frame counter */
-            uint64 tx_undersize_frame;   /**< Transmit Undersize Frame */
-            uint64 tx_fragments_frame;   /**< Transmit Fragments Frame counter */
-            uint64 tx_error;             /**< Transmission errors*/
-            uint64 tx_underrun;          /**< Transmission underrun */
-            uint64 tx_excessive_collision; /**< Transmit Excessive collision counter */
-            uint64 tx_late_collision;    /**< Transmit Late collision counter */
-            uint64 tx_single_collision;  /**< Transmit Single collision frame counter */
-            uint64 tx_multiple_collision;/**< Transmit Multiple collision frame counter */
-            uint64 tx_pause_control_frame; /**< Transmit PAUSE Control Frame */
-            uint64 tx_deferral_packet;   /**< Transmit Deferral Packet */
-            uint64 tx_excessive_deferral_packet; /**< Transmit Excessive Deferral Packet */
-            uint64 tx_control_frame;     /**< Transmit Control Frame */
-        }emac_stats_s; 
-        unsigned char sal_dal_en;   /*enable/disable sa lookup and da lookup for port*/
-        unsigned int mtu; /*denotes the maximum frame size allowed across this interface*/
-        unsigned char transparent;/*enable/disable  transparent for port*/
-        struct vlan_isolation_cfg
-        {
-            unsigned char us_enable;
-            unsigned char ds_enable;
-        }vlan_isolation;
-        struct port_mirror_params
-        {
-            int enable;
-            int mirror_port;
-            unsigned int ing_pmap;
-            unsigned int eg_pmap;
-            unsigned int blk_no_mrr;
-            int tx_port; /*Optional - if not supplied all tx traffic is mirrored to \"mirror_port\"; Applicable only to Runner*/
-            int rx_port; /*Optional - if not supplied all rx traffic is mirrored to \"mirror_port\"; Applicable only to Runner*/
-        }port_mirror_cfg;
-        struct port_trunk_params
-        {
-            int enable; /* Read-only */
-            unsigned int hash_sel; /* RW; 0=DA+SA, 1=DA, 2=SA */
-            unsigned int grp0_pmap; /* Read-only */
-            unsigned int grp1_pmap; /* Read-only */
-        }port_trunk_cfg;		
-        struct cpu_meter_rate_limit_cfg
-        {
-#define METER_TYPE_BROADCAST 4 /*correspond to rdpa_cpu_rx_reason_bcast*/
-#define METER_TYPE_MULTICAST 3 /*correspond to rdpa_cpu_rx_reason_mcast*/
-            unsigned int meter_type;
-            unsigned int rate_limit;
-        }cpu_meter_rate_limit;
-        struct mdk_kernel_poll
-        {
-           unsigned int link_change;
-        }mdk_kernel_poll;
-        struct oam_idx_str
-        {
-            #define OAM_MAP_SUB_TYPE_TO_UNIT_PORT 0
-            #define OAM_MAP_SUB_TYPE_TO_RDPA_IF   1
-            #define OAM_MAP_SUB_TYPE_FROM_UNIT_PORT   2
-            int map_sub_type;
-            int oam_idx;
-            union {
-                int rdpa_if;
-            };
-
-        }oam_idx_str;
-        struct
-        {
-            int pfc_ret;
-            int pfc_timer[8];
-        };
-        net_port_t net_port;
-    };  /* Union */
-};
-
-/* Defines for set/get of various fields in VLAN TAG */
-#define BCM_NET_VLAN_TPID_S        16
-#define BCM_NET_VLAN_TPID_M        0xFFFF
-#define BCM_NET_VLAN_VID_S         0
-#define BCM_NET_VLAN_VID_M       0xFFF
-#define BCM_NET_VLAN_TCI_S         0
-#define BCM_NET_VLAN_TCI_M       0xFFFF
-#define BCM_NET_VLAN_8021P_S       13
-#define BCM_NET_VLAN_8021P_M       0x7
-#define BCM_NET_VLAN_CFI_S         12
-#define BCM_NET_VLAN_CFI_M         0x1
-
-#define VLAN_FWD_MAP_M   0x1FF
-#define VLAN_UNTAG_MAP_M 0x1FF
-#define VLAN_UNTAG_MAP_S 9
-/* Switch flow control modes for sw_ctrl_type */
-typedef enum bcm_switch_fc_e {
-  bcmSwitchFcMode, // Global/port
-  bcmSwitchTxBasedFc,
-  bcmSwitchTxQpauseEn,
-  bcmSwitchTxQdropEn,
-  bcmSwitchTxTotPauseEn,
-  bcmSwitchTxTotdropEn,
-  bcmSwitchQbasedpauseEn,
-  bcmSwitchTxQpauseEnImp0,
-  bcmSwitchTxTotPauseEnImp0,
-}bcm_switch_fc_t;
-
-
-/* Switch controls for sw_ctrl_type */
-typedef enum bcm_switch_control_e {
-  bcmSwitchBufferControl,       /* Enable/Disable Total/TxQ Pause/Drop */
-  bcmSwitch8021QControl,          /* Enable/Disable 802.1Q */
-  bcmSwitchTotalDropThreshold,    /* Configure Total Drop Threshold */
-  bcmSwitchTotalPauseThreshold,   /* Configure Total Pause Threshold */
-  bcmSwitchTotalHysteresisThreshold,  /* Configure Total Hysteresis Threshold */
-  bcmSwitchTxQHiDropThreshold,    /* Configure TxQ Hi Drop Threshold */
-  bcmSwitchTxQHiPauseThreshold,   /* Configure TxQ Hi Pause Threshold */
-  bcmSwitchTxQHiHysteresisThreshold,  /* Configure TxQ Hi Hysteresis Threshold */
-  bcmSwitchTxQLowDropThreshold,   /* Configure TxQ LOW Drop Threshold */
-  bcmSwitchTxQHiReserveThreshold,
-  bcmSwitchTxQThresholdConfigMode, /* COnfigure TxQ Configuration Mode */
-  bcmSwitchTotalPorts,             /* COnfigure TxQ Configuration Mode */
-  bcmSwitchLinkUpLanPorts,          /* COnfigure TxQ Configuration Mode */
-  bcmSwitchLinkUpWanPorts,      /* COnfigure TxQ Configuration Mode */
-  bcmSwitchMaxStreams,          /* Configure Queue Max Streams */
-  bcmSwitchCurStreams,          /* Current streams used to compute threshold */
-  bcmSwitchActQuePerPort,       /* Active Queue per poert */
-  bcmSwitch__Count,
-} bcm_switch_control_t;
-
-/* Threshold mode */
-enum {
-    ThreModeMin,
-    ThreModeDynamic = ThreModeMin,
-    ThreModeStatic,
-    ThreModeManual,
-    ThreModeTotalCnt, 
-    ThreModeMax = ThreModeTotalCnt - 1,
-};
-
-
-/* For bcmSwitchBufferControl */
-#define BCM_SWITCH_TXQ_PAUSE     0x1      /* Enable/Disable TXQ DROP. */
-#define BCM_SWITCH_TXQ_DROP      0x2      /* Enable/Disable TXQ PAUSE. */
-#define BCM_SWITCH_TOTAL_PAUSE     0x4      /* Enable/Disable TOTAL DROP. */
-#define BCM_SWITCH_TOTAL_DROP    0x8      /* Enable/Disable TOTAL PAUSE. */
-
-/* Switch acb controls for sw_ctrl_type */
-typedef enum bcm_switch_acb_control_e {
-    acb_parms_all = 0,
-    acb_en,
-    acb_eop_delay,
-    acb_flush,
-
-    acb_algorithm,
-    acb_tot_xon_hyst,
-    acb_xon_hyst,
-    acb_q_pessimistic_mode,
-
-    acb_q_total_xon_en,
-    acb_q_xon_en,
-    acb_q_total_xoff_en,
-    acb_q_pkt_len,
-
-    acb_q_tot_xoff_thresh,
-    acb_q_xoff_thresh,
-    acb_q_pkts_in_flight,
-} bcm_switch_acb_control_t;
-
-typedef struct acb_queue_config_s {
-    unsigned short pessimistic_mode:1;
-    unsigned short total_xon_en:1;
-    unsigned short xon_en:1;
-    unsigned short total_xoff_en:1;
-    unsigned short pkt_len;
-    unsigned short total_xoff_threshold;
-    unsigned short xoff_threshold;
-} acb_queue_config_t;
-
-typedef struct {
-    unsigned short acb_en;
-    unsigned short eop_delay;
-    unsigned short flush;
-    unsigned short algorithm;
-    unsigned short total_xon_hyst;
-    unsigned short xon_hyst;
-    unsigned short pkts_in_flight;
-    acb_queue_config_t acb_queue_config;
-} acb_q_params_t;
-
-typedef struct {
-    int egress_rate_cfg;
-    int egress_burst_sz_cfg;
-    int egress_cur_tokens;
-    int egress_shaper_flags;
-} egress_shaper_stats_t;
-
-#define SHAPER_ENABLE                  0x1
-#define SHAPER_RATE_PACKET_MODE        0x2
-#define SHAPER_BLOCKING_MODE           0x4 
-#define SHAPER_INCLUDE_IFG             0x8 
-#define SHAPER_AVB_MODE                0x10
-#define SHAPER_OVF_FLAG                0x20 
-#define SHAPER_INPF_FLAG               0x40
-
-/* Defines for the op_map in tag_mangle_set/get */
-#define BCM_PORT_REPLACE_TPID    0x8000  /* Replace TPID */
-#define BCM_PORT_REPLACE_8021P     0x4000  /* Replace 802.1p bits */
-#define BCM_PORT_REPLACE_CFI     0x2000  /* Replace CFI bit */
-#define BCM_PORT_REPLACE_VID     0x1000  /* Replace VLAN ID */
-#define BCM_PORT_TAG_MANGLE_OP_MAP_M 0xF000  /* Mask for all tag mangling ops */
-
-
-/*  For scheduling mechanism selection */
-#define SP_SCHEDULING  0
-#define WRR_SCHEDULING 1
-#define BCM_COSQ_STRICT  0
-#define BCM_COSQ_WRR     1
-#define BCM_COSQ_COMBO   2
-#define BCM_COSQ_SP      0
-
-#if defined(CONFIG_BCM963138) || defined(CONFIG_BCM963148) || defined(CONFIG_BCM94908) || defined(CONFIG_BCM963158) || defined(CONFIG_BCM963178) || defined(CONFIG_BCM963146) \
-    || defined(CHIP_63138) || defined(CHIP_63148) || defined(CHIP_4908) || defined(CHIP_63158) || defined(CHIP_63178) || defined(CHIP_63146)
-#define NUM_EGRESS_QUEUES  8
-#else
-#define NUM_EGRESS_QUEUES  4
-#endif
-
-#define QOS_PAUSE_DROP_EN_MAP 0xF
-#define MAX_PRIORITY_VALUE    7
-
-/* Return Value Definitions */
-#define BCM_E_ERROR  1
-
-/* For pause_capability set/get functions */
-#define PAUSE_FLOW_CTRL_NONE 0
-#define PAUSE_FLOW_CTRL_AUTO 1
-#define PAUSE_FLOW_CTRL_BOTH 2
-#define PAUSE_FLOW_CTRL_TX   3
-#define PAUSE_FLOW_CTRL_RX   4
-#define PAUSE_FLOW_PFC_BOTH  5
-#define PAUSE_FLOW_PFC_TX    6
-#define PAUSE_FLOW_PFC_RX    7
-#define PAUSE_FLOW_CTRL_BCMSWITCH_OFF  8
-#define PAUSE_FLOW_CTRL_BCMSWITCH_ON   9
-#define SWITCH_PORTS_ALL_PHYS  255
-
-#define PORT_QOS      0
-#define MAC_QOS       1
-#define IEEE8021P_QOS 2
-#define DIFFSERV_QOS  3
-#define COMBO_QOS     4
-#define IMP_PORT_ID   8
-#define P4_PORT_ID    4
-#define P5_PORT_ID    5
-#define P7_PORT_ID    7
-#define TC_ZERO_QOS   4
-#define SWAP_TYPE_MASK  (0xff<<24)
-#define PORT_RXDISABLE 0x1
-#define PORT_TXDISABLE 0x2
-#define MAX_EGRESS_SPQ 4
-
-#define MBUS_PCI     0
-#define MBUS_SPI     1
-#define MBUS_MDIO    2
-#define MBUS_UBUS    3
-#define MBUS_HS_SPI  4
-#define MBUS_MMAP    5
-#define MBUS_NONE    -1
-#define QOS_ENUM_WRR_PKT                                 1
-#define QOS_ENUM_WDRR_PKT                                2
-
-/* Link Handling */
-#define ETHSW_LINK_MIGHT_CHANGED    (1<<0)
-#define ETHSW_LINK_FORCE_CHECK      (1<<1)
-#define ETHSW_LINK_CHANGED          (1<<2)
-
-/* Spanning Tree states */
-enum {
-    STP_DISABLED,
-    STP_LISTENING,
-    STP_LEARNING,
-    STP_FORWARDING,
-    STP_BLOCKING,
-};
-
-/* DMA Dump */
-#define ETHSW_DMA_RX    1
-#define ETHSW_DMA_TX    2
-#define ETHSW_DMA_GMAC_CHAN 100
-
-#endif /* __BCM_SWAPI_TYPES_H__ */
diff --git a/bcm/bcmtypes.h b/bcm/bcmtypes.h
deleted file mode 100644
index acf9f6f..0000000
--- a/bcm/bcmtypes.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
-    Copyright 2007-2015 Broadcom Corporation
-
-    <:label-BRCM:2015:DUAL/GPL:standard
-    
-    Unless you and Broadcom execute a separate written software license
-    agreement governing use of this software, this software is licensed
-    to you under the terms of the GNU General Public License version 2
-    (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
-    with the following added to such license:
-    
-       As a special exception, the copyright holders of this software give
-       you permission to link this software with independent modules, and
-       to copy and distribute the resulting executable under terms of your
-       choice, provided that you also meet, for each linked independent
-       module, the terms and conditions of the license of that module.
-       An independent module is a module which is not derived from this
-       software.  The special exception does not apply to any modifications
-       of the software.
-    
-    Not withstanding the above, under no circumstances may you combine
-    this software in any way with any other Broadcom software provided
-    under a license other than the GPL, without Broadcom's express prior
-    written consent.
-    
-    :>
-*/
-
-//
-// bcmtypes.h - misc useful typedefs
-//
-#ifndef BCMTYPES_H
-#define BCMTYPES_H
-
-#ifndef __ASSEMBLER__
-
-// These are also defined in typedefs.h in the application area, so I need to
-// protect against re-definition.
-
-#ifndef _TYPEDEFS_H_
-
-typedef unsigned char   uint8;
-typedef unsigned short  uint16;
-typedef unsigned int    uint32;
-typedef unsigned long long  uint64;
-typedef signed char     int8;
-typedef signed short    int16;
-typedef signed int     int32;
-typedef signed long long    int64;
-typedef unsigned long  BcmHandle;
-
-#if !defined(__cplusplus) && !defined(__KERNEL__) && !defined(_LINUX_TYPES_H) && !defined(_LINUX_IF_H) && !defined(_ATF_)
-typedef int bool;
-#endif
-
-#endif
-
-typedef unsigned char  byte;
-
-typedef unsigned long   HANDLE,*PULONG;
-typedef int             DWORD,*PDWORD;
-#ifndef LONG
-typedef signed long     LONG,*PLONG;
-#endif
-
-typedef unsigned int    *PUINT;
-typedef signed int      INT;
-
-typedef unsigned short  *PUSHORT;
-typedef signed short    SHORT,*PSHORT;
-typedef unsigned short  WORD,*PWORD;
-
-typedef unsigned char   *PUCHAR;
-typedef signed char     *PCHAR;
-
-typedef void            *PVOID;
-
-typedef unsigned char   BOOLEAN, *PBOOL, *PBOOLEAN;
-
-typedef unsigned char   BYTE,*PBYTE;
-
-typedef signed int      *PINT;
-
-#ifndef NUMBER_TYPES_ALREADY_DEFINED
-#define NUMBER_TYPES_ALREADY_DEFINED
-typedef signed char     INT8;
-typedef signed char     SINT8;
-typedef signed short    INT16;
-typedef signed short    SINT16;
-typedef signed int      INT32;
-typedef signed int      sint32;
-typedef signed int      SINT32;
-typedef signed long long SINT64;
-
-typedef unsigned char   UINT8;
-typedef unsigned short  UINT16;
-typedef unsigned int    UINT32;
-typedef unsigned long long UINT64;
-#endif
-
-#ifndef BOOL_TYPE_ALREADY_DEFINED
-#define BOOL_TYPE_ALREADY_DEFINED
-typedef unsigned char   UBOOL8;
-#endif
-
-#ifndef BASE_TYPE_ALREADY_DEFINED
-#define BASE_TYPE_ALREADY_DEFINED
-typedef unsigned char   UCHAR;
-typedef unsigned short  USHORT;
-typedef unsigned int    UINT;
-typedef unsigned long   ULONG;
-#endif
-
-typedef void            VOID;
-typedef unsigned char   BOOL;
-
-// These are also defined in typedefs.h in the application area, so I need to
-// protect against re-definition.
-#ifndef TYPEDEFS_H
-
-// Maximum and minimum values for a signed 16 bit integer.
-#define MAX_INT16 32767
-#define MIN_INT16 -32768
-
-// Useful for true/false return values.  This uses the
-// Taligent notation (k for constant).
-typedef enum
-{
-    kFalse = 0,
-    kTrue = 1
-} Bool;
-
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE  0
-#endif
-
-#define READ32(addr)        (*(volatile UINT32 *)((ULONG)&addr))
-#define READ16(addr)        (*(volatile UINT16 *)((ULONG)&addr))
-#define READ8(addr)         (*(volatile UINT8  *)((ULONG)&addr))
-
-typedef unsigned long long uint64_aligned __attribute__((aligned(8)));
-typedef signed long long int64_aligned __attribute__((aligned(8)));
-
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-#define BCM_IOC_PTR(ptr_t, ptr) union { ptr_t ptr; uint64_aligned ptr##64; }
-#define BCM_IOC_PTR_ZERO_EXT(ptr) if (is_compat_task()) ((ptr##64) = (uint64_aligned)(uint32_t)(ptr##64))
-#else
-#define BCM_IOC_PTR(ptr_t, ptr) ptr_t ptr;
-#define BCM_IOC_PTR_ZERO_EXT(ptr)
-#endif
-
-/*Example usage of above types/macro to a create 32/64-bit compatible ioctl message:
-  typedef struct {
-    uint8 exByte;
-    BCM_IOC_PTR(void*, exPtr);
-    uint32 exWord; /.Never use long. Always use (u)int32./
-    uint64_aligned ex64bitValue; /.Never use long long. Always use (u)int64_aligned../
-  } ExampleIoctlMsg;
-*/
-#endif
-
-#endif
diff --git a/bcm/net_port.h b/bcm/net_port.h
deleted file mode 100644
index fe9d26f..0000000
--- a/bcm/net_port.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-    Copyright 2007-2015 Broadcom Corporation
-
-    <:label-BRCM:2015:DUAL/GPL:standard
-    
-    Unless you and Broadcom execute a separate written software license
-    agreement governing use of this software, this software is licensed
-    to you under the terms of the GNU General Public License version 2
-    (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
-    with the following added to such license:
-    
-       As a special exception, the copyright holders of this software give
-       you permission to link this software with independent modules, and
-       to copy and distribute the resulting executable under terms of your
-       choice, provided that you also meet, for each linked independent
-       module, the terms and conditions of the license of that module.
-       An independent module is a module which is not derived from this
-       software.  The special exception does not apply to any modifications
-       of the software.
-    
-    Not withstanding the above, under no circumstances may you combine
-    this software in any way with any other Broadcom software provided
-    under a license other than the GPL, without Broadcom's express prior
-    written consent.
-    
-    :>
-*/
-
-/***********************************************************************/
-/*                                                                     */
-/*   MODULE:  net_port.h                                               */
-/*   PURPOSE: Generic port name interface.                             */
-/*                                                                     */
-/***********************************************************************/
-#ifndef _NET_PORT_H
-#define _NET_PORT_H
-
-typedef struct net_port_t
-{
-    int port;
-    int sub_type;
-    int is_wan;
-    int speed;
-    char ifname[32];
-} net_port_t;
-
-#define _FOREACH_NET_PORT_TYPE(TYPE, TYPE0) \
-    TYPE0(NET_PORT_LAN_0) \
-    TYPE(NET_PORT_LAN_1) \
-    TYPE(NET_PORT_LAN_2) \
-    TYPE(NET_PORT_LAN_3) \
-    TYPE(NET_PORT_LAN_4) \
-    TYPE(NET_PORT_LAN_5) \
-    TYPE(NET_PORT_LAN_6) \
-    TYPE(NET_PORT_LAN_7) \
-    TYPE(NET_PORT_EPON_AE) \
-    TYPE(NET_PORT_EPON) \
-    TYPE(NET_PORT_GPON) \
-    TYPE(NET_PORT_LAST) \
-    TYPE(NET_PORT_NONE)
-
-#define _FOREACH_NET_PORT_SUBTYPE_TYPE(TYPE, TYPE0) \
-    TYPE0(NET_PORT_SUBTYPE_GPON) \
-    TYPE(NET_PORT_SUBTYPE_XGPON) \
-    TYPE(NET_PORT_SUBTYPE_XGS) \
-    TYPE(NET_PORT_SUBTYPE_NGPON) \
-    TYPE(NET_PORT_SUBTYPE_LAST) \
-    TYPE(NET_PORT_SUBTYPE_NONE)
-    
-#define _FOREACH_NET_PORT_SPEED_TYPE(TYPE, TYPE0) \
-    TYPE0(NET_PORT_SPEED_0101) \
-    TYPE(NET_PORT_SPEED_0201) \
-    TYPE(NET_PORT_SPEED_0202) \
-    TYPE(NET_PORT_SPEED_2501) \
-    TYPE(NET_PORT_SPEED_1001) \
-    TYPE(NET_PORT_SPEED_1025) \
-    TYPE(NET_PORT_SPEED_1010) \
-    TYPE(NET_PORT_SPEED_LAST) \
-    TYPE(NET_PORT_SPEED_NONE)
-
-#define FOREACH_NET_PORT_ENUM \
-    _FOREACH_NET_PORT_TYPE(GENERATE_ENUM, GENERATE_ENUM0) \
-    _FOREACH_NET_PORT_SUBTYPE_TYPE(GENERATE_ENUM, GENERATE_ENUM0) \
-    _FOREACH_NET_PORT_SPEED_TYPE(GENERATE_ENUM, GENERATE_ENUM0)
-
-#define FOREACH_NET_PORT_STRING \
-    _FOREACH_NET_PORT_TYPE(GENERATE_STRING, GENERATE_STRING) \
-    _FOREACH_NET_PORT_SUBTYPE_TYPE(GENERATE_STRING, GENERATE_STRING) \
-    _FOREACH_NET_PORT_SPEED_TYPE(GENERATE_STRING, GENERATE_STRING)
-
-#define GENERATE_ENUM(ENUM) ENUM,
-#define GENERATE_ENUM0(ENUM) ENUM = 0,
-#define GENERATE_STRING(STRING) #STRING,
-
-enum
-{
-    FOREACH_NET_PORT_ENUM
-};
-
-#endif
-
-- 
GitLab