On 1/27/17 1:34 PM, John Fastabend wrote:
+ h2 = page_address(rx_buffer->page) + rx_buffer->page_offset - hdrlen; + eth = page_address(rx_buffer->page) + rx_buffer->page_offset,
I don't think it compiles ;)
+ /* This indicates a bug in ixgbe leaving for testing purposes */ + WARN_ON(TP_STATUS_USER & h2->tp_status); + len = le16_to_cpu(rx_desc->wb.upper.length); + h2->tp_len = len; + h2->tp_snaplen = len; + h2->tp_mac = ALIGN(TPACKET_ALIGN(TPACKET2_HDRLEN), L1_CACHE_BYTES); + h2->tp_net = h2->tp_mac + ETH_HLEN; + h2->tp_sec = div_s64_rem(ns, NSEC_PER_SEC, &rem); + h2->tp_nsec = rem; + + sll = (void *)h2 + TPACKET_ALIGN(sizeof(struct tpacket2_hdr)); + sll->sll_halen = ETH_HLEN; + memcpy(sll->sll_addr, eth->h_source, ETH_ALEN); + sll->sll_family = AF_PACKET; + sll->sll_hatype = rx_ring->netdev->type; + sll->sll_protocol = eth->h_proto; + sll->sll_pkttype = PACKET_HOST; + sll->sll_ifindex = rx_ring->netdev->ifindex;
performance wise it looks very expensive to do all these header copies and integer divide for every packet. I think unless we move to new dumb and simple header format performance of this approach is not going to be satisfactory.