From patchwork Tue Jan 2 20:59:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 184444 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4679153dyb; Tue, 2 Jan 2024 12:59:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRO6RI1ERl0fkiRJ8KEEhf+0nxViQB5xMpyOV1m6DW4/kJ6UlQHdvCdETE3SXooicaCqiN X-Received: by 2002:a17:906:108d:b0:a26:ce7b:e7db with SMTP id u13-20020a170906108d00b00a26ce7be7dbmr7519712eju.70.1704229181809; Tue, 02 Jan 2024 12:59:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229181; cv=none; d=google.com; s=arc-20160816; b=JdVhvBGGUbBn8+C34dbgnm6TecdnGA/Dh/dOda8UI+IMmPoEfBzTT34+Sj1S2VnWxY i0DYXZhWC0JGvUGji43an3nLSn2cH07yBuDdFoTPgSVCoKGhxfKzwuCZ/t1PvqHMy3Mn fjUQG0MVHS6m9L5tKX7GKnrXP+HGR51I6nLRxplTFSwJOJ9LJnOacVaHzSVya0hZuptg c2S4sGUpwp8XD6lQwPVf/B50xHlRqtrpO2p65QCj4q4Axr0A3Mr2k/fxDO7HgPtfwzZm FWDuOxDQ/qWLIz34XyRhwa/0epRCKcpz6nUT3fnnsJclEVVjbaVioBGw+coU3PUv0wjj 1rnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=6OrdrWvBDxOQfJ4vcbx726UKsh13Gg6rlqSW8b/m6AQ=; fh=mKmlFNKomSAlUc5fdU2x/hjUGnxAdNf0Nso+CSutyMw=; b=vEnUu9IbdwAm6nRu/tLIiG/P77rBcVY9Xf9uiWTSsPImaxpQhlBwqDbBeGNTJSNMp9 ig2Q4m8UGcUTZWLY8DuUjns2a6b6YH3sjGnxkCfTT0H1b1DAt7sfhrUH6GDCIG5FtaJN Jl6YVU/nVY2Q4mIuitzORMUpIasTyVZCZfuzCRo4HcSo6BdiF9e4JWHcMfZuWe1AyxeA mB1wO+8y8XOCrHZKhMHdgNTbEAWpZja5L1IZLh/nZ+/Bx5+XY1cFFABd1yK76G8QmMuf IW8y6p96JHR7wZwGMmN6KrjpvqxNZLyv/6Q76/CyhWWLNYlblSP5o95/bNSPLNNwtF2B ljLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3l33vppm; spf=pass (google.com: domain of linux-kernel+bounces-14816-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14816-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gi34-20020a1709070ca200b00a26b02a74b4si10140929ejc.44.2024.01.02.12.59.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 12:59:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14816-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3l33vppm; spf=pass (google.com: domain of linux-kernel+bounces-14816-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14816-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6B76C1F235B8 for ; Tue, 2 Jan 2024 20:59:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BD23168CE; Tue, 2 Jan 2024 20:59:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3l33vppm" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8456168B1 for ; Tue, 2 Jan 2024 20:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--almasrymina.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-5e898eb4432so131710947b3.0 for ; Tue, 02 Jan 2024 12:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704229149; x=1704833949; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=6OrdrWvBDxOQfJ4vcbx726UKsh13Gg6rlqSW8b/m6AQ=; b=3l33vppma/IgX8GqZ/OsBLNrTC+DQFRaN8jbjBtjZFbVKVfGtg+mZUxwgVjiSHhedx JEwM1UbU8arnhvayONYV+yWeB5FSVbH0mN28LW7y7tH5blJ7WnhqRSfgqyZeqe3VI9WO QngELDGoSrrvJGNJFYKmMam1ONjONDCWi6qe4Oh8ZZWjZVEEiy084wqA0zyyCeZxlccP LqjxccfJY6/xw1mr0evvSYTmNiV/qoBJxbST7bWPtUholNL5UrLoIAfY+U0Zvomht6Vm g+LsMJp0jeJy/c2K5G/nfAu4cDDJjaOL2PXpxx9C5IxvuCOlb3JPssl8GdrHo16RIz3/ xH4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229149; x=1704833949; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6OrdrWvBDxOQfJ4vcbx726UKsh13Gg6rlqSW8b/m6AQ=; b=Um7VO8irPC5v097I0k969hc4k8d0c5h7rxUpGMREg7NnvwHLk8oqUe7MKGB3YeegFq rX+9eRWNNzed8fGKynzwfuGgebGXhCWkN/EDETLQp2pb9HALnZ357CmLYmfKPZr4dWJf FzNbmFA4emW8dwDVl0GTt6WVFPNj37oLjhpBGB3iGzgQHE5COCZ4xL/nZWVubL7pHMIt feXnXbPz4UkdUImytj0ZGhz9AwnVnMOYu8f6CWa2cJY18ob2dWbOOP8KIeHQdxR+SBsC K7oBpI9rCWZ80/YO2MjJgqJboxVSGpRNqDTLUiGZdQ0Cft+lCf4eLrqrtmQFps94tqUY NyGg== X-Gm-Message-State: AOJu0YwSHFMnGbUCPAD2finqz6KKkGU03WZWfcrgLlpRLeeBC1DkjuFg hiNtGqp6Zuwoib075VPOPCLtbcJ+M9bxtoYUZ1rQ6drE X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2c4:200:9a04:c262:c978:d762]) (user=almasrymina job=sendgmr) by 2002:a25:b9c1:0:b0:dbd:b7cb:8a6b with SMTP id y1-20020a25b9c1000000b00dbdb7cb8a6bmr513742ybj.1.1704229148829; Tue, 02 Jan 2024 12:59:08 -0800 (PST) Date: Tue, 2 Jan 2024 12:59:04 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Message-ID: <20240102205905.793738-1-almasrymina@google.com> Subject: [PATCH net-next v3] vsock/virtio: use skb_frag_*() helpers From: Mina Almasry To: kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mina Almasry , Stefan Hajnoczi , Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787013818162372592 X-GMAIL-MSGID: 1787013818162372592 Minor fix for virtio: code wanting to access the fields inside an skb frag should use the skb_frag_*() helpers, instead of accessing the fields directly. This allows for extensions where the underlying memory is not a page. Acked-by: Stefano Garzarella Signed-off-by: Mina Almasry --- v3: - Applied Stefano's Acked-by. - Forked this patch from 'Abstract page from net stack'. v2: - Also fix skb_frag_off() + skb_frag_size() (David) - Did not apply the reviewed-by from Stefano since the patch changed relatively much. --- net/vmw_vsock/virtio_transport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index f495b9e5186b..1748268e0694 100644 --- a/net/vmw_vsock/virtio_transport.c +++ b/net/vmw_vsock/virtio_transport.c @@ -153,10 +153,10 @@ virtio_transport_send_pkt_work(struct work_struct *work) * 'virt_to_phys()' later to fill the buffer descriptor. * We don't touch memory at "virtual" address of this page. */ - va = page_to_virt(skb_frag->bv_page); + va = page_to_virt(skb_frag_page(skb_frag)); sg_init_one(sgs[out_sg], - va + skb_frag->bv_offset, - skb_frag->bv_len); + va + skb_frag_off(skb_frag), + skb_frag_size(skb_frag)); out_sg++; } }