@@ -97,8 +97,6 @@ static int enable_kni;
9797static int kni_accept ;
9898#endif
9999
100- #define ETH_P_8021Q 0x8100
101-
102100static int numa_on ;
103101
104102static unsigned idle_sleep ;
@@ -902,20 +900,19 @@ ff_veth_input(const struct ff_dpdk_if_context *ctx, struct rte_mbuf *pkt)
902900}
903901
904902static enum FilterReturn
905- protocol_filter (const struct rte_mbuf * mbuf , uint16_t len )
903+ protocol_filter (const void * data , uint16_t len )
906904{
907905 if (len < ETHER_HDR_LEN )
908906 return FILTER_UNKNOWN ;
909907
910908 const struct ether_hdr * hdr ;
911909 const struct vlan_hdr * vlanhdr ;
912- void * data = rte_pktmbuf_mtod (mbuf , void * );
913910 hdr = (const struct ether_hdr * )data ;
914- uint16_t ether_type = ntohs (hdr -> ether_type );
911+ uint16_t ether_type = rte_be_to_cpu_16 (hdr -> ether_type );
915912
916- if (hdr -> ether_type == htons ( ETH_P_8021Q ) && !( mbuf -> ol_flags & PKT_RX_VLAN_STRIPPED ) ) {
913+ if (ether_type == ETHER_TYPE_VLAN ) {
917914 vlanhdr = (struct vlan_hdr * )(data + sizeof (struct ether_hdr ));
918- ether_type = ntohs (vlanhdr -> eth_proto );
915+ ether_type = rte_be_to_cpu_16 (vlanhdr -> eth_proto );
919916 }
920917
921918 if (ether_type == ETHER_TYPE_ARP )
@@ -928,7 +925,7 @@ protocol_filter(const struct rte_mbuf *mbuf, uint16_t len)
928925 return FILTER_UNKNOWN ;
929926 }
930927
931- if (ntohs ( hdr -> ether_type ) != ETHER_TYPE_IPv4 )
928+ if (ether_type != ETHER_TYPE_IPv4 )
932929 return FILTER_UNKNOWN ;
933930
934931 return ff_kni_proto_filter (data + ETHER_HDR_LEN ,
@@ -1043,7 +1040,7 @@ process_packets(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **bufs,
10431040 }
10441041 }
10451042
1046- enum FilterReturn filter = protocol_filter (rtem , len );
1043+ enum FilterReturn filter = protocol_filter (data , len );
10471044 if (filter == FILTER_ARP ) {
10481045 struct rte_mempool * mbuf_pool ;
10491046 struct rte_mbuf * mbuf_clone ;
0 commit comments