2 *-----------------------------------------------------------------------------
4 * Filename: tcp_header_definitions.h
6 * Description: Layer 2, 3, 4 definitions and header types
8 * Assumptions and Constraints:
10 * Copyright (c) 2012-2013 Cisco and/or its affiliates.
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at:
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 *-----------------------------------------------------------------------------
25 #ifndef __TCP_HEADER_DEFINITIONS_H__
26 #define __TCP_HEADER_DEFINITIONS_H__
29 * A general list of Layer 3 protocols, used by many Layer 2 encaps.
33 * TYPE_ARP TYPE_RFC826_ARP
34 * TYPE_RARP TYPE_REVERSE_ARP
35 * TYPE_MPLS TYPE_TAGSWITCH
37 #define TYPE_IP 0x0800
38 #define TYPE_IP_V6 0x86DD
39 #define TYPE_ARP 0x0806
40 #define TYPE_RARP 0x8035
41 #define TYPE_MPLS 0x8847
42 #define TYPE_CDP 0x2000
43 #define TYPE_CGMP 0x2001
44 #define TYPE_LACP 0x8808 /* 802.3ad */
45 #define TYPE_CLNS 0xFEFE
47 #define TYPE_PPPOE_SESSION 0x8864 /* PTA plus */
48 #define TYPE_PPPOE_DISCOVERY 0x8863 /* PTA plus */
51 * for atm arp handling
53 #define IN_ATM_ARP_BIT 0x0008
56 * The Layer 2 header structures.
64 typedef struct hdlc_hdr_type {
70 #define HDLC_ADDR_CMD 0x0F00
71 #define HDLC_HDR_LEN 4
72 #define HDLC_BROADCAST_BIT 31
73 #define TYPE_KEEP 0x8035
75 #define HDLC_CLNS (HDLC_ADDR_CMD<<16|TYPE_CLNS)
76 #define HDLC_CDP (HDLC_ADDR_CMD<<16|TYPE_CDP)
77 #define HDLC_MPLS (HDLC_ADDR_CMD<<16|TYPE_MPLS)
78 #define HDLC_IP (HDLC_ADDR_CMD<<16|TYPE_IP)
79 #define HDLC_IP_V6 (HDLC_ADDR_CMD<<16|TYPE_IP_V6)
80 #define HDLC_KEEPALIVE_CMD (HDLC_ADDR_CMD<<16|TYPE_KEEP)
86 typedef struct ppp_comp_hdr_type {
94 #define PPP_STATION 0xFF03
95 #define PPP_STATION_LEN 0x2
96 #define PPP_ENDPROTO 0x01
97 #define PPP_NOT_ENDPROTO 0xfffffffe
98 #define PPP_CONTROL_PROTOCOL_MASK 0x8000
99 #define PPP_CONTROL_PROTOCOL_BIT 15
100 #define PPP_CSCO_LEN 4
101 #define PPP_RFC1661_LEN 2
102 #define PPP_RFC1661_COMP_LEN 1
104 #define TYPE_PPP_IP 0x0021
105 #define TYPE_PPP_IP_V6 0x0057
106 #define TYPE_PPP_MPLS_UNICAST 0x0281
107 #define TYPE_PPP_MPLS_CONTROL 0x8281
108 #define TYPE_PPP_CLNS 0x0023
109 #define TYPE_PPP_CDP 0x0207
111 #define TYPE_PPP_IPCP 0x8021
112 #define TYPE_PPP_LCP 0xC021
113 #define TYPE_PPP_PAP 0xC023
114 #define TYPE_PPP_LQR 0xC025
115 #define TYPE_PPP_CHAP 0xC223
118 #define TYPE_PPP_LCP_ECHO_REQUEST 0x09
123 #define MLPPP_FLAGS_FIELD_LEN 4
124 #define MLPPP_BEGIN_MASK 0x80000000
125 #define MLPPP_END_MASK 0x40000000
126 #define MLPPP_BEGIN_END_MASK (MLPPP_BEGIN_MASK|MLPPP_END_MASK)
127 #define MLPPP_BEGIN_END_SHIFT 30
128 #define MLPPP_SEQUENCE_NUM_MASK 0x00FFFFFF
129 #define MLPPP_MC_CLASS_ID_MASK 0x3C000000
130 #define MLPPP_MC_CLASS_SHIFT 26
132 #define TYPE_PPP_MULTILINK 0x003D
134 /* these are needed in the micro-code, for optimizations */
135 #define TYPE_PPP_FULL_IP_4 0xff030021
136 #define TYPE_PPP_FULL_IP_3 0xff0321
137 #define TYPE_PPP_FULL_IP_2 0x0021
138 #define TYPE_PPP_FULL_IP_1 0x21
140 #define MLPPP_BEGIN_END_MASK_BYTE 0xC0
141 #define MLPPP_BEGIN_BIT 7
142 #define MLPPP_END_BIT 6
143 #define MLPPP_MC_CLASS_ID_MASK_BYTE 0x3C
144 #define MLPPP_MC_CLASS_ID_SHIFT_BYTE 2
146 #define MLPOA_BEGIN_END_SHIFT 24
153 typedef struct ethernet_arpa_hdr_type {
158 } ethernet_arpa_hdr_type;
160 typedef struct extension_802p3_type {
164 } extension_802p3_type;
166 typedef struct ethernet_802p3_hdr_type {
170 extension_802p3_type extension;
171 } ethernet_802p3_hdr_type;
174 typedef struct ethernet_vlan_802p3_hdr_type {
180 extension_802p3_type extension;
181 } ethernet_vlan_802p3_hdr_type;
183 #define MIN_ETHERNET_PKT_LEN 60
184 #define MAX_ETHERNET_PKT_LEN 1500
185 #define ETHERNET_ARPA_HDR_LEN 14
186 #define ETHERNET_TYPE_FIELD_SIZE 2
190 ** Ethernet 802.1q (VLAN)
193 typedef struct ethernet_vlan_hdr_type {
200 } ethernet_vlan_hdr_type;
204 ** Ethernet 802.1.q-in-q (QinQ)
207 typedef struct ethernet_qinq_hdr_type {
216 } ethernet_qinq_hdr_type;
220 ** Ethernet 802.3ad EtherChannel control
223 typedef struct ethernet_lacp_hdr_type {
229 } ethernet_lacp_hdr_type;
233 ** Ethernet 802.1 Bridge (spanning tree) PDU
236 typedef struct ethernet_bpdu_hdr_type {
243 } ethernet_bpdu_hdr_type;
245 #define ETH_BPDU_DSAP 0x42
246 #define ETH_BPDU_SSAP 0x42
247 #define ETH_BPDU_CONTROL 0x03
248 #define ETH_BPDU_MATCH 0x424203
251 /************************************************************/
252 /* PTA PLUS ETHERNET ENCAPSULATIONS */
254 * PPPoEoARPA 20 bytes
256 typedef struct ethernet_pppoe_arpa_hdr_type {
260 /* pppoe hdr at begining of enet payload */
261 u16 vtc; /* version(4b), type(4b) and code(8b) fields */
264 u8 ppp_header[0]; /* PPP header start, no ff03 field present */
265 } ethernet_pppoe_arpa_hdr_type;
267 typedef struct pppoe_hdr_type {
268 /* pppoe hdr at begining of enet payload */
269 u16 vtc; /* version(4b), type(4b) and code(8b) fields */
272 u8 ppp_header[0]; /* PPP header start, no ff03 field present */
276 ** PPPoEoVLAN (802.1p or 802.1q) 24 bytes
278 typedef struct ethernet_pppoe_vlan_hdr_type {
284 /* pppoe hdr at begining of enet payload */
285 u16 vtc; /* version(4b), type(4b) and code(8b) fields */
288 u8 ppp_header[0]; /* PPP header start, no ff03 field present */
289 } ethernet_pppoe_vlan_hdr_type;
292 ** PPPoEoQinQ 28 bytes
294 typedef struct ethernet_pppoe_qinq_hdr_type {
302 /* pppoe hdr at begining of enet payload */
303 u16 vtc; /* version(4b), type(4b) and code(8b) fields */
306 u8 ppp_header[0]; /* PPP header start, no ff03 field present */
307 } ethernet_pppoe_qinq_hdr_type;
309 #define ETH_PPPOE_ARPA_HDR_LEN sizeof(ethernet_pppoe_arpa_hdr_type)
310 #define ETH_PPPOE_VLAN_HDR_LEN sizeof(ethernet_pppoe_vlan_hdr_type)
311 #define ETH_PPPOE_QINQ_HDR_LEN sizeof(ethernet_pppoe_qinq_hdr_type)
312 #define PPPOE_HDR_LEN 6
313 /* End PTA PLUS ETHERNET ENCAPSULATIONS */
314 /****************************************************************/
318 #define TYPE_DOT1Q 0x8100
319 #define DOT1Q_HDR_LEN 18
320 #define DOT1Q_VLAN_ID_MASK 0x0FFF
321 #define DOT1Q_VLAN_ID_RES_0 0x0000
322 #define DOT1Q_VLAN_ID_RES_4095 0x0FFF
323 #define DOT1Q_ARPA_INDEX DOT1Q_VLAN_ID_RES_0
325 #define TYPE_QINQ_91 0x9100
326 #define TYPE_QINQ_92 0x9200
327 #define TYPE_QINQ_88A8 0x88A8
328 #define QINQ_HDR_LEN 22
333 #define DOT1P_VLAN_COS_MASK 0xE000
334 #define DOT1P_VLAN_COS_SHIFT 13
335 #define DOT1P_MAX_COS_VALUE 7
343 * TYPE_FR_IETF_IPV4 ENCAPS_FR_IETF
344 * TYPE_FR_CISCO_IPV4 ENCAPS_FR_CISCO
345 * TYPE_FR_ISIS ENCAPS_FR_ISIS
347 * FR_LMI_DLCI_CISCO LMI_DLCI_CISCO
348 * FR_LMI_DLCI_IETF LMI_DLCI_ITUANSI
351 typedef struct frame_relay_hdr_type {
355 } frame_relay_hdr_type;
357 typedef struct fr_snap_hdr_type {
366 #define FR_ADDR_LEN 2
367 #define FR_CTL_NLPID_LEN 2
368 #define FR_HDR_LEN (FR_ADDR_LEN+FR_CTL_NLPID_LEN)
371 * These defines are for the FR-SNAP header.
372 * The SNAP header is set up solely so that we can
373 * identify ARP packets, which look like this:
375 * control pad nlpid oui protocol_id
376 * 03 00 80 00 00 00 0806
378 #define FR_ARP_CONTROL 0x03
379 #define FR_ARP_PAD 0x00
380 #define FR_ARP_NLPID 0x80
381 #define FR_ARP_OUI_0 0x00
382 #define FR_ARP_OUI_1 0x00
383 #define FR_ARP_OUI_2 0x00
385 * these are used only in the tmc code
387 #define FR_NLPID_OUI_LEN 4
388 #define FR_ARP_CONTROL_PAD 0x0300
389 #define FR_ARP_NLPID_OUI 0x80000000
392 #define FR_DLCI_UPPER_MASK 0xFC00
393 #define FR_DLCI_UPPER_SHIFT 6
394 #define FR_DLCI_LOWER_MASK 0x00F0
395 #define FR_DLCI_LOWER_SHIFT 4
398 * Defines for converting a DLCI for insertion into a synthesized FR address
399 * field for FRoMPLS disposition.
401 * bit 8 7 6 5 4 3 2 1
402 * +-------------------------------+
404 * | 0 1 1 1 1 1 1 0 |
405 * +-------------------------------+
406 * | Upper DLCI |C/R| 0 |
407 * +-------------------------------+
408 * | Lower DLCI | F | B | DE| 1 |
409 * +-------------------------------+
411 * :Frame relay information field :
414 * +-------------------------------+
415 * | FCS (2 or 4 octets) |
417 * +-------------------------------+
419 * | 0 1 1 1 1 1 1 0 |
420 * +-------------------------------+
422 * a-With 10 bits for the DLCI
424 #define FR_DLCI_TO_HDR_UPPER_MASK 0x3f0
425 #define FR_DLCI_TO_HDR_UPPER_SHIFT (10-4)
426 #define FR_DLCI_TO_HDR_LOWER_MASK 0xf
427 #define FR_DLCI_TO_HDR_LOWER_SHIFT 4
429 #define TYPE_FR_IETF_IP 0x03CC
430 #define TYPE_FR_IETF_IP_V6 0x038E
431 #define TYPE_FR_CISCO_IP 0x0800
432 #define TYPE_FR_CISCO_IP_V6 0x86DD
433 #define TYPE_FR_ISIS 0x0383
434 #define TYPE_FR_SNAP0PAD 0x0380
435 #define TYPE_FR_SNAP1PAD 0x0300
436 #define TYPE_FR_FRF12 0x03B1
437 #define TYPE_FR_MLP 0x03CF
438 #define TYPE_FR_EEK 0x8037
440 #define FR_LMI_DLCI_CISCO 1023
441 #define FR_LMI_DLCI_IETF 0
443 #define FR_NOT_NOT_NOT 0
444 #define FR_NOT_NOT_DE 1
445 #define FR_NOT_BECN_NOT 2
446 #define FR_NOT_BECN_DE 3
447 #define FR_FECN_NOT_NOT 4
448 #define FR_FECN_NOT_DE 5
449 #define FR_FECN_BECN_NOT 6
450 #define FR_FECN_BECN_DE 7
452 #define FR_FECN_BECN_DE_MASK 0x000E
453 #define FR_FECN_BECN_DE_SHIFT 1
455 /* Address field extension bit for standard 2-byte FR address field */
456 #define FR_EA1_MASK 0x0001
457 #define FR_EA1_MASK_BIT 0
460 * these are needed in the micro-code, for optimizations
463 /* the bit position (in the address field) of the LSB of the DLCI */
464 #define FR_DLCI_LS_BIT 4
469 ** MultiLink Frame Relay
473 typedef struct mlfr_hdr_type {
481 * LIP frames have B, E and C set--the other
482 * bits in the frag_hdr field are irrelevant.
484 * NOTE: Injected LIP packets have a frag_hdr of 0xE100.
487 #define MLFR_LIP_FRAME 0xE100
488 #define MLFR_LIP_MASK 0xE000
489 #define MLFR_FRAG_HDR_LEN 2
491 #define MLFR_BEGIN_MASK 0x8000
492 #define MLFR_END_MASK 0x4000
493 #define MLFR_BEGIN_END_MASK (MLFR_BEGIN_MASK|MLFR_END_MASK)
494 #define MLFR_BEGIN_END_SHIFT 14
496 #define MLFR_SEQ_NUM_HI_MASK 0x1E00
497 #define MLFR_SEQ_NUM_HI_SHIFT 1
498 #define MLFR_SEQ_NUM_LO_MASK 0x00FF
501 * these are needed in the micro-code, for optimizations
503 #define MLFR_BEGIN_END_MASK_BYTE 0xC0
509 typedef struct frf12_hdr_type_ {
516 #define FRF12_FRAG_HDR_LEN sizeof(frf12_hdr_type)
518 #define FRF12_BEGIN_MASK 0x8000
519 #define FRF12_END_MASK 0x4000
520 #define FRF12_BEGIN_END_MASK (FRF12_BEGIN_MASK|FRF12_END_MASK)
521 #define FRF12_BEGIN_END_SHIFT 8
523 #define FRF12_SEQ_NUM_HI_MASK 0x1E00
524 #define FRF12_SEQ_NUM_HI_SHIFT 1
525 #define FRF12_SEQ_NUM_LO_MASK 0x00FF
526 #define FRF12_BEGIN_END_MASK_BYTE 0xC0
532 ** MLP over Frame Relay
533 ** The ppp hdr can be either a
534 ** an MLP hdr or a PPP hdr
536 ** MLP can be compressed or not:
541 ** 1 byte with begin/end bits
542 ** 3 bytes of a sequence #
544 ** PPP can be also be compressed or not.
545 ** Only these will be fwded:
553 typedef struct mlpofr_hdr_type {
564 * channel_handle is defined as follows:
566 * bits 15 = reserved (must be 0)
567 * bits 14 - 0 = channel handle
570 * flags is a bitfield defined as follows:
572 * bits 15 - 13 = proto (PPPoA RFC1661 = 0,
576 * MLPoATM RFC1661 = 4,
579 * bit 12 = encap (MUX=0,
581 * bits 11 - 6 = reserved (must be 0)
582 * bits 5 - 3 = pkt_type (AAL5 pkt = 0,
583 * Raw cell (includes F4 OAM) = 1,
584 * F5 segment OAM cell = 2
585 * F5 end-to-end OAM cell = 3
587 * bit 2 = EFCI (congestion indication)
588 * bit 1 = reserved (must be 0)
589 * bit 0 = CLP (cell loss priority)
592 typedef struct apollo_atm_generic_hdr_type {
595 } apollo_atm_generic_hdr_type;
597 typedef struct apollo_atm_aal5_snap_hdr_type {
606 } apollo_atm_aal5_snap_hdr_type;
608 typedef struct atm_aal5_snap_hdr_type {
616 } atm_aal5_snap_hdr_type;
619 typedef struct apollo_atm_aal5_snap_hdr1_type {
630 } apollo_atm_aal5_snap_hdr1_type;
632 typedef struct apollo_atm_aal5_clns_hdr_type {
637 } apollo_atm_aal5_clns_hdr_type;
639 typedef struct apollo_atm_aal5_ilmi_hdr_type {
643 } apollo_atm_aal5_ilmi_hdr_type;
645 typedef struct apollo_atm_aal5_mux_hdr_type {
649 } apollo_atm_aal5_mux_hdr_type;
651 typedef struct apollo_atm_oam_f4_hdr_type {
655 * gcf_vpi_vci_pt_clp is a bitfield defined as follows:
663 u32 gcf_vpi_vci_pt_clp;
665 } apollo_atm_oam_f4_hdr_type;
667 #define APOLLO_ATM_OAM_F4_HDR_PT_MASK 0xE
668 #define APOLLO_ATM_OAM_F4_HDR_PT_SHIFT 1
670 typedef struct apollo_atm_oam_f5_hdr_type {
674 } apollo_atm_oam_f5_hdr_type;
676 #define APOLLO_IRONBUS_EXT_LESS_PROTO 0xFFFF0FFF
677 #define APOLLO_CHANNEL_HANDLE_MASK 0xFFFF
678 #define APOLLO_PKT_TYPE_MASK 0x0038
679 #define APOLLO_PKT_TYPE_SHIFT 3
680 #define APOLLO_FLAG_CLP_MASK 0x0001
681 #define APOLLO_FLAG_CLP_BIT 0
683 #define APOLLO_CHANNEL_HANDLE_RES_0 0x0000
685 * The 1 byte HEC field is removed by the line card.
687 #define APOLLO_F4_RX_CELL_SIZE 52
688 #define APOLLO_F5_RX_CELL_SIZE 52
690 #define APOLLO_ATM_PACKET_TYPE_AAL5 0
691 #define APOLLO_ATM_PACKET_TYPE_F4 1
692 #define APOLLO_ATM_PACKET_TYPE_F5_SEG 2
693 #define APOLLO_ATM_PACKET_TYPE_F5_E_TO_E 3
694 #define APOLLO_ATM_PACKET_TYPE_4 4
695 #define APOLLO_ATM_PACKET_TYPE_5 5
696 #define APOLLO_ATM_PACKET_TYPE_6 6
697 #define APOLLO_ATM_PACKET_RESERVED 7
699 #define APOLLO_AAL5_MUX_IP_HDR_LEN 4
700 #define APOLLO_AAL5_SNAP_HDR_LEN 12
702 #define APOLLO_RCV_IRON_BUS_EXT_LEN 4
703 #define APOLLO_TX_IRON_BUS_EXT_LEN 8
706 * MLPoA type definitions
708 #define MLPOA_CISCO_HDR 0xFF03
709 #define MLPOA_SNAP_HDR_LEN 4
710 #define MLPOA_CISCO_HDR_LEN 2
712 /************************************************************/
713 /* PTA PLUS ATM ENCAPSULATIONS */
715 /* RBE header 28 bytes*/
716 typedef struct apollo_atm_aal5_llcsnap_rbe_hdr_type {
725 /* enet header within */
729 u8 data[0]; /* start of IP */
730 } apollo_atm_aal5_llcsnap_rbe_hdr_type;
732 /* PPPoEoA header 34 bytes*/
733 typedef struct apollo_atm_aal5_llcsnap_pppoe_hdr_type {
742 /* enet header within */
746 /* pppoe hdr at begining of enet payload */
747 u16 vtc; /* version(4b), type(4b) and code(8b) fields */
750 u8 ppp_header[0]; /* PPP header start, no ff03 field present */
751 } apollo_atm_aal5_llcsnap_pppoe_hdr_type;
754 /* PPPoA MUX 4 bytes*/
755 typedef struct apollo_atm_aal5_mux_pppoa_hdr_type {
759 } apollo_atm_aal5_mux_pppoa_hdr_type;
762 /* PPPoA SNAP LLC 8 bytes */
763 typedef struct apollo_atm_aal5_llcsnap_pppoa_hdr_type {
771 } apollo_atm_aal5_llcsnap_pppoa_hdr_type;
773 /* MLPoA MUX (generic) */
774 typedef struct apollo_atm_aal5_mux_mlpoa_hdr_type {
778 } apollo_atm_aal5_mux_mlpoa_hdr_type;
781 typedef struct apollo_atm_aal5_llcsnap_mlpoa_hdr_type {
789 } apollo_atm_aal5_llcsnap_mlpoa_hdr_type;
792 #define PPPOA_SNAPLLC_HDR_LEN sizeof(apollo_atm_aal5_llcsnap_pppoa_hdr_type)
793 #define PPPOA_MUX_HDR_LEN sizeof(apollo_atm_aal5_mux_pppoa_hdr_type)
794 #define PPPOE_SNAPLLC_HDR_LEN sizeof(apollo_atm_aal5_llcsnap_pppoe_hdr_type)
795 #define RBE_SNAPLLC_HDR_LEN sizeof(apollo_atm_aal5_llcsnap_rbe_hdr_type)
797 /* End PTA PLUS ATM ENCAPSULATIONS */
798 /****************************************************************/
800 #define LLCSNAP_PID_DOT3_NOFCS 0x0007
807 * Note that some of these definitions are split
808 * up along certain word or half word boundaries
809 * to help expediate the TMC code.
811 #define LLC_SNAP_HDR_DSAP 0xAA
812 #define LLC_SNAP_HDR_SSAP 0xAA
813 #define LLC_SNAP_HDR_CONTROL 0x03
814 #define LLC_SNAP_HDR_OUI_0 0x00
815 #define LLC_SNAP_HDR_OUI_1 0x00
816 #define LLC_SNAP_HDR_OUI_2 0x00
817 #define LLC_SNAP_HDR_OUI_2_CDP 0x0C
819 #define LLC_SNAP_HDR_DSAP_SSAP 0xAAAA
820 #define LLC_SNAP_HDR_DSAP_SSAP_CTRL_OUI0 0xAAAA0300
821 #define LLC_SNAP_HDR_CONTROL_OUI 0x03000000
822 #define LLC_SNAP_HDR_OUI1_OUI2_CDP 0x000C2000
831 * The v2_gen_hdr is a 2-byte field that contains the following:
833 * [ ttl | ring_id | mode | priority | parity ]
836 typedef struct srp_hdr_type {
844 #define SRP_HDR_LEN 16
846 #define SRP_IB_CHANNEL_CONTROL 0x0000
847 #define SRP_IB_CHANNEL_DATA_HI 0x0001
848 #define SRP_IB_CHANNEL_DATA_LO 0x0002
850 #define SRP_RING_ID_MASK 0x0080
851 #define SRP_RING_ID_BIT 7
853 #define SRP_MODE_BITS_MASK 0x0070
854 #define SRP_MODE_BITS_SHIFT 4
855 #define SRP_MODE_CONTROL_TOPOLOGY 4
856 #define SRP_MODE_CONTROL_IPS 5
857 #define SRP_MODE_DATA 7
859 #define SRP_PRIORITY_BITS_MASK 0x000E
860 #define SRP_PRIORITY_BITS_SHIFT 1
861 #define SRP_PRIORITY_HIGH 7
862 #define SRP_PRIORITY_PAK_PRIORITY 6
864 /* this is for the tmc code */
865 #define SRP_INV_PRIORITY_BITS_MASK 0xFFF1
867 #define SRP_PROT_CONTROL_TOPOLOGY 0x2007
868 #define SRP_PROT_CONTROL_IPS 0x2007
870 /* this is for the tmc code */
877 #define MPLS_EOS_BIT 0x00000100
878 #define MPLS_EOS_SHIFT 8
879 #define MPLS_LABEL_SIZE 4
880 #define MAX_MPLS_LABEL_STACK 6
881 #define MPLS_LABEL_MASK 0xfffff000
882 #define MPLS_LABEL_SHIFT 12
883 #define MPLS_TTL_MASK 0x000000ff
884 #define MPLS_EXP_MASK 0x00000e00
885 #define MPLS_EXP_SHIFT 9
886 #define MPLS_EXP_TTL_MASK 0x00000eff
890 typedef union _layer2 {
892 ppp_comp_hdr_type ppp;
893 ethernet_arpa_hdr_type eth_arpa;
894 ethernet_vlan_hdr_type eth_vlan;
895 ethernet_qinq_hdr_type eth_qinq;
896 ethernet_lacp_hdr_type eth_lacp;
897 ethernet_bpdu_hdr_type eth_bpdu;
898 ethernet_802p3_hdr_type eth_802p3;
899 ethernet_vlan_802p3_hdr_type eth_vlan_802p3;
900 ethernet_pppoe_arpa_hdr_type eth_pppoe_arpa; /* PTA plus */
901 ethernet_pppoe_vlan_hdr_type eth_pppoe_vlan; /* PTA plus */
902 ethernet_pppoe_qinq_hdr_type eth_pppoe_qinq; /* PTA plus */
903 frame_relay_hdr_type frame_relay;
904 fr_snap_hdr_type fr_snap;
906 mlpofr_hdr_type mlpofr;
907 frf12_hdr_type frf12;
908 apollo_atm_generic_hdr_type atm_generic;
909 apollo_atm_aal5_snap_hdr_type atm_aal5_snap;
910 apollo_atm_aal5_snap_hdr1_type atm_aal5_snap1;
911 apollo_atm_aal5_clns_hdr_type atm_aal5_clns;
912 apollo_atm_aal5_ilmi_hdr_type atm_aal5_ilmi;
913 apollo_atm_aal5_mux_hdr_type atm_aal5_mux;
914 apollo_atm_oam_f4_hdr_type atm_oam_f4;
915 apollo_atm_oam_f5_hdr_type atm_oam_f5;
916 apollo_atm_aal5_llcsnap_rbe_hdr_type atm_aal5_rbe_snapllc; /* PTA plus */
917 apollo_atm_aal5_llcsnap_pppoe_hdr_type atm_aal5_pppoe_snapllc; /* PTA plus */
918 apollo_atm_aal5_mux_pppoa_hdr_type atm_aal5_pppoa_mux; /* PTA plus */
919 apollo_atm_aal5_llcsnap_pppoa_hdr_type atm_aal5_pppoa_snapllc; /* PTA plus */
920 apollo_atm_aal5_mux_mlpoa_hdr_type mlpoa_generic;
921 apollo_atm_aal5_llcsnap_mlpoa_hdr_type mlpoa_snapllc;
926 * Define the Common OAM cell format - F4 & F5 cells
929 * VCI == (3 == Segment), (4 == End-to-End)
934 * PT == (100 == Segment, 101 == End-to-End)
936 * OAM Cell Type & Function Type:
938 * OAM_TYPE = (0001 == Fault management)
939 * OAM_FUNC == (0000 == AIS, 0001 == RDI, 0100 == CC,
942 * OAM_TYPE = (0010 == Performance management)
943 * OAM_FUNC == (0000 == Forward Monitoring(FM),
944 * 0001 == Backward monitoring(BR),
945 * 0010 == Monitoring & reporting (FM+BR))
947 * OAM_TYPE = (1000 == Activation/Deactivation)
948 * OAM_FUNC == (0000 == Performance Monitoring,
949 * 0001 == Continuity Check)
951 * OAM_TYPE = (1111 == Sytem Management)
952 * OAM_FUNC == (0001 == Security - non-real-time,
953 * 0010 == Security - real-time)
956 #define ATM_OAM_FAULT_MGMT 0x1 /* OAM Fault mgmt. code */
957 #define ATM_OAM_PRFRM_MGMT 0x2 /* performance mgmt code */
958 #define ATM_OAM_ACT_DEACT 0x8 /* OAM Activation/Deactivation
960 #define ATM_OAM_SYSTEM_MGMT 0xF /* System Management code */
962 #define ATM_OAM_AIS_FUNC 0x0 /* AIS function type */
963 #define ATM_OAM_RDI_FUNC 0x1 /* RDI function type */
964 #define ATM_OAM_CC_FUNC 0x4 /* OAM CC FM function code */
965 #define ATM_OAM_LOOP_FUNC 0x8 /* Loopback function type */
967 #define ATM_OAM_F5_SEGMENT 0x4 /* Segment function */
968 #define ATM_OAM_F5_ENDTOEND 0x5 /* End-to-End function */
969 #define ATM_OAM_F4_SEGMENT 0x3 /* Segment function */
970 #define ATM_OAM_F4_ENDTOEND 0x4 /* End-to-End function */
971 #define ATM_OAM_F4_PTI_ZERO 0x0 /* PTI=0 for F4 OAM */
973 typedef struct atm_oam_hdr_t_ {
974 unsigned oam_gfc:4; /* GFC */
975 unsigned oam_vpi:8; /* VPI */
976 unsigned oam_vci_ms:4; /* VCI (Most Significant Bits) */
978 unsigned oam_vci_ls:12; /* VCI (Least Significant Bits) */
979 unsigned oam_pt:3; /* Payload Type */
980 unsigned oam_clp:1; /* Cell Loss Priority */
984 typedef struct atm_oam_type_func_t_ {
988 } atm_oam_type_func_t;
991 ** IP Version 4 header
995 * version_hdr_len_words [7-4] IP Header Version
996 * [3-0] IP Header Length in 32-bit words
997 * tos Type of Service
998 * total_len_bytes Total IP datagram length in bytes
999 * (including IP header)
1000 * identification Unique fragmentation identifier
1001 * frag_flags_offset [15-13] Fragmentation flags
1002 * [12-0] Fragmentation Offset
1004 * protocol_id Protocol Identifier
1005 * checksum 16-bit 1's complement IP Header checksum
1006 * src_addr IP Source Address
1007 * dest_addr IP Destination Address
1009 typedef struct ipv4_header {
1010 u8 version_hdr_len_words;
1012 u16 total_len_bytes;
1014 u16 frag_flags_offset;
1023 /*OPTIONS PACKET TYPE
1028 typedef struct ipv4_options {
1035 #define LOOSE_SOURCE_ROUTE 131
1036 #define STRICT_SOURCE_ROUTE 137
1037 #define IPV4_NO_OPTIONS_HDR_LEN (sizeof(ipv4_header))
1038 #define IPV4_VERSION 4
1039 #define IPV4_HEADER_LENGTH_WORDS 5
1040 #define IPV4_VERSION_HDR_LEN_FIELD ((u8) 0x45)
1041 #define IPV4_HEADER_LENGTH_WORDS 5
1042 #define IPV4_MIN_HEADER_LENGTH_BYTES 20
1043 #define IP_HDR_LEN sizeof(ipv4_header)
1044 #define IPV4_VERSION_VALUE_SHIFT 4
1046 #define IPV4_FRAG_OFFSET_MASK (0x1fff)
1047 #define IPV4_FRAG_MF_MASK (0x2000)
1048 #define IPV4_FRAG_MF_SHIFT (13)
1051 #define IP_BOOTP_SOURCE_ADDRESS 0
1052 /* 255.255.255.255 */
1053 #define IP_LIMITED_BROADCAST_ADDRESS 0xFFFFFFFF
1056 * IPv4 header - version & length fields
1058 #define IP_VER_LEN 0x45
1060 #define IP_MIN_LEN 0x5
1061 #define IP_VER_MASK 0xf0
1062 #define IP_LEN_MASK 0x0f
1065 * IPv4 header - TOS field
1067 #define PS_IP_TOS_MASK 0xff
1068 #define IP_PRECEDENCE_SHIFT 5 /* shift value up to precedence bits */
1069 #define IP_DSCP_SHIFT 2 /* shift value up to dscp bits */
1071 #define IP_TOS_PRECEDENCE 0xe0 /* mask of precedence in tos byte */
1072 #define IP_TOS_NO_PRECEDENCE 0x1f
1073 #define IP_TOS_LOW_DELAY 8 /* values must be shifted 1 bit */
1074 #define IP_TOS_HIGH_TPUT 4 /* before using */
1075 #define IP_TOS_HIGH_RELY 2
1076 #define IP_TOS_LOW_COST 1
1077 #define IP_TOS_NORMAL 0
1078 #define IP_TOS_MASK 0x1e /* mask of tos in tos byte */
1079 #define IP_TOS_MBZ_MASK 0x01 /* mask for MZB bit in tos byte */
1080 #define IP_TOS_DSCP 0xfc /* mask for dscp in tos byte */
1081 #define IP_TOS_NO_DSCP 0x03
1083 #define IP_TOS_METRIC_TYPES 8
1084 #define IP_TOS_SHIFT 1
1086 #define IP_TOS_PRECEDENCE_MASK (IP_TOS_PRECEDENCE | IP_TOS_MASK)
1089 * IP TOS Precedence values (High order 3 bits)
1091 #define TOS_PREC_NET_CONTROL 0xe0
1092 #define TOS_PREC_INET_CONTROL 0xc0
1093 #define TOS_PREC_CRIT_ECP 0xa0
1094 #define TOS_PREC_FLASH_OVER 0x80
1095 #define TOS_PREC_FLASH 0x60
1096 #define TOS_PREC_IMMEDIATE 0x40
1097 #define TOS_PREC_PRIORITY 0x20
1098 #define TOS_PREC_ROUTINE 0x00
1099 #define TOS_PREC_ILLEGAL 0xff /* invalid precedence value */
1101 #define TOS_PREC_NET_CONTROL_NUM 7
1102 #define TOS_PREC_INET_CONTROL_NUM 6
1103 #define TOS_PREC_CRIT_ECP_NUM 5
1104 #define TOS_PREC_FLASH_OVER_NUM 4
1105 #define TOS_PREC_FLASH_NUM 3
1106 #define TOS_PREC_IMMEDIATE_NUM 2
1107 #define TOS_PREC_PRIORITY_NUM 1
1108 #define TOS_PREC_ROUTINE_NUM 0
1113 * IPv4 header - flags and fragment offset fields
1115 #define IP_FRAG_OFFSET_MASK 0x1fff
1118 #define IP_FRAG_MORE_MASK 0x2000
1119 #define IP_FRAG_DF_MASK 0x4000
1120 #define IP_FRAG_UNDEF_MASK 0x8000
1121 #define IP_FRAG_NO_DF_SET 0x0000
1123 /* bit definitions for fragment flags */
1124 #define IP_FRAG_MORE_BIT 13
1125 #define IP_FRAG_DF_BIT 14
1126 #define IP_FRAG_UNDEF_BIT 15
1129 * IPv4 header - TTL field
1131 #define TTL_DEFAULT 255
1138 * IPv4 header - protocol field
1141 * IGMP_PROT 2 group management
1143 * IPINIP_PROT 4 IPv4 in IPv4 encapsulation
1150 * IPV6_INIP_PROT 41 IPV6 in IPv4 encapsulation
1155 * SDNS0_PROT 53 SNDS
1157 * SDNS1_PROT 55 SDNS1
1158 * HELLO_PROT 63 HELLO
1160 * EONIP_PROT 80 CLNS over IP
1161 * VINES_PROT 83 Banyan Vines
1162 * NEWIGRP_PROT 88 IGRP
1164 * FST_RSRB_PROT 90 RSRB
1165 * FST_DLSW_PROT 91 DLSW
1166 * NOSIP_PROT 94 KA9Q/NOS compatible IP over IP
1167 * PIM_PROT 103 PIMv2
1170 * MAX_PROT 113 maximum protocol number in the above list,
1171 * used in creating case registry
1176 #define IPINIP_PROT 4
1183 #define IPV6_INIP_PROT 41
1184 #define RSVP_PROT 46
1188 #define SDNS0_PROT 53
1189 #define NHRP_PROT 54
1190 #define SDNS1_PROT 55
1191 #define HELLO_PROT 63
1193 #define EONIP_PROT 80
1194 #define VINES_PROT 83
1195 #define NEWIGRP_PROT 88
1196 #define OSPF_PROT 89
1197 #define FST_RSRB_PROT 90
1198 #define FST_DLSW_PROT 91
1199 #define NOSIP_PROT 94
1200 #define PIM_PROT 103
1201 #define PCP_PROT 108
1202 #define PGM_PROT 113
1203 #define MAX_PROT 113
1205 /*Well Known Application ports */
1206 #define FTP_PORT 21 /* For control connection */
1210 typedef struct tcp_hdr_type {
1223 #define TCP_FLAG_FIN 0x01
1224 #define TCP_FLAG_SYN 0x02
1225 #define TCP_FLAG_RST 0x04
1226 #define TCP_FLAG_PUSH 0x08
1227 #define TCP_FLAG_ACK 0x10
1228 #define TCP_FLAG_URG 0x20
1229 #define TCP_FLAG_ECE 0x40
1230 #define TCP_FLAG_CWR 0x80
1235 typedef struct tcp_option_s {
1241 #define TCP_END_OPTIONS_LIST 0
1242 #define TCP_OPTION_NOP 1
1243 #define TCP_OPTION_MSS 2
1244 #define TCP_OPTION_WINDOW_SCALE 3
1245 #define TCP_OPTION_SACK_PERMITTED 4
1246 #define TCP_OPTION_SACK_DATA 5
1247 #define TCP_OPTION_ECHO 6
1248 #define TCP_OPTION_ECHO_REPLY 7
1249 #define TCP_OPTION_TSOPT 8
1251 9 2 Partial Order Connection Permitted. RFC 1693
1252 10 3 Partial Order Service Profile. RFC 1693
1253 11 6 CC, Connection Count. RFC 1644
1254 12 6 CC.NEW RFC 1644
1255 13 6 CC.ECHO RFC 1644
1256 14 3 TCP Alternate Checksum Request. RFC 1146
1257 15 Variable. TCP Alternate Checksum Data. RFC 1146
1260 18 3 Trailer Checksum Option.
1262 #define TCP_OPTION_MD5_SIGNATURE 19
1264 20 SCPS Capabilities.
1265 21 Selective Negative Acknowledgements.
1266 22 Record Boundaries.
1267 23 Corruption experienced.
1270 26 TCP Compression Filter.
1272 #define TCP_OPTION_QUICK_START 27
1274 #define TCP_OPTION_NUM_MAX 27
1277 #define tcp_printf(format_str, params...) //printf(format_str, ## params)
1279 #define tcp_printf(format_str, params...) printf(format_str, ## params)
1282 typedef struct udp_hdr_type {
1289 #define TYPE_IPV6 0x86dd
1290 #define TYPE_IPV4 0x0800
1293 * version_trafficclass_flowlabel [31:28] IP Header Version,
1294 [27:20] traffic_class,
1295 [19:0] flow_label[20]
1296 * payload_length Length of packet in bytes excluding header size(s)
1297 * next_header Identifies the type of header following the IPv6 header
1298 * hop_limit Decremented by 1 by each forwarding node, packet discarded when zero
1299 * src_addr IPv6 Source Address
1300 * dst_addr IPv6 Destination Address
1302 typedef struct ipv6_header {
1303 u32 version_trafficclass_flowlabel;
1312 #define IPV6_HDR_LEN 40
1313 #define IPV6_HDR_LEN_WORDS 10
1314 #define IPV6_FLABLE_MASK 0x000FFFFF
1315 #define IPV6_MIN_PATH_MTU (1280)
1317 #define IPV6_GET_IP_VER(ih) ((clib_net_to_host_u32((ih) \
1318 ->version_trafficclass_flowlabel) >> 28) & 0xf)
1319 #define IPV6_GET_TOS(ih) ((clib_net_to_host_u32((ih) \
1320 ->version_trafficclass_flowlabel) >> 20) & 0xff)
1321 #define IPV6_GET_FLOW_LABEL(ih) ((clib_net_to_host_u32((ih) \
1322 ->version_trafficclass_flowlabel)) & 0xfffff)
1324 #define IPV6_VERSION_VALUE (6)
1325 #define IPV6_VERSION_VALUE_SHIFT (28)
1326 #define IPV6_TRAFFIC_CLASS_VALUE_SHIFT (20)
1327 #define IPV6_TRAFFIC_CLASS_VALUE_MASK (0xff)
1329 #define IPV6_PROTO_HOPOPTS 0
1330 #define IPV6_PROTO_TCP 6
1331 #define IPV6_PROTO_UDP 17
1332 #define IPV6_PROTO_IPV6 41
1333 #define IPV6_PROTO_ROUTING 43
1334 #define IPV6_PROTO_FRAGMENT 44
1335 #define IPV6_PROTO_DESTOPTS 60
1336 #define IPV6_PROTO_ESP 50
1337 #define IPV6_PROTO_AH 51
1338 #define IPV6_PROTO_ICMPV6 58
1339 #define IPV6_PROTO_NONE 59
1341 /* standard v6 extension header are 2 tytes
1342 * one byte next header
1343 * one byte header length
1346 typedef struct ipv6_frag_header {
1349 u16 frag_offset_res_m;
1351 } ipv6_frag_header_t;
1353 #define IPV6_FRAG_HDR_LEN (sizeof(ipv6_frag_header_t))
1355 #define IPV6_FRAG_OFFSET_MASK (0xFFF8)
1356 #define IPV6_FRAG_OFFSET_SHIFT (3)
1357 #define IPV6_FRAG_MORE_FRAG_MASK (0x0001)
1359 #define IPV6_TOS_SHIFT 20
1360 #define IPV6_TOS_SHIFT_HLF_WD 4
1361 #define IPV6_NEXT_HDR_SHIFT 8
1363 typedef struct ipv6_routing_header {
1369 } ipv6_routing_header_t;
1370 #define IPV6_ROUTING_HDR_LEN (sizeof(ipv6_routing_header_t))
1372 typedef struct ipv6_hop_header {
1376 } ipv6_hop_header_t;
1377 #define IPV6_HOP_LEN (sizeof(ipv6_hop_header_t))
1379 typedef struct ipv6_dest_opt_header {
1383 } ipv6_dest_opt_header_t;
1384 #define IPV6_DESTOPT_LEN (sizeof(ipv6_dest_opt_header_t))
1387 /* Definition of ICMP header */
1388 typedef struct icmp_v4_s {
1396 #define ICMPV4_HDR_SIZE (sizeof(icmp_v4_t))
1397 #define ICMPV4_ECHOREPLY 0 /* Type: echo reply */
1398 #define ICMPV4_ECHO 8 /* Type: echo request */
1400 #define ICMPV4_UNREACHABLE 3 /* Type: destination unreachable */
1401 #define ICMPV4_UNRNET 0 /* Code: Net unreachable */
1402 #define ICMPV4_UNRHOST 1 /* Code: host unreachable */
1403 #define ICMPV4_UNRPROT 2 /* Code: protocol unreachable */
1404 #define ICMPV4_UNRPORT 3 /* Code: port unreachable */
1405 #define ICMPV4_UNRFRAG 4 /* Code: frag req DF set */
1406 #define ICMPV4_UNRADMIN 13 /* Code: administratively prohib. */
1407 #define ICMPV4_SOURCEROUTE_FAILED 5 /* Code: administratively prohib. */
1409 #define ICMPV4_SRC_ROUTE_FAIL 5 /* Code: Source Route Failed */
1410 #define ICMPV4_NO_ROUTE_DESTN_8 8 /* Code: No Route to Destn */
1411 #define ICMPV4_NO_ROUTE_DESTN_11 11 /* Code: No Route to Destn */
1412 #define ICMPV4_NO_ROUTE_DESTN_12 12 /* Code: No Route to Destn */
1414 #define ICMPV4_ADMIN_PROH_9 9 /* Code: Administratively Prohibited */
1415 #define ICMPV4_ADMIN_PROH_10 10 /* Code: Administratively Prohibited */
1416 #define ICMPV4_PREC_CUTOFF 15 /* Code: Precedence Cutoff */
1419 #define ICMPV4_TIMEEXCEEDED 11 /* Type: time exceeded */
1420 #define ICMPV4_TIMTTL 0 /* Code: ttl in transit code */
1422 #define ICMPV4_PARAMETER_PROBLEM 12 /* Type: Parameter Problem */
1423 #define ICMPV4_PARAM_ERROR 0 /* Code: Pointer to Error */
1424 #define ICMPV4_MISSING_OPTION_CODE 1 /* Code: Mission option */
1425 #define ICMPV4_PARAM_BAD_LEN 2 /* Code: Bad Length */
1427 #define ICMPV4_CONVERSION_ERROR 31
1428 #define ICMPV4_SOURCE_QUENCH 4
1429 #define ICMPV4_REDIRECT 5
1430 #define ICMPV4_TIMESTAMP 13
1431 #define ICMPV4_TIMESTAMP_REPLY 14
1432 #define ICMPV4_INFO_REQUEST 15
1433 #define ICMPV4_INFO_REPLY 16
1434 #define ICMPV4_ADDR_MASK_REQUEST 17
1435 #define ICMPV4_ADDR_MASK_REPLY 18
1437 typedef struct icmp_v6_s {
1446 typedef struct pseudo_v6_header {
1451 } pseudo_v6_header_t;
1454 #define ICMPV6_ECHO 128
1455 #define ICMPV6_ECHO_REPLY 129
1456 #define ICMPV6_PKT_TOO_BIG 2
1457 #define ICMPV6_TIMEEXCEEDED 3
1458 #define ICMPV6_TIMTTL 0
1459 #define ICMPV6_PARAMETER_PROBLEM 4
1460 #define ICMPV6_UNREACHABLE 1
1461 #define ICMPV6_NEIGHBOR_SOLICITAION 135
1462 #define ICMPV6_NEIGHBOR_ADVT 136
1463 /* ICMP V6 generated packet size */
1464 #define ICMPV6_ERR_SIZE 48
1465 #define ICMPV6_HDR_SIZE (sizeof(icmp_v6_t) +sizeof(u32))
1467 /* Code for Type 1 */
1468 #define ICMPV6_UNRDESTN 0 /* Code: No route to Desnt */
1469 #define ICMPV6_ADM_PROH 1 /* Code: Adminitrative Prohibited */
1470 #define ICMPV6_SRC_ADD_SCOPE 2 /* Code: Source Address beyond scope */
1471 #define ICMPV6_UNRHOST 3 /* Code: Host Unreachable */
1472 #define ICMPV6_UNRPORT 4 /* Code: Port UnReachable */
1474 #define ICMPV6_UNRPROT 1 /* type 4 - Code: No route to Desnt */
1476 #define ICMPV6_PTB_CODE 0 /* Code: For PTB */
1477 #define ICMPV6_PARAM_CODE 0 /* Code: For Parameter Problem */
1478 #define ICMPV6_UNREC_HDR 1 /* Code: For Parameter Problem */
1479 #define ICMPV6_SRC_ADD_FAIL 5 /* Code: For Source address failed */
1480 #define ICMP_ECHO_REPLY_CODE 0
1481 #define DEFAULT_TTL_HOPLIMIT_VAL 64
1483 typedef struct pptp_hdr_type {
1486 u16 proto_type; /* PPP = 0x880B */
1500 * u8* tcp_findoption (tcp_hdr_t *tcp, uchar option)
1503 * tcp - pointer to TCP header
1504 * option - TCP option
1507 * This function returns a pointer to the option found,
1508 * otherwise returns null.
1512 * This function searches the option and returns a pointer to the
1513 * matched option field containing option kind/length/data sub-fields.
1516 static inline u8* tcp_findoption (tcp_hdr_type *tcp, u8 option)
1521 data = tcp->option_data;
1522 len = ((tcp->hdr_len>>4) << 2) - sizeof(tcp_hdr_type);
1524 #define MAXTCPOPTIONBYTES 40
1525 #define MINTCPOPTIONLENGTH 2
1528 if (PREDICT_TRUE(option == data[0])) {
1532 case TCP_END_OPTIONS_LIST:
1534 case TCP_OPTION_NOP:
1539 /* Sanity check the length. */
1541 if ((optlen < MINTCPOPTIONLENGTH) ||
1542 (optlen > MAXTCPOPTIONBYTES) ||
1557 static inline u32 crc_calc (ipv4_header *ipv4)
1559 u16 *ipv4_word_ptr = (u16 *) ipv4;
1562 * Add all fields except the checksum field
1564 crc32 = (u32)clib_net_to_host_u16(*ipv4_word_ptr) +
1565 (u32)clib_net_to_host_u16(*(ipv4_word_ptr + 1)) +
1566 (u32)clib_net_to_host_u16(*(ipv4_word_ptr + 2)) +
1567 (u32)clib_net_to_host_u16(*(ipv4_word_ptr + 3)) +
1568 (u32)clib_net_to_host_u16(*(ipv4_word_ptr + 4)) +
1569 (u32)clib_net_to_host_u16(*(ipv4_word_ptr + 6)) +
1570 (u32)clib_net_to_host_u16(*(ipv4_word_ptr + 7)) +
1571 (u32)clib_net_to_host_u16(*(ipv4_word_ptr + 8)) +
1572 (u32)clib_net_to_host_u16(*(ipv4_word_ptr + 9));
1574 /* Add in the carry of the original sum */
1575 crc32 = (crc32 & 0xFFFF) + (crc32 >> 16);
1576 /* Add in the carry of the final sum */
1577 crc32 = (crc32 & 0xFFFF) + (crc32 >> 16);
1582 #endif /* __TCP_HEADER_DEFINITIONS_H__ */