Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp788324ybl; Wed, 11 Dec 2019 07:31:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwMnI6EXJe/4/WERy4Er2x0noxdZbXxyc9815WgNgcN75UuoRwC8pOd5B1ALX9s0CzvYlbZ X-Received: by 2002:a05:6830:1e8a:: with SMTP id n10mr2588607otr.228.1576078306403; Wed, 11 Dec 2019 07:31:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576078306; cv=none; d=google.com; s=arc-20160816; b=U8onqSz6qdVR1620UNe4in835khT5ALCUXID2d3DUrEOW4YPpnRQWR8t7daqfNzWVm QrcSjsdi38jxCm8eTSYZsMQuku8ldghHtjiE6R49kOOdx48EWpMgdmL97pGEdn9iYjKF el+n7QUHOyFHxd0HZft/AiH1F5ls6yPwPWrjmy/BmnqzVdEYMp53A3dJOeEfwKFigN1U lWipktDGJM8jix7V0mnzEDZnmhwOOsQ0CBlQRLfwrS6vwytky2xBvYardqSx9cuzTYf0 mzipsx+txPhV1ilH3mLPRA7AFTVX7sCs+lBKgTGMmb4FKGSAoGMlPgqnzX9I+gocNe5x T2lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:dkim-signature; bh=SKfQoX2A8rZ0EnP2XkyIWyJjMF/So/eVFwUYzJEpgTw=; b=Fs3q7zGfF5jph5CDoM8LhIeBwqK0TtM6GG+D6FCzeS/gCdIrZMQbefx5DqnwegJ57d C1+pFrUEkRSHGPb9OablbcQz4d92FQUrTZFe6PhUBD2WZCLytYk7uPCggbrrdBVxVQr6 8h9fyFjR+PmeGxwbu7z+qxU1mBUOquReDWLprJJlBeKHl0cLAIYyRx4MphrycdHsZsRi ms54ty54FuuiUjvAUH3hxC501oWV6DclWe/QEvFu6LmFbyGkjCWEgIcbZn6ZTyXb6jCg UcpXDOWYlRKFv33M5AU4tk9o+ScIy+Lx81YE/XRgkpXbjPDqcF3FXG8F5nzWf7C5Q8Cj ldhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=trIiLL+j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q65si1332953oic.78.2019.12.11.07.31.32; Wed, 11 Dec 2019 07:31:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=trIiLL+j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387996AbfLKPay (ORCPT + 99 others); Wed, 11 Dec 2019 10:30:54 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:10288 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387680AbfLKPaw (ORCPT ); Wed, 11 Dec 2019 10:30:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1576078251; x=1607614251; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SKfQoX2A8rZ0EnP2XkyIWyJjMF/So/eVFwUYzJEpgTw=; b=trIiLL+jeKQk4aIryp5tyAmL9BBvgLbLwpkQEUcbXbYVIX8jXMhRc7WU /kPttwswhWMzcjH70fTRxWCqqY7AaO1iMlLRMzR6KliXstR+se+VlQJ8Q c/qDWjbxAQDutpUJss0YkxROM6pc3ZSuiIjIlMWs6FzNghY/BNpKJELqP k=; IronPort-SDR: ynn3GjgWJ7AJmj+IiCD63/an9xfGjEvulKIW2ESukaoYU3xV38CEmegp9TBobp4VnugtQwnRoH dToGlfSk+tuQ== X-IronPort-AV: E=Sophos;i="5.69,301,1571702400"; d="scan'208";a="14303724" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 11 Dec 2019 15:30:40 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com (Postfix) with ESMTPS id 0FDA8A2146; Wed, 11 Dec 2019 15:30:39 +0000 (UTC) Received: from EX13D32EUB004.ant.amazon.com (10.43.166.212) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 11 Dec 2019 15:30:10 +0000 Received: from EX13MTAUWC001.ant.amazon.com (10.43.162.135) by EX13D32EUB004.ant.amazon.com (10.43.166.212) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 11 Dec 2019 15:30:10 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.162.232) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 11 Dec 2019 15:30:07 +0000 From: Paul Durrant To: , , CC: Paul Durrant , Boris Ostrovsky , Juergen Gross , "Stefano Stabellini" Subject: [PATCH v3 3/4] xen/interface: re-define FRONT/BACK_RING_ATTACH() Date: Wed, 11 Dec 2019 15:29:55 +0000 Message-ID: <20191211152956.5168-4-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191211152956.5168-1-pdurrant@amazon.com> References: <20191211152956.5168-1-pdurrant@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently these macros are defined to re-initialize a front/back ring (respectively) to values read from the shared ring in such a way that any requests/responses that are added to the shared ring whilst the front/back is detached will be skipped over. This, in general, is not a desirable semantic since most frontend implementations will eventually block waiting for a response which would either never appear or never be processed. Since the macros are currently unused, take this opportunity to re-define them to re-initialize a front/back ring using specified values. This also allows FRONT/BACK_RING_INIT() to be re-defined in terms of FRONT/BACK_RING_ATTACH() using a specified value of 0. NOTE: BACK_RING_ATTACH() will be used directly in a subsequent patch. Signed-off-by: Paul Durrant --- Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini A patch to add the FRONT/BACK_RING_ATTACH() macros to the canonical ring.h in xen.git will be sent once the definitions have been agreed. v2: - change definitions to take explicit initial index values --- include/xen/interface/io/ring.h | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h index 3f40501fc60b..2af7a1cd6658 100644 --- a/include/xen/interface/io/ring.h +++ b/include/xen/interface/io/ring.h @@ -125,35 +125,24 @@ struct __name##_back_ring { \ memset((_s)->pad, 0, sizeof((_s)->pad)); \ } while(0) -#define FRONT_RING_INIT(_r, _s, __size) do { \ - (_r)->req_prod_pvt = 0; \ - (_r)->rsp_cons = 0; \ +#define FRONT_RING_ATTACH(_r, _s, _i, __size) do { \ + (_r)->req_prod_pvt = (_i); \ + (_r)->rsp_cons = (_i); \ (_r)->nr_ents = __RING_SIZE(_s, __size); \ (_r)->sring = (_s); \ } while (0) -#define BACK_RING_INIT(_r, _s, __size) do { \ - (_r)->rsp_prod_pvt = 0; \ - (_r)->req_cons = 0; \ - (_r)->nr_ents = __RING_SIZE(_s, __size); \ - (_r)->sring = (_s); \ -} while (0) +#define FRONT_RING_INIT(_r, _s, __size) FRONT_RING_ATTACH(_r, _s, 0, __size) -/* Initialize to existing shared indexes -- for recovery */ -#define FRONT_RING_ATTACH(_r, _s, __size) do { \ - (_r)->sring = (_s); \ - (_r)->req_prod_pvt = (_s)->req_prod; \ - (_r)->rsp_cons = (_s)->rsp_prod; \ +#define BACK_RING_ATTACH(_r, _s, _i, __size) do { \ + (_r)->rsp_prod_pvt = (_i); \ + (_r)->req_cons = (_i); \ (_r)->nr_ents = __RING_SIZE(_s, __size); \ -} while (0) - -#define BACK_RING_ATTACH(_r, _s, __size) do { \ (_r)->sring = (_s); \ - (_r)->rsp_prod_pvt = (_s)->rsp_prod; \ - (_r)->req_cons = (_s)->req_prod; \ - (_r)->nr_ents = __RING_SIZE(_s, __size); \ } while (0) +#define BACK_RING_INIT(_r, _s, __size) BACK_RING_ATTACH(_r, _s, 0, __size) + /* How big is this ring? */ #define RING_SIZE(_r) \ ((_r)->nr_ents) -- 2.20.1