8787
8888#define ETHER_IFG 12
8989#define ETHER_PREAMBLE 8
90- #define ETHER_OVR (ETHER_CRC_LEN + ETHER_PREAMBLE + ETHER_IFG)
90+ #define ETHER_OVR (MTCP_ETHER_CRC_LEN + ETHER_PREAMBLE + ETHER_IFG)
9191
9292static const uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT ;
9393static const uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT ;
@@ -98,15 +98,15 @@ static struct rte_mempool *pktmbuf_pool[MAX_CPUS] = {NULL};
9898//#define DEBUG 1
9999#ifdef DEBUG
100100/* ethernet addresses of ports */
101- static struct ether_addr ports_eth_addr [RTE_MAX_ETHPORTS ];
101+ static MTCP_ETHER_ADDR ports_eth_addr [RTE_MAX_ETHPORTS ];
102102#endif
103103
104104static struct rte_eth_dev_info dev_info [RTE_MAX_ETHPORTS ];
105105
106106static struct rte_eth_conf port_conf = {
107107 .rxmode = {
108108 .mq_mode = ETH_MQ_RX_RSS ,
109- .max_rx_pkt_len = ETHER_MAX_LEN ,
109+ .max_rx_pkt_len = MTCP_ETHER_MAX_LEN ,
110110#if RTE_VERSION > RTE_VERSION_NUM (17 , 8 , 0 , 0 )
111111 .offloads = (
112112#if RTE_VERSION < RTE_VERSION_NUM (18 , 5 , 0 , 0 )
@@ -412,7 +412,7 @@ dpdk_get_wptr(struct mtcp_thread_context *ctxt, int ifidx, uint16_t pktsize)
412412 m = dpc -> wmbufs [ifidx ].m_table [len_of_mbuf ];
413413
414414 /* retrieve the right write offset */
415- ptr = (void * )rte_pktmbuf_mtod (m , struct ether_hdr * );
415+ ptr = (void * )rte_pktmbuf_mtod (m , MTCP_ETHER_HDR * );
416416 m -> pkt_len = m -> data_len = pktsize ;
417417 m -> nb_segs = 1 ;
418418 m -> next = NULL ;
@@ -467,16 +467,16 @@ dpdk_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx)
467467struct rte_mbuf *
468468ip_reassemble (struct dpdk_private_context * dpc , struct rte_mbuf * m )
469469{
470- struct ether_hdr * eth_hdr ;
470+ MTCP_ETHER_HDR * eth_hdr ;
471471 struct rte_ip_frag_tbl * tbl ;
472472 struct rte_ip_frag_death_row * dr ;
473473
474474 /* if packet is IPv4 */
475475 if (RTE_ETH_IS_IPV4_HDR (m -> packet_type )) {
476- struct ipv4_hdr * ip_hdr ;
476+ MTCP_IPV4_HDR * ip_hdr ;
477477
478- eth_hdr = rte_pktmbuf_mtod (m , struct ether_hdr * );
479- ip_hdr = (struct ipv4_hdr * )(eth_hdr + 1 );
478+ eth_hdr = rte_pktmbuf_mtod (m , MTCP_ETHER_HDR * );
479+ ip_hdr = (MTCP_IPV4_HDR * )(eth_hdr + 1 );
480480
481481 /* if it is a fragmented packet, then try to reassemble. */
482482 if (rte_ipv4_frag_pkt_is_fragmented (ip_hdr )) {
@@ -826,7 +826,7 @@ dpdk_dev_ioctl(struct mtcp_thread_context *ctx, int nif, int cmd, void *argp)
826826 goto dev_ioctl_err ;
827827 m = dpc -> wmbufs [eidx ].m_table [len_of_mbuf - 1 ];
828828 m -> ol_flags = PKT_TX_IP_CKSUM | PKT_TX_IPV4 ;
829- m -> l2_len = sizeof (struct ether_hdr );
829+ m -> l2_len = sizeof (MTCP_ETHER_HDR );
830830 m -> l3_len = (iph -> ihl <<2 );
831831 break ;
832832 case PKT_TX_TCP_CSUM :
@@ -835,19 +835,19 @@ dpdk_dev_ioctl(struct mtcp_thread_context *ctx, int nif, int cmd, void *argp)
835835 m = dpc -> wmbufs [eidx ].m_table [len_of_mbuf - 1 ];
836836 tcph = (struct tcphdr * )((unsigned char * )iph + (iph -> ihl <<2 ));
837837 m -> ol_flags |= PKT_TX_TCP_CKSUM ;
838- tcph -> check = rte_ipv4_phdr_cksum ((struct ipv4_hdr * )iph , m -> ol_flags );
838+ tcph -> check = rte_ipv4_phdr_cksum ((MTCP_IPV4_HDR * )iph , m -> ol_flags );
839839 break ;
840840#ifdef ENABLELRO
841841 case PKT_RX_TCP_LROSEG :
842842 m = dpc -> cur_rx_m ;
843843 //if (m->next != NULL)
844844 // rte_prefetch0(rte_pktmbuf_mtod(m->next, void *));
845- iph = rte_pktmbuf_mtod_offset (m , struct iphdr * , sizeof (struct ether_hdr ));
845+ iph = rte_pktmbuf_mtod_offset (m , struct iphdr * , sizeof (MTCP_ETHER_HDR ));
846846 tcph = (struct tcphdr * )((u_char * )iph + (iph -> ihl << 2 ));
847847 payload = (uint8_t * )tcph + (tcph -> doff << 2 );
848848
849849 seg_off = m -> data_len -
850- sizeof (struct ether_hdr ) - (iph -> ihl << 2 ) -
850+ sizeof (MTCP_ETHER_HDR ) - (iph -> ihl << 2 ) -
851851 (tcph -> doff << 2 );
852852
853853 to = (uint8_t * ) argp ;
@@ -870,13 +870,13 @@ dpdk_dev_ioctl(struct mtcp_thread_context *ctx, int nif, int cmd, void *argp)
870870 if ((dev_info [nif ].tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM ) == 0 )
871871 goto dev_ioctl_err ;
872872 m = dpc -> wmbufs [eidx ].m_table [len_of_mbuf - 1 ];
873- iph = rte_pktmbuf_mtod_offset (m , struct iphdr * , sizeof (struct ether_hdr ));
873+ iph = rte_pktmbuf_mtod_offset (m , struct iphdr * , sizeof (MTCP_ETHER_HDR ));
874874 tcph = (struct tcphdr * )((uint8_t * )iph + (iph -> ihl <<2 ));
875- m -> l2_len = sizeof (struct ether_hdr );
875+ m -> l2_len = sizeof (MTCP_ETHER_HDR );
876876 m -> l3_len = (iph -> ihl <<2 );
877877 m -> l4_len = (tcph -> doff <<2 );
878878 m -> ol_flags = PKT_TX_TCP_CKSUM | PKT_TX_IP_CKSUM | PKT_TX_IPV4 ;
879- tcph -> check = rte_ipv4_phdr_cksum ((struct ipv4_hdr * )iph , m -> ol_flags );
879+ tcph -> check = rte_ipv4_phdr_cksum ((MTCP_IPV4_HDR * )iph , m -> ol_flags );
880880 break ;
881881 case PKT_RX_IP_CSUM :
882882 if ((dev_info [nif ].rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM ) == 0 )
0 commit comments