Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1726689pxb; Sat, 30 Oct 2021 22:08:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnXsaM26MDLFZvb/osUjVpbiNOAMrCJ1ENvZx9kza5NJRf+SBiL0rPkvMeMee3qoMKynZh X-Received: by 2002:a05:6602:2e8c:: with SMTP id m12mr14931725iow.91.1635656936963; Sat, 30 Oct 2021 22:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635656936; cv=none; d=google.com; s=arc-20160816; b=ebC4AdvO6bCGjQ7o8rgypgLVy2Ih0xNIQcXWKXVLlnp5MZH2f2oWidr/O7jCPbDt6u 0tbfx8b5TANfjm/fhBjh2JZoyPPHZCnxtx3/0tv6qHs+SOzQgxGFpTbXyLvwigG0zzeZ /gz+8DsTWGOn93cU2luffTl7jC1suDVZmA3D3eXGjwIY8mUOOs1bJEvbdhmYo3nFNjFu BLf2QAr4PzQ3+1gNA1PzRNVXQbXRcQ8JcY/GZHaq0M50gni3tfSE3/TPm2jpttOXuz84 hjqoGrLd8PdkvGpi1hsdTxmBVLAdQj0xz9j0lKipiYOLHNNWacDZWn0INYOLKAixFUS7 GD7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ac2A+saDFSrL4WFPXx7obgKV7OBZXWGHHh/Jb1Knu3A=; b=ZtP5/m2vAzv/3982XaLfbboCFBC9+V1ZT490S5Hq1AXPdErMIdggE7o30aZRJweF3N SMFmixy+8wRij+Fw3uRYXzzxZ/hyzC9odaudJb0BtkT5Udzm7KBbAOPt7QiMObrJ9ELF JImFO4fr1GaiBKgaLZn9443R3lgJA3s+kJWy0gbdDT/eHz0A0EW1qQrnPokpb2Nb3kdS 6mDiO3/r8MtO1ALNvZPp0oiW9pI/VD5CwtSeOfuT8oT7/UXnkaFXUyiv5Et+ItK7Y47x CSnelJ1L3CKhg2HwKGtYlGQbhrwKC3VZVkmPOu8HvnW6fgPUiD9F4Cy/hh2cFJaK4cIR VS6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=XgTo86nF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u13si3374929ilv.31.2021.10.30.22.08.42; Sat, 30 Oct 2021 22:08:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=XgTo86nF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230043AbhJaFCr (ORCPT + 99 others); Sun, 31 Oct 2021 01:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbhJaFCm (ORCPT ); Sun, 31 Oct 2021 01:02:42 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C35C061570 for ; Sat, 30 Oct 2021 22:00:10 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id u11so29693038lfs.1 for ; Sat, 30 Oct 2021 22:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ac2A+saDFSrL4WFPXx7obgKV7OBZXWGHHh/Jb1Knu3A=; b=XgTo86nFEDxuYlBHZ8Ex/lUcNqT+IBUDagTX/h05JsJRbDmf/VD0AxXwlctC8yY7z8 chpmci1SemrnUVfl5+TYJ0CSxhwqpS9LlVCL+GvnmyYIwUULAU+7Zad2Dmug2kbr3v4k z9aciBwNy7leyYcEexhVMZ5SwmfQRPV4YIR92ggSy5wOR2b/GPr886GWNQpHreb42WLc 22snkjhagk+eVZ+Q+HnukV/oBhOEHtN1qd50nZWbc+VmTMVcaHMkGc8kpw0kfU/junUL 0fB0ODvHK1NRvN+f+yOJ2R3iUgChJ+H7tx+wAZ8vHtp0oa7haGhsO5wajRozLRr1u0id zDZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ac2A+saDFSrL4WFPXx7obgKV7OBZXWGHHh/Jb1Knu3A=; b=R2/1raJsN/JK00Q10R6FtXfg0pJYMyaKbTM7EurT8DJAx3m8u23of6jFA4La6HLeYo a/Am3LPUs5Gkc+TU0BgVVw/BECW9eL2Ia4M2g7nUnmKTP9fNdfbtf/0Pxvi9jrZSkw9e jIto2tHNQpMtDoYt5jM+0glugXBYDysOKN84nQqR/uzvF1BU9Fgar5bjHJ/y7n3RLqB+ GG+bBLjRFOc458YIbnWzxx29mdYADcy1l9U8qLi4gKB8Rp1EaOwIK2kMIsQkTITTIneV 1OzY28W9EyJF/tSD22EMBw+cnEGP5yqvRgbdCHcq3H5BQ+AMf/wBc3XTuJBS6w2+R+Pu 00Dg== X-Gm-Message-State: AOAM530zwiATLIDxobn/+lg7ImIGMNORDzem4OYDa/taB/6ua98gwLj2 ZBHg7w+y/TCt98OTAhun7LGZqQ== X-Received: by 2002:a05:6512:1102:: with SMTP id l2mr20307442lfg.181.1635656409250; Sat, 30 Oct 2021 22:00:09 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id v26sm444766lfo.125.2021.10.30.22.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Oct 2021 22:00:08 -0700 (PDT) From: Andrew Melnychenko To: mst@redhat.com, jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yuri.benditovich@daynix.com, yan@daynix.com Subject: [RFC PATCH 2/4] drivers/net/virtio_net: Changed mergeable buffer length calculation. Date: Sun, 31 Oct 2021 06:59:57 +0200 Message-Id: <20211031045959.143001-3-andrew@daynix.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211031045959.143001-1-andrew@daynix.com> References: <20211031045959.143001-1-andrew@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now minimal virtual header length is may include the entire v1 header if the hash report were populated. Signed-off-by: Andrew Melnychenko --- drivers/net/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index b72b21ac8ebd..abca2e93355d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -393,7 +393,9 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, hdr_p = p; hdr_len = vi->hdr_len; - if (vi->mergeable_rx_bufs) + if (vi->has_rss_hash_report) + hdr_padded_len = sizeof(struct virtio_net_hdr_v1_hash); + else if (vi->mergeable_rx_bufs) hdr_padded_len = sizeof(*hdr); else hdr_padded_len = sizeof(struct padded_vnet_hdr); @@ -1252,7 +1254,7 @@ static unsigned int get_mergeable_buf_len(struct receive_queue *rq, struct ewma_pkt_len *avg_pkt_len, unsigned int room) { - const size_t hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf); + const size_t hdr_len = ((struct virtnet_info *)(rq->vq->vdev->priv))->hdr_len; unsigned int len; if (room) @@ -2817,7 +2819,7 @@ static void virtnet_del_vqs(struct virtnet_info *vi) */ 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; -- 2.33.1