From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39BE919309E for ; Mon, 24 Mar 2025 05:43:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742795037; cv=none; b=ldkKPTFPErVZ9YQCOH5Vn0pqDoBNifR+sWTADfNtC8hWhHXNlV+daT/iUXnV8cVH3hpTeP149nLiqpO0xkaHy9FpcQiDeXqRJKaRhdk+XfISULKufUlblicclXDtVyT1vLHO+r58qemVqAwkdU+7ZRGYk4Tc0zl+iTo9VdFhgDE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742795037; c=relaxed/simple; bh=1BXoA2a+SEipHjhSt59BuqgxplVubVP5JaQ5mSAS1ic=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=NhfehoopTz6ZLqTca6nvlDP4avcQcrPPOm6PfwVd0bG6uZrWWEBByttydnDX5cYv7Gzk2Foz03RmVH2cn68aMvQhC+zQdv1p1voMivDgsnxYQ/YWiNHtYspmm1qG4HEU2Z+QFYlvOXO6mrpCtmM2khb5VYZVjOs6dRB86A3yU/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hLbwm2PI; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hLbwm2PI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742795035; 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=/W+xODGsMRhd4sXJfAZRWqFbSITXJwApJiubTedG1B0=; b=hLbwm2PIdG7SoXTVnsXwILY2Xo4zAMJh0aK422Wq64pBjDH7xeZeVMOcqN8WtWqnxYvpXi PYer1+FkL0jiMic928xvp5BcG0HtTuCjFEn8eu7JM+klNCMWLC62Gl7+a2Vpo/9z0r7L8q LAIoK8hpNzfQ+raYiFZt2eoCB/M6vAo= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-549-eYcv5BpgO32DVSjT3OP_ag-1; Mon, 24 Mar 2025 01:43:51 -0400 X-MC-Unique: eYcv5BpgO32DVSjT3OP_ag-1 X-Mimecast-MFC-AGG-ID: eYcv5BpgO32DVSjT3OP_ag_1742795030 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 614ED19373D7; Mon, 24 Mar 2025 05:43:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.200]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8E8FC180B486; Mon, 24 Mar 2025 05:43:46 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com Cc: xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 02/19] virtio_ring: switch to use vring_virtqueue in virtqueue_poll variants Date: Mon, 24 Mar 2025 13:43:16 +0800 Message-ID: <20250324054333.1954-3-jasowang@redhat.com> In-Reply-To: <20250324054333.1954-1-jasowang@redhat.com> References: <20250324054333.1954-1-jasowang@redhat.com> Precedence: bulk X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Those variants are used internally so let's switch to use vring_virtqueue as parameter to be consistent with other internal virtqueue helpers. Signed-off-by: Jason Wang --- drivers/virtio/virtio_ring.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1bdfd5d617a7..1c6b63812bf8 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -915,11 +915,10 @@ static unsigned int virtqueue_enable_cb_prepare_split(struct virtqueue *_vq) return last_used_idx; } -static bool virtqueue_poll_split(struct virtqueue *_vq, unsigned int last_used_idx) +static bool virtqueue_poll_split(struct vring_virtqueue *vq, + unsigned int last_used_idx) { - struct vring_virtqueue *vq = to_vvq(_vq); - - return (u16)last_used_idx != virtio16_to_cpu(_vq->vdev, + return (u16)last_used_idx != virtio16_to_cpu(vq->vq.vdev, vq->split.vring.used->idx); } @@ -1845,9 +1844,8 @@ static unsigned int virtqueue_enable_cb_prepare_packed(struct virtqueue *_vq) return vq->last_used_idx; } -static bool virtqueue_poll_packed(struct virtqueue *_vq, u16 off_wrap) +static bool virtqueue_poll_packed(struct vring_virtqueue *vq, u16 off_wrap) { - struct vring_virtqueue *vq = to_vvq(_vq); bool wrap_counter; u16 used_idx; @@ -2608,8 +2606,8 @@ bool virtqueue_poll(struct virtqueue *_vq, unsigned int last_used_idx) return false; virtio_mb(vq->weak_barriers); - return vq->packed_ring ? virtqueue_poll_packed(_vq, last_used_idx) : - virtqueue_poll_split(_vq, last_used_idx); + return vq->packed_ring ? virtqueue_poll_packed(vq, last_used_idx) : + virtqueue_poll_split(vq, last_used_idx); } EXPORT_SYMBOL_GPL(virtqueue_poll); -- 2.42.0