From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 47ED145A78 for ; Tue, 1 Oct 2024 11:13:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 40B7D4027A; Tue, 1 Oct 2024 11:13:12 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 0C5B94027A for ; Tue, 1 Oct 2024 11:13:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727773990; 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=jKXgC0mRo9+DlnFTBS4hx5HvYSPQ5cew3epc08pRj54=; b=PGlx6X9PUaM0HBVoLHWS0Odp5pwm5VetLeEpS+sxjmuYCeXP+Ob0jHpik1U5pKq4/kkESX NYHThQ40vaOQTqWcR9NS/n58+g88jEHMj4dTst+4dAC2HFIB98vnp1xFklLalIu8ITcOE8 e5C/Tci2+fYi5aTYZpN3BIOGMJnztA8= Received: from mx-prod-mc-05.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-342-YwVrjkxyNV-EXgh3kGdkvw-1; Tue, 01 Oct 2024 05:13:05 -0400 X-MC-Unique: YwVrjkxyNV-EXgh3kGdkvw-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 65EB5196FACB; Tue, 1 Oct 2024 09:13:04 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.68]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 78EEC3003E4D; Tue, 1 Oct 2024 09:13:02 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: bruce.richardson@intel.com, stable@dpdk.org, Jingjing Wu Subject: [PATCH v2] net/iavf: preserve MAC address with i40e PF Linux driver Date: Tue, 1 Oct 2024 11:12:54 +0200 Message-ID: <20241001091254.98540-1-david.marchand@redhat.com> In-Reply-To: <20240919120039.4097053-1-david.marchand@redhat.com> References: <20240919120039.4097053-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Following two upstream Linux kernel changes (see links), the mac address of a iavf port, serviced by a i40e PF driver, is lost when the DPDK iavf driver probes the port again (which may be triggered at any point of a DPDK application life, like when a reset event is triggered by the PF). A first change results in the mac address of the VF port being reset to 0 during the VIRTCHNL_OP_GET_VF_RESOURCES query. The i40e PF driver change is pretty obscure but the iavf Linux driver does set VIRTCHNL_VF_OFFLOAD_USO. Announcing such a capability in the DPDK driver does not seem to be an issue, so do the same in DPDK to keep the legacy behavior of a fixed mac. Then a second change in the kernel results in the VF mac address being cleared when the VF driver remove its default mac address. Removing (unicast or multicast) mac addresses is not done by the kernel VF driver in general. The reason why the DPDK driver behaves like this is undocumented (and lost because the authors are not active anymore). Aligning DPDK behavior to the upstream kernel driver is safer in any case. Cc: stable@dpdk.org Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fed0d9f13266 Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ceb29474bbbc Signed-off-by: David Marchand --- drivers/net/iavf/iavf_ethdev.c | 22 +++++----------------- drivers/net/iavf/iavf_vchnl.c | 1 + 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 11036bc179..97cdb1cbe0 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1044,7 +1044,7 @@ iavf_dev_start(struct rte_eth_dev *dev) if (iavf_configure_queues(adapter, IAVF_CFG_Q_NUM_PER_BUF, index) != 0) { PMD_DRV_LOG(ERR, "configure queues failed"); - goto err_queue; + goto error; } num_queue_pairs -= IAVF_CFG_Q_NUM_PER_BUF; index += IAVF_CFG_Q_NUM_PER_BUF; @@ -1052,12 +1052,12 @@ iavf_dev_start(struct rte_eth_dev *dev) if (iavf_configure_queues(adapter, num_queue_pairs, index) != 0) { PMD_DRV_LOG(ERR, "configure queues failed"); - goto err_queue; + goto error; } if (iavf_config_rx_queues_irqs(dev, intr_handle) != 0) { PMD_DRV_LOG(ERR, "configure irq failed"); - goto err_queue; + goto error; } /* re-enable intr again, because efd assign may change */ if (dev->data->dev_conf.intr_conf.rxq != 0) { @@ -1077,14 +1077,12 @@ iavf_dev_start(struct rte_eth_dev *dev) if (iavf_start_queues(dev) != 0) { PMD_DRV_LOG(ERR, "enable queues failed"); - goto err_mac; + goto error; } return 0; -err_mac: - iavf_add_del_all_mac_addr(adapter, false); -err_queue: +error: return -1; } @@ -1113,16 +1111,6 @@ iavf_dev_stop(struct rte_eth_dev *dev) /* Rx interrupt vector mapping free */ rte_intr_vec_list_free(intr_handle); - /* adminq will be disabled when vf is resetting. */ - if (!vf->in_reset_recovery) { - /* remove all mac addrs */ - iavf_add_del_all_mac_addr(adapter, false); - - /* remove all multicast addresses */ - iavf_add_del_mc_addr_list(adapter, vf->mc_addrs, vf->mc_addrs_num, - false); - } - iavf_stop_queues(dev); adapter->stopped = 1; diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 69420bc9b6..065ab3594c 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -710,6 +710,7 @@ iavf_get_vf_resource(struct iavf_adapter *adapter) VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF | VIRTCHNL_VF_OFFLOAD_FSUB_PF | VIRTCHNL_VF_OFFLOAD_REQ_QUEUES | + VIRTCHNL_VF_OFFLOAD_USO | VIRTCHNL_VF_OFFLOAD_CRC | VIRTCHNL_VF_OFFLOAD_VLAN_V2 | VIRTCHNL_VF_LARGE_NUM_QPAIRS | -- 2.46.2