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 A168645B9C; Tue, 22 Oct 2024 08:43:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 740AD402A3; Tue, 22 Oct 2024 08:43:21 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mails.dpdk.org (Postfix) with ESMTP id B63BC4021F for ; Tue, 22 Oct 2024 08:43:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729579400; x=1761115400; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=lkLpC1osKhHoX9JzaM7nc479wisjWJRviCHHpIuuBjk=; b=WnzWYNzLlS8/zJGMAk7CpIT55y/vIM1Cw/AtXxrFMtObuwDdM/O2S7ZB gqXwe9/9GieD2MFxnvHzclNmR8iCbjRbqJfgPfASvVj9ttpaiC0cJprMJ 4iQ11DI+ULH0y1YGgUqzJlNUW3op0q09lGz2lv5oAYhG8+etQ2IeC6J1r bEJrQmGNR3juLuuvUBtWP7S0+ZsHdLzQVG61JaFS9dekTxBT34/+wY8Ri B2PoPhGOQ9lYthLw6r4do2Ft+pcx6OaKgwlpYtjOmqOffx97AwGWmTdgg YgtKPWWy02uYuC597Z7il8pyd2xsE3YSARzI4Pg4uBAytLDociaDrAblD Q==; X-CSE-ConnectionGUID: zWjwlG0dTKSoBgUzq/Cu/g== X-CSE-MsgGUID: P+cIr8KpR+6tjoeo9XPD+A== X-IronPort-AV: E=McAfee;i="6700,10204,11232"; a="16723953" X-IronPort-AV: E=Sophos;i="6.11,222,1725346800"; d="scan'208";a="16723953" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 23:43:18 -0700 X-CSE-ConnectionGUID: 7dwZWedoQPKxuYl2LMQ8tg== X-CSE-MsgGUID: 80bLEJB3SiCZ4vII7nPq5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,222,1725346800"; d="scan'208";a="80121647" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 23:43:17 -0700 From: Mingjin Ye To: dev@dpdk.org Cc: Mingjin Ye Subject: [RFC] net/ice: add devargs to control link update Date: Tue, 22 Oct 2024 06:20:43 +0000 Message-Id: <20241022062043.1833554-1-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 This patch adds the ‘link_period’ devargs to adjust the link update period (microseconds), when the value is less than or equal to 0 it will be disabled, by default it is not enabled. Signed-off-by: Mingjin Ye --- doc/guides/nics/ice.rst | 7 ++++ drivers/net/ice/ice_ethdev.c | 69 ++++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_ethdev.h | 1 + 3 files changed, 77 insertions(+) diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index 91b5a9b461..ccfff3f294 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -303,6 +303,13 @@ Runtime Configuration * ``segment``: Check number of mbuf segments does not exceed HW limits. * ``offload``: Check for use of an unsupported offload flag. +- ``Cycle link update`` (default ``not enabled``) + + Cyclic link update is enabled when the PMD status changes to STARTED. Setting + the ``devargs`` parameter ``link_period`` adjusts the link update period in + microseconds, and is disabled when the value set is less than or equal to 0. + For example ``-a 81:00.0,link_period=5000`` or ``-a 81:00.0,link_period=0``. + Driver compilation and testing ------------------------------ diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 70298ac330..a1ef0c0d39 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -15,6 +15,7 @@ #include #include +#include #include "eal_firmware.h" @@ -38,6 +39,7 @@ #define ICE_ONE_PPS_OUT_ARG "pps_out" #define ICE_RX_LOW_LATENCY_ARG "rx_low_latency" #define ICE_MBUF_CHECK_ARG "mbuf_check" +#define ICE_LINK_UPDATE_ARG "link_period" #define ICE_CYCLECOUNTER_MASK 0xffffffffffffffffULL @@ -54,6 +56,7 @@ static const char * const ice_valid_args[] = { ICE_RX_LOW_LATENCY_ARG, ICE_DEFAULT_MAC_DISABLE, ICE_MBUF_CHECK_ARG, + ICE_LINK_UPDATE_ARG, NULL }; @@ -1389,6 +1392,44 @@ ice_handle_aq_msg(struct rte_eth_dev *dev) } #endif +static void +ice_link_cycle_update(void *cb_arg) +{ + int ret; + struct rte_eth_dev *dev = cb_arg; + struct ice_adapter *adapter = + ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); + + ret = ice_link_update(dev, 0); + if (!ret) + rte_eth_dev_callback_process + (dev, RTE_ETH_EVENT_INTR_LSC, NULL); + + if (dev->data->dev_started) { + /* re-alarm link update */ + if (rte_eal_alarm_set(adapter->devargs.link_update_period, + &ice_link_cycle_update, (void *)adapter)) + PMD_DRV_LOG(ERR, "Failed to enable cycle link update"); + } +} + +static void +ice_link_cycle_update_init(struct rte_eth_dev *dev) +{ + struct ice_adapter *adapter = + ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); + + if (adapter->devargs.link_update_period <= 0) { + PMD_DRV_LOG(INFO, "Device cycle link update is disabled"); + } else { + PMD_DRV_LOG(INFO, "Enabling cycle link update, period is %dμs", + adapter->devargs.link_update_period); + if (rte_eal_alarm_set(adapter->devargs.link_update_period, + &ice_link_cycle_update, (void *)dev)) + PMD_DRV_LOG(ERR, "Failed to enable cycle link update"); + } +} + /** * Interrupt handler triggered by NIC for handling * specific interrupt. @@ -2196,6 +2237,26 @@ ice_parse_mbuf_check(__rte_unused const char *key, const char *value, void *args return ret; } +static int +ice_parse_clean_subtask_period(__rte_unused const char *key, + const char *value, void *args) +{ + int *num = (int *)args; + int tmp; + + errno = 0; + tmp = atoi(value); + if (tmp < 0) { + PMD_DRV_LOG(WARNING, "%s: \"%s\" is not greater than or equal to zero", + key, value); + return -1; + } + + *num = tmp; + + return 0; +} + static int ice_parse_devargs(struct rte_eth_dev *dev) { struct ice_adapter *ad = @@ -2257,6 +2318,12 @@ static int ice_parse_devargs(struct rte_eth_dev *dev) if (ret) goto bail; + ret = rte_kvargs_process(kvlist, ICE_LINK_UPDATE_ARG, + &ice_parse_clean_subtask_period, + &ad->devargs.link_update_period); + if (ret) + goto bail; + ret = rte_kvargs_process(kvlist, ICE_RX_LOW_LATENCY_ARG, &parse_bool, &ad->devargs.rx_low_latency); @@ -2598,6 +2665,8 @@ ice_dev_init(struct rte_eth_dev *dev) /* reset all stats of the device, including pf and main vsi */ ice_stats_reset(dev); + ice_link_cycle_update_init(dev); + return 0; err_flow_init: diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 57087c98ed..4cbe119ac4 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -569,6 +569,7 @@ struct ice_devargs { /* Name of the field. */ char xtr_field_name[RTE_MBUF_DYN_NAMESIZE]; uint64_t mbuf_check; + uint32_t link_update_period; }; /** -- 2.25.1