1/* 2 * Broadcom Home Gateway Reference Design 3 * BCM53xx RoboSwitch Broadcom tag driver header 4 * 5 * Copyright 2004, Broadcom Corporation 6 * All Rights Reserved. 7 * 8 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY 9 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM 10 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS 11 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. 12 * $Id: brcmtag.h,v 1.1.1.1 2008/10/15 03:31:23 james26_jang Exp $ 13 */ 14 15#ifndef _brcm_h_ 16#define _brcm_h_ 17 18#include <linux/netdevice.h> 19 20struct brcm_dev_info { 21 struct net_device *real_dev; /* the underlying device/interface */ 22 struct net_device_stats dev_stats; /* Device stats (rx-bytes, tx-pkts, etc...) */ 23 uint port; 24}; 25/* opcode defs */ 26#define BRCMTAG_UNICAST 0 27#define BRCMTAG_MULTICAST 1 28#define BRCMTAG_EGRESS_DIRECT 2 29#define BRCMTAG_INGRESS_DIRECT 3 30#define BRCMTAG_MULT_EGRESS 5 31#pragma pack(1) 32typedef struct _brcm_tag { 33 unsigned char port:4; 34 unsigned char cid_src:2; 35 unsigned char rsvd1:2; 36 unsigned char cid_dest:2; 37 unsigned char rsvd:6; 38 unsigned int count:11; 39 unsigned char mirror_only:1; 40 unsigned char mirror:1; 41 unsigned char opcode:3; 42} brcm_tag; 43#pragma pack() 44 45typedef struct _brcm_hdr { 46 unsigned short proto; /* BRCM_TYPE */ 47 brcm_tag tag; /* brcm tag */ 48} brcm_hdr; 49 50#define BRCM_DEV_INFO(x) ((struct brcm_dev_info *)(x->priv)) 51 52#define BRCM_TYPE 0x8874 53#define BRCM_ETH_HLEN 20 /* total octets in header */ 54#define BRCM_VLAN_ETH_HLEN 24 /* total octets in header w/vlan tag also */ 55#define BRCM_HLEN 6 /* The additional bytes (on top of the Ethernet header) */ 56 /* required by brcm header */ 57 58/* min packet len is ETH_ZLEN + sizeof(FCS). must pad to this length after VLAN and */ 59/* BRCM headers removed */ 60#define GET_PAD_BYTES(pkt_len) ((pkt_len) - (ETH_ZLEN + sizeof(uint32_t)) - VLAN_HLEN - sizeof(brcm_hdr)) 61 62void brcm_module_init(void); 63void brcm_module_deinit(void); 64struct net_device *register_brcmtag_device(const char *eth_IF_name, 65 const char *suffix, uint port); 66int unregister_brcm_device(const char *brcm_IF_name); 67 68 69#endif /* _brcm_h_ */ 70