From patchwork Mon Feb 1 17:46:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 87593 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 811F7A0A0B; Mon, 1 Feb 2021 18:46:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D68540693; Mon, 1 Feb 2021 18:46:42 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id 3DE9140687 for ; Mon, 1 Feb 2021 18:46:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612201599; 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; bh=LyO1/l3tDdY7Mn5A1jXMvNZW8XAAFoCyDmd/WTsi630=; b=dorTLwK5G0U3xWYziynkqPkLjZxJXgf405iYZvmUj8oj1JoQ1SAed/AJn8DpexaSt93DnS oMwszo63Vlhg+EJsRCPDJevXo5zasiJdeGog9fAxXh8p+vY+0kSety9bQHucK7zHx1A91p iqnghreKgruvmQtsZWkW0mPeokJjXmU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-546-E8og-BjEPxm0w5jIRIZ1oA-1; Mon, 01 Feb 2021 12:46:37 -0500 X-MC-Unique: E8og-BjEPxm0w5jIRIZ1oA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 99985C298; Mon, 1 Feb 2021 17:46:36 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3E9D1975E; Mon, 1 Feb 2021 17:46:31 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Maxime Coquelin , Chenbo Xia Date: Mon, 1 Feb 2021 18:46:01 +0100 Message-Id: <20210201174602.30923-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH 21.05] net/virtio: remove duplicate port id from virtio_user X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The private virtio_user_dev structure embeds a virtio_hw which itself contains the ethdev port_id. Make use of it and remove the duplicate port_id field. Signed-off-by: David Marchand Reviewed-by: Maxime Coquelin --- Posting this cleanup that I caught when reviewing/discussing the port_id fix from Maxime. It can wait 21.05. --- drivers/net/virtio/virtio_user/vhost_user.c | 3 ++- drivers/net/virtio/virtio_user/virtio_user_dev.c | 6 +++--- drivers/net/virtio/virtio_user/virtio_user_dev.h | 1 - drivers/net/virtio/virtio_user_ethdev.c | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c index ec2c53c8fb..18ae29eed2 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -950,7 +950,8 @@ vhost_user_update_link_state(struct virtio_user_dev *dev) r = recv(data->vhostfd, buf, 128, MSG_PEEK); if (r == 0 || (r < 0 && errno != EAGAIN)) { dev->net_status &= (~VIRTIO_NET_S_LINK_UP); - PMD_DRV_LOG(ERR, "virtio-user port %u is down", dev->port_id); + PMD_DRV_LOG(ERR, "virtio-user port %u is down", + dev->hw.port_id); /* This function could be called in the process * of interrupt handling, callback cannot be diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 1b54d55bd8..2255c99a36 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -340,7 +340,7 @@ static int virtio_user_fill_intr_handle(struct virtio_user_dev *dev) { uint32_t i; - struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id]; + struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->hw.port_id]; if (!eth_dev->intr_handle) { eth_dev->intr_handle = malloc(sizeof(*eth_dev->intr_handle)); @@ -888,7 +888,7 @@ void virtio_user_dev_delayed_handler(void *param) { struct virtio_user_dev *dev = param; - struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id]; + struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->hw.port_id]; if (rte_intr_disable(eth_dev->intr_handle) < 0) { PMD_DRV_LOG(ERR, "interrupt disable failed"); @@ -913,7 +913,7 @@ int virtio_user_dev_server_reconnect(struct virtio_user_dev *dev) { int ret, old_status; - struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id]; + struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->hw.port_id]; struct virtio_hw *hw = &dev->hw; if (!dev->ops->server_reconnect) { diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index 8a62f7ea79..7fd4622f01 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -43,7 +43,6 @@ struct virtio_user_dev { uint64_t unsupported_features; /* unsupported features mask */ uint8_t status; uint16_t net_status; - uint16_t port_id; uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; char path[PATH_MAX]; char *ifname; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 1810a54694..fb1fe355d3 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -428,7 +428,6 @@ virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev) hw = &dev->hw; hw->port_id = data->port_id; - dev->port_id = data->port_id; VIRTIO_OPS(hw) = &virtio_user_ops; hw->intr_lsc = 1;