Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5968544rwl; Tue, 4 Apr 2023 06:16:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YvaYwvylvLR+dtXgdQvDfWh1xSUetLRtS4k+4Nq1l0gdwN2BXhZTxPo/q7sS1k8m1NRXxY X-Received: by 2002:a17:90b:1d0b:b0:23f:1c6d:2b60 with SMTP id on11-20020a17090b1d0b00b0023f1c6d2b60mr2615353pjb.5.1680614213994; Tue, 04 Apr 2023 06:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680614213; cv=none; d=google.com; s=arc-20160816; b=YSpbqlZT1Qo4odvNs2fiUBIF9oNK/Qswe7m4wbqKDDJzbdu2rLkOJE4DwK0Wi5Zy9D 41s4GtvzPaCrndWqw85PC25jfkNxHxuslETjxJLCf1UsCSbEBgGanbl33VRBdZvwxOqc F2PvdSwsHXrkZUZsQGwV+HklhmMLAzA+IbZ6LMVsVXslzt7/I9L8XNiY2rwd6R5+TyjW S2Uf/yGif1X7NW+nMBeLkeEiBV0y4+iS3FG0mbpOLo3GohjxZgJN2JlGtXiTyhGxza7o TY5ExQIuSqPqve2jubIbQNOGTXRKrbd7En0JDDv/SEz+u5V7TilLCfmDqdCaIu1K7Gxv No1g== 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=reoAM7f+Ql0t7teTIED97nCtpsbVHLsQxA9mgF0KDac=; b=DZUyWsUDn2d4cIVZrYpodPIazn8QdyXgXGwDHUefQXWHBEOp9ovBReowntMQLhkm+J rzGcAkEom2l+5IR3VIW+7fKQwJDQQU5GWNjtnr9BE7qVIKUAhdFPz+oRWtkBUsjCM7rV O9eqrl07f3V7FoYoOUh2LrHMKqSSsgCix27Xi28xTCVx95kZc7eNKw1lnJzqRISD1zvM vBLVpQUN7Y7ktNbOgNEN+bxWy9hV3aKnTw5ptWuP02DD0UnWNJ7QWesGn9zDGGSi1zIP lVh4X1bY5d63sfeNMV3bIDLiiSMTixKyahe4vrPkV01BtM9FHz3ka+hv5zWq1XrUHTYe rJeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RZ+xu3yS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kp11-20020a170903280b00b0019edb3d138esi9646494plb.327.2023.04.04.06.16.31; Tue, 04 Apr 2023 06:16:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RZ+xu3yS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235136AbjDDNPi (ORCPT + 99 others); Tue, 4 Apr 2023 09:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234980AbjDDNPZ (ORCPT ); Tue, 4 Apr 2023 09:15:25 -0400 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 856703AA0 for ; Tue, 4 Apr 2023 06:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680614070; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=reoAM7f+Ql0t7teTIED97nCtpsbVHLsQxA9mgF0KDac=; b=RZ+xu3ySe6yIUCcb+tRjwkhAkK0DwZF+Cvtv8yES6uO4YujV74fSaSkv+ZYNe5jfA5CNU2 qwMksXsqKtJSlgmTde7qJl7tNSGW7AbP7apRJtuDEtXbjgGL6ALKNx2r/O037MtgPUO/H8 S/IMqyEDCEsxZEBufZzwZZQtp6Ecj8s= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-73-q8ubHJ6SP22zvvLwOQb5EA-1; Tue, 04 Apr 2023 09:14:28 -0400 X-MC-Unique: q8ubHJ6SP22zvvLwOQb5EA-1 Received: by mail-qv1-f69.google.com with SMTP id m3-20020a0cbf03000000b005de7233ca79so12324050qvi.3 for ; Tue, 04 Apr 2023 06:14:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680614065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=reoAM7f+Ql0t7teTIED97nCtpsbVHLsQxA9mgF0KDac=; b=ghZHL4AfMAtkhHUuYJ6DgYsIU80vglBnje91ijhg4de/ApQQNnTMz/EdJJW2a9gaKt S8nAqFIgbQ+Xg3caCj/VmmtoWKF8vxeKRbvWPqjhr84SH0XetskFwQqhsn+4SbVgST9t 2JfYF+cFHkHxXLD02erC46TGnDIQ/xDh3IeQmY6GtDnFedg9gSzkRfeqRMs2qYyn/3/j RV04pbdw2XHcm+uco2Q+RJGXpCmfXDVDEFenpzLHWaSfKxlQYNALtUMlSnyRcH34q+Ym 3E2r5+TLomYO8HFeUt9jN3XwOmIZbueGQDuolzfddn1bBzeSrv6i1RVZ16WJLmDHvMrR 8tOQ== X-Gm-Message-State: AAQBX9fhDfprDpeR5ux7WbfNBT+4huGOSXCMTKG9sIDOt0L9sSPQaaZj gt1i7Oy36NL20oT94vGhS7t0J49efa9QLVZySBVZpbWK+DTrKR6lIy+uiKpYVnUy6PEBgvlHcJ2 YDr5Ne1x2X+dY9wppIeWmqrIL X-Received: by 2002:a05:6214:5285:b0:5ab:e259:b2a9 with SMTP id kj5-20020a056214528500b005abe259b2a9mr4079696qvb.14.1680614065482; Tue, 04 Apr 2023 06:14:25 -0700 (PDT) X-Received: by 2002:a05:6214:5285:b0:5ab:e259:b2a9 with SMTP id kj5-20020a056214528500b005abe259b2a9mr4079658qvb.14.1680614065167; Tue, 04 Apr 2023 06:14:25 -0700 (PDT) Received: from step1.redhat.com (host-82-53-134-157.retail.telecomitalia.it. [82.53.134.157]) by smtp.gmail.com with ESMTPSA id f24-20020ac84658000000b003b9a73cd120sm3228153qto.17.2023.04.04.06.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 06:14:24 -0700 (PDT) From: Stefano Garzarella To: virtualization@lists.linux-foundation.org Cc: eperezma@redhat.com, stefanha@redhat.com, Jason Wang , Andrey Zhadchenko , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "Michael S. Tsirkin" , Stefano Garzarella Subject: [PATCH v5 4/9] vringh: define the stride used for translation Date: Tue, 4 Apr 2023 15:13:21 +0200 Message-Id: <20230404131326.44403-5-sgarzare@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230404131326.44403-1-sgarzare@redhat.com> References: <20230404131326.44403-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Define a macro to be reused in the different parts of the code. Useful for the next patches where we add more arrays to manage also translations with user VA. Suggested-by: Eugenio Perez Martin Signed-off-by: Stefano Garzarella --- Notes: v4: - added this patch with the changes extracted from the next patch [Eugenio] - used _STRIDE instead of _SIZE [Eugenio] drivers/vhost/vringh.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 0ba3ef809e48..4aee230f7622 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -1141,13 +1141,15 @@ static int iotlb_translate(const struct vringh *vrh, return ret; } +#define IOTLB_IOV_STRIDE 16 + static inline int copy_from_iotlb(const struct vringh *vrh, void *dst, void *src, size_t len) { u64 total_translated = 0; while (total_translated < len) { - struct bio_vec iov[16]; + struct bio_vec iov[IOTLB_IOV_STRIDE]; struct iov_iter iter; u64 translated; int ret; @@ -1180,7 +1182,7 @@ static inline int copy_to_iotlb(const struct vringh *vrh, void *dst, u64 total_translated = 0; while (total_translated < len) { - struct bio_vec iov[16]; + struct bio_vec iov[IOTLB_IOV_STRIDE]; struct iov_iter iter; u64 translated; int ret; -- 2.39.2