ena: Add XDP frame size to amazon NIC driver
authorJesper Dangaard Brouer <brouer@redhat.com>
Thu, 14 May 2020 10:50:13 +0000 (12:50 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 15 May 2020 04:21:55 +0000 (21:21 -0700)
Frame size ENA_PAGE_SIZE is limited to 16K on systems with larger
PAGE_SIZE than 16K. Change ENA_XDP_MAX_MTU to also take into account
the reserved tailroom.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Sameeh Jubran <sameehj@amazon.com>
Cc: Arthur Kiyanovski <akiyano@amazon.com>
Link: https://lore.kernel.org/bpf/158945341384.97035.907403694833419456.stgit@firesoul
drivers/net/ethernet/amazon/ena/ena_netdev.c
drivers/net/ethernet/amazon/ena/ena_netdev.h

index 2818965427e9f972d2c5aa0761f7b63a6d96b012..85b87ed02dd56fd2e0c05b375f2c4b8457779e7b 100644 (file)
@@ -1606,6 +1606,7 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
                  "%s qid %d\n", __func__, rx_ring->qid);
        res_budget = budget;
        xdp.rxq = &rx_ring->xdp_rxq;
                  "%s qid %d\n", __func__, rx_ring->qid);
        res_budget = budget;
        xdp.rxq = &rx_ring->xdp_rxq;
+       xdp.frame_sz = ENA_PAGE_SIZE;
 
        do {
                xdp_verdict = XDP_PASS;
 
        do {
                xdp_verdict = XDP_PASS;
index 7df67bf09b9387c732b0700b12d23970b6a9810f..680099afcccf97e20a62aef7e62fca83d1266646 100644 (file)
  * The buffer size we share with the device is defined to be ENA_PAGE_SIZE
  */
 
  * The buffer size we share with the device is defined to be ENA_PAGE_SIZE
  */
 
-#define ENA_XDP_MAX_MTU (ENA_PAGE_SIZE - ETH_HLEN - ETH_FCS_LEN - \
-                               VLAN_HLEN - XDP_PACKET_HEADROOM)
+#define ENA_XDP_MAX_MTU (ENA_PAGE_SIZE - ETH_HLEN - ETH_FCS_LEN -      \
+                        VLAN_HLEN - XDP_PACKET_HEADROOM -              \
+                        SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
 
 #define ENA_IS_XDP_INDEX(adapter, index) (((index) >= (adapter)->xdp_first_ring) && \
        ((index) < (adapter)->xdp_first_ring + (adapter)->xdp_num_queues))
 
 #define ENA_IS_XDP_INDEX(adapter, index) (((index) >= (adapter)->xdp_first_ring) && \
        ((index) < (adapter)->xdp_first_ring + (adapter)->xdp_num_queues))