Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62F1DC678D4 for ; Mon, 6 Mar 2023 15:52:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbjCFPwV (ORCPT ); Mon, 6 Mar 2023 10:52:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbjCFPwT (ORCPT ); Mon, 6 Mar 2023 10:52:19 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4671133469 for ; Mon, 6 Mar 2023 07:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678117888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q86XLZ7Q4ZHp1CUGcCN/NjLhC2ggJRWLx1s//bOcLDM=; b=IDGY3v4CGTQZ5idFWVW87EHcy0lVva+Ckm1QP33JE4zD1o0xlMWDuXOwOCDMlbt0PLkbsw cuVE2g+sX2EJtbLsfVEBTjN60pf/ea00y0B1DV8muqwcvqkb291HZ7z4hWMKGOsuizk4Rt 32ElIB+cwlfCStYB3uVtvK3uVAFrA3w= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-329-WRxup-aaMqKbaiL72PuJ1Q-1; Mon, 06 Mar 2023 10:51:27 -0500 X-MC-Unique: WRxup-aaMqKbaiL72PuJ1Q-1 Received: by mail-qt1-f200.google.com with SMTP id b7-20020ac85407000000b003bfb9cff263so5332717qtq.6 for ; Mon, 06 Mar 2023 07:51:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678117886; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Q86XLZ7Q4ZHp1CUGcCN/NjLhC2ggJRWLx1s//bOcLDM=; b=sCMcy8oEhlNO6TtiIxUGAUfOSOOJqLO3y/mHltyoZRlL8PqsaaEkVJztD+JBi/k88S XKc3GWf5gCuNqMSwlDjcJYpJOnK3taa1AUIBPm+VgkP3cwkVX8SZYQfbhL5KDB/CLT6w Fs8lppOq7gtD61/4yKGLbwvrY5mpVbaN/40r7gg4XJMdn52ySepqbr3O70+Z91DOCYcO 4scSeqY7KF0IRkHk7UR1kH3KVyYncRPA4OcHYHpz57MEQtQtWsbNdpp/XOeXueKpqoSK FX2w+zESA2zq4VyXpIxLW4RVoU0JIuVnlmjukvMRtMvomrHdiEgVd3WQC32IzZYiotZJ N3DA== X-Gm-Message-State: AO0yUKU273idak+t5o2A1V6fuwTDvgYzggwBgHVyfSH5MMWzhJtoSm78 /8VJ1swt4zrxM73NWV/mZK3RxN/NxxNdofigPBLFqRIcAInKthEz2vSoYQLQrLl1OkDzg19sNhY ct2VVdD6GGdTBc7tp9ZK9F6np X-Received: by 2002:a05:622a:c:b0:3b9:bc8c:c207 with SMTP id x12-20020a05622a000c00b003b9bc8cc207mr26969670qtw.18.1678117886719; Mon, 06 Mar 2023 07:51:26 -0800 (PST) X-Google-Smtp-Source: AK7set8J+A3R80v+MVqfE2WCygPas52Ry5LmPSFlnPMQvzMyOQV6nh5+6ZCsftO+pkisfBFlvJJ58Q== X-Received: by 2002:a05:622a:c:b0:3b9:bc8c:c207 with SMTP id x12-20020a05622a000c00b003b9bc8cc207mr26969642qtw.18.1678117886394; Mon, 06 Mar 2023 07:51:26 -0800 (PST) Received: from sgarzare-redhat (host-82-57-51-170.retail.telecomitalia.it. [82.57.51.170]) by smtp.gmail.com with ESMTPSA id q17-20020ac84111000000b003bfa52112f9sm7805681qtl.4.2023.03.06.07.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Mar 2023 07:51:25 -0800 (PST) Date: Mon, 6 Mar 2023 16:51:21 +0100 From: Stefano Garzarella To: Arseniy Krasnov Cc: Stefan Hajnoczi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bobby Eshleman , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@sberdevices.ru, oxffffaa@gmail.com Subject: Re: [RFC PATCH v2 2/4] virtio/vsock: remove all data from sk_buff Message-ID: <20230306155121.7xwxzgxtle7qjbnc@sgarzare-redhat> References: <20230306120857.6flftb3fftmsceyl@sgarzare-redhat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 06, 2023 at 06:31:22PM +0300, Arseniy Krasnov wrote: > > >On 06.03.2023 15:08, Stefano Garzarella wrote: >> On Sun, Mar 05, 2023 at 11:07:37PM +0300, Arseniy Krasnov wrote: >>> In case of SOCK_SEQPACKET all sk_buffs are used once - after read some >>> data from it, it will be removed, so user will never read rest of the >>> data. Thus we need to update credit parameters of the socket like whole >>> sk_buff is read - so call 'skb_pull()' for the whole buffer. >>> >>> Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") >>> Signed-off-by: Arseniy Krasnov >>> --- >>> net/vmw_vsock/virtio_transport_common.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> Maybe we could avoid this patch if we directly use pkt_len as I >> suggested in the previous patch. >Hm, may be we can avoid calling 'skb_pull()' here if 'virtio_transport_dec_rx_pkt()' >will use integer argument? Yep, exactly! >Just call 'virtio_transport_dec_rx_pkt(skb->len)'. skb It depends on how we call virtio_transport_inc_rx_pkt(). If we use hdr->len there I would use the same to avoid confusion. Plus that's the value the other peer sent us, so definitely the right value to increase fwd_cnt with. But if skb->len always reflects it, then that's fine. >is never returned to queue to read it again, so i think may be there is no sense for >extra call 'skb_pull'? Right! Thanks, Stefano