]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/staging/bcm/Protocol.h
Merge tag 'tty-3.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[mirror_ubuntu-artful-kernel.git] / drivers / staging / bcm / Protocol.h
CommitLineData
f8942e07 1/************************************
bd33dd31 2* Protocol.h
f8942e07
SH
3*************************************/
4#ifndef __PROTOCOL_H__
5#define __PROTOCOL_H__
6
bd33dd31
KM
7#define IPV4 4
8#define IPV6 6
f8942e07
SH
9
10struct ArpHeader {
bd33dd31
KM
11 struct arphdr arp;
12 unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
13 unsigned char ar_sip[4]; /* sender IP address */
14 unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
15 unsigned char ar_tip[4]; /* target IP address */
a3489276 16};
f8942e07 17
c5485e9c 18struct bcm_transport_header {
3df56e10 19 union {
f8942e07
SH
20 struct udphdr uhdr;
21 struct tcphdr thdr;
22 };
5f8797b6 23} __packed;
f8942e07 24
8ab19921 25enum bcm_ip_frame_type {
f8942e07
SH
26 eNonIPPacket,
27 eIPv4Packet,
28 eIPv6Packet
8ab19921 29};
f8942e07 30
1f05da95 31enum bcm_eth_frame_type {
f8942e07
SH
32 eEthUnsupportedFrame,
33 eEth802LLCFrame,
34 eEth802LLCSNAPFrame,
35 eEth802QVLANFrame,
36 eEthOtherFrame
1f05da95 37};
f8942e07 38
5fa9ac45 39struct bcm_eth_packet_info {
8ab19921 40 enum bcm_ip_frame_type eNwpktIPFrameType;
1f05da95 41 enum bcm_eth_frame_type eNwpktEthFrameType;
963fa3e6 42 unsigned short usEtherType;
57b49ada 43 unsigned char ucDSAP;
5fa9ac45 44};
f8942e07 45
d1b37925 46struct bcm_eth_q_frame {
406a5082 47 struct bcm_eth_header EThHdr;
963fa3e6
KM
48 unsigned short UserPriority:3;
49 unsigned short CFI:1;
50 unsigned short VLANID:12;
51 unsigned short EthType;
d1b37925 52} __packed;
f8942e07 53
620fac92 54struct bcm_eth_llc_frame {
406a5082 55 struct bcm_eth_header EThHdr;
f8942e07
SH
56 unsigned char DSAP;
57 unsigned char SSAP;
58 unsigned char Control;
620fac92 59} __packed;
f8942e07 60
9bcacc29 61struct bcm_eth_llc_snap_frame {
406a5082 62 struct bcm_eth_header EThHdr;
f8942e07
SH
63 unsigned char DSAP;
64 unsigned char SSAP;
65 unsigned char Control;
66 unsigned char OUI[3];
67 unsigned short usEtherType;
9bcacc29 68} __packed;
f8942e07 69
30f5b4c2 70struct bcm_ethernet2_frame {
406a5082 71 struct bcm_eth_header EThHdr;
30f5b4c2 72} __packed;
f8942e07 73
78afa999 74#define ETHERNET_FRAMETYPE_IPV4 ntohs(0x0800)
bd33dd31
KM
75#define ETHERNET_FRAMETYPE_IPV6 ntohs(0x86dd)
76#define ETHERNET_FRAMETYPE_802QVLAN ntohs(0x8100)
f8942e07 77
a3489276 78/* Per SF CS Specification Encodings */
4a19aaa7 79enum bcm_spec_encoding {
bd33dd31 80 eCSSpecUnspecified = 0,
f8942e07
SH
81 eCSPacketIPV4,
82 eCSPacketIPV6,
83 eCS802_3PacketEthernet,
84 eCS802_1QPacketVLAN,
85 eCSPacketIPV4Over802_3Ethernet,
86 eCSPacketIPV6Over802_3Ethernet,
87 eCSPacketIPV4Over802_1QVLAN,
88 eCSPacketIPV6Over802_1QVLAN,
89 eCSPacketUnsupported
4a19aaa7 90};
f8942e07 91
bd33dd31
KM
92#define IP6_HEADER_LEN 40
93#define IP_VERSION(byte) (((byte&0xF0)>>4))
f8942e07
SH
94
95#define MAC_ADDRESS_SIZE 6
5a88304e 96#define ETH_AND_IP_HEADER_LEN (14 + 20)
bd33dd31
KM
97#define L4_SRC_PORT_LEN 2
98#define L4_DEST_PORT_LEN 2
5a88304e 99#define CTRL_PKT_LEN (8 + ETH_AND_IP_HEADER_LEN)
f8942e07 100
bd33dd31
KM
101#define ETH_ARP_FRAME 0x806
102#define ETH_IPV4_FRAME 0x800
103#define ETH_IPV6_FRAME 0x86DD
104#define UDP 0x11
105#define TCP 0x06
f8942e07 106
bd33dd31
KM
107#define ARP_OP_REQUEST 0x01
108#define ARP_OP_REPLY 0x02
109#define ARP_PKT_SIZE 60
f8942e07 110
a3489276 111/* This is the format for the TCP packet header */
16c3f8b0 112struct bcm_tcp_header {
963fa3e6
KM
113 unsigned short usSrcPort;
114 unsigned short usDestPort;
edb9ebb0
KM
115 unsigned long ulSeqNumber;
116 unsigned long ulAckNumber;
57b49ada
KM
117 unsigned char HeaderLength;
118 unsigned char ucFlags;
963fa3e6
KM
119 unsigned short usWindowsSize;
120 unsigned short usChkSum;
121 unsigned short usUrgetPtr;
16c3f8b0 122};
f8942e07 123
16c3f8b0 124#define TCP_HEADER_LEN sizeof(struct bcm_tcp_header)
a3489276 125#define TCP_ACK 0x10 /* Bit 4 in tcpflags field. */
bd33dd31 126#define GET_TCP_HEADER_LEN(byte) ((byte&0xF0)>>4)
f8942e07 127
a3489276 128#endif /* __PROTOCOL_H__ */