};
 
 struct padded_vnet_hdr {
-       struct virtio_net_hdr_mrg_rxbuf hdr;
+       struct virtio_net_hdr_v1_hash hdr;
        /*
         * hdr is in a separate sg buffer, and data sg buffer shares same page
         * with this header sg. This padding makes next sg 16 byte aligned
         * after the header.
         */
-       char padding[4];
+       char padding[12];
 };
 
 static bool is_xdp_frame(void *ptr)
 
        hdr_len = vi->hdr_len;
        if (vi->mergeable_rx_bufs)
-               hdr_padded_len = sizeof(*hdr);
+               hdr_padded_len = hdr_len;
        else
                hdr_padded_len = sizeof(struct padded_vnet_hdr);
 
                                          struct ewma_pkt_len *avg_pkt_len,
                                          unsigned int room)
 {
-       const size_t hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
+       struct virtnet_info *vi = rq->vq->vdev->priv;
+       const size_t hdr_len = vi->hdr_len;
        unsigned int len;
 
        if (room)
  */
 static unsigned int mergeable_min_buf_len(struct virtnet_info *vi, struct virtqueue *vq)
 {
-       const unsigned int hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
+       const unsigned int hdr_len = vi->hdr_len;
        unsigned int rq_size = virtqueue_get_vring_size(vq);
        unsigned int packet_len = vi->big_packets ? IP_MAX_MTU : vi->dev->max_mtu;
        unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len;