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 1C708A0584; Wed, 19 Oct 2022 15:11:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDFF9427F3; Wed, 19 Oct 2022 15:11:37 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id A700B410D1; Wed, 19 Oct 2022 15:11:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666185096; x=1697721096; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u6gt/HTTv3OLaT1w+sZxsj4QR4ot2Wy21RCB0VhnFVQ=; b=IwQOmpnS5/Nxqv856fej63/K07ooYE1giBsNjBCC9z4wNW/3o8PI1luI ePLmZmJm7uimeRHMdlcCxygYwnZ+yNYNX3VmMgbEihKB9EXzQW5fpzadi c/Hm3H4RSitrZwUVqrttsxyJrieck16xKOtmiGUdS4RMohObjXKnFGxA9 fejAVX9PD6d/iHptCd4OZhP/72g7Q6eU3vh0xgIYbt+Hu8JF9G+HuhSE8 Se8aKuTe2H8t+w9z1djhBCLtCaDXzr81tGNZd0M9yE81QTNPZWwa5Tz33 jYC7M1H1+n8Bhc3+ZnWEszF8wpOkMm3UC6WCUn3Oydi1wKUei2+x6Xhrv g==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="304021428" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="304021428" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 06:11:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="660341407" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="660341407" Received: from silpixa00401385.ir.intel.com ([10.237.214.36]) by orsmga008.jf.intel.com with ESMTP; 19 Oct 2022 06:11:27 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: ferruh.yigit@amd.com, techboard@dpdk.org, Bruce Richardson Subject: [PATCH] bus/vdev: automatically add eth alias for net drivers Date: Wed, 19 Oct 2022 14:11:18 +0100 Message-Id: <20221019131118.32394-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220921133451.4164506-1-ferruh.yigit@amd.com> References: <20220921133451.4164506-1-ferruh.yigit@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 For historical reasons, a number of net vdev drivers also add a driver alias using the "eth_" prefix. Since this is done on a per-driver basis, the use of the alias in inconsistent and is spread across multiple files. We can remove the per-driver aliases by just adding the alias automatically at the vdev bus level. Signed-off-by: Bruce Richardson --- drivers/bus/vdev/vdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index f5b43f1930..bfd7ce60c1 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -54,6 +54,12 @@ static rte_spinlock_t vdev_custom_scan_lock = RTE_SPINLOCK_INITIALIZER; void rte_vdev_register(struct rte_vdev_driver *driver) { + /* For net driver vdevs, add an automatic alias using "eth" prefix */ + if (strncmp(driver->driver.name, "net_", 4) == 0 && driver->driver.alias == NULL) { + char *alias = strdup(driver->driver.name); + memcpy(alias, "eth_", 4); + driver->driver.alias = alias; + } TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next); } -- 2.34.1