From patchwork Sat Jul 2 16:22:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timothy McDaniel X-Patchwork-Id: 113647 X-Patchwork-Delegate: jerinj@marvell.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 9CA49A0093; Sat, 2 Jul 2022 18:23:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9D3342B75; Sat, 2 Jul 2022 18:22:48 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 56E7640E50 for ; Sat, 2 Jul 2022 18:22:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656778964; x=1688314964; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QAjyIPKfUUm+lxGGmZpwpo2XscdDaowb4VrZ9oWj7K4=; b=ZNQ+1JRfPDBarFy54QdMHSl8r1g0Dq65AjWbDD8m5ANHhabhHL3orQoV NbLDrEPC83spJ3kJCzTexI7ingjXWAqTquMoSQpniLbIgHsy9FCFX7h0F cByOU4pH050TazliUk++pjWWUT1UiVwMw5pEYZmSuc6hXmUykBebgSM2C +vBLnqIokqf5235cmZ/UA4aBWPPnUvRrwZsIHx+OKt2yshgmYNXpFkjWR cL3zW7SkdcDpohfm0fr6I4MmDn3k3Xj6zm0notdPUxoCLhoVWu3xarFUm sdMwcNA787H5Qi4Mu3C1Xps0zq/avPMmdY5QwYCd5+pWsxhysLvPrsTnG Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10396"; a="283957278" X-IronPort-AV: E=Sophos;i="5.92,240,1650956400"; d="scan'208";a="283957278" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2022 09:22:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,240,1650956400"; d="scan'208";a="648781633" Received: from txanpdk03.an.intel.com ([10.123.117.78]) by fmsmga008.fm.intel.com with ESMTP; 02 Jul 2022 09:22:42 -0700 From: Timothy McDaniel To: jerinj@marvell.com Cc: dev@dpdk.org, timothy.mcdaniel@intel.com Subject: [PATCH v3 5/5] event/dlb2: fix port COS initialization Date: Sat, 2 Jul 2022 11:22:39 -0500 Message-Id: <20220702162239.1646548-6-timothy.mcdaniel@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220702162239.1646548-1-timothy.mcdaniel@intel.com> References: <20220629153638.1269743-1-timothy.mcdaniel@intel.com> <20220702162239.1646548-1-timothy.mcdaniel@intel.com> MIME-Version: 1.0 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 Fix cos initialization, handling the default case too. Substitute the semicolon for the comma that was expected in the cos_bw command line override. Commas are not allowed within a multifield option. The new format is cos_bw=%d:%d:%d:%d, where the sum of the 4 decimal values must be less than or equal to 100. Corrected probe-time initialization order. Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS") Cc: timothy.mcdaniel@intel.com Signed-off-by: Timothy McDaniel --- drivers/event/dlb2/dlb2.c | 63 ++++++++++++---------- drivers/event/dlb2/pf/base/dlb2_resource.c | 3 -- drivers/event/dlb2/pf/dlb2_pf.c | 4 ++ 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 8a68c25c93..26af75beb8 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -170,10 +170,11 @@ dlb2_init_port_cos(struct dlb2_eventdev *dlb2, int *port_cos) { int q; - for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) { - dlb2->ev_ports[q].cos_id = port_cos[q]; - dlb2->cos_ports[port_cos[q]]++; - } + for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) + if (port_cos[q] != DLB2_COS_DEFAULT) { + dlb2->ev_ports[q].cos_id = port_cos[q]; + dlb2->cos_ports[port_cos[q]]++; + } } static void @@ -181,6 +182,17 @@ dlb2_init_cos_bw(struct dlb2_eventdev *dlb2, struct dlb2_cos_bw *cos_bw) { int q; + + + /* If cos_bw not set, then split evenly */ + if (cos_bw->val[0] == 0 && cos_bw->val[1] == 0 && + cos_bw->val[2] == 0 && cos_bw->val[3] == 0) { + cos_bw->val[0] = 25; + cos_bw->val[1] = 25; + cos_bw->val[2] = 25; + cos_bw->val[3] = 25; + } + for (q = 0; q < DLB2_COS_NUM_VALS; q++) dlb2->cos_bw[q] = cos_bw->val[q]; @@ -464,19 +476,15 @@ set_port_cos(const char *key __rte_unused, } /* command line override may take one of the following 3 forms: - * port_cos=all: ... all ports * port_cos=port-port: ... a range of ports * port_cos=port: ... just one port */ - if (sscanf(value, "all:%d", &cos_id) == 1) { - first = 0; - last = DLB2_MAX_NUM_LDB_PORTS - 1; - } else if (sscanf(value, "%d-%d:%d", &first, &last, &cos_id) == 3) { + if (sscanf(value, "%d-%d:%d", &first, &last, &cos_id) == 3) { /* we have everything we need */ } else if (sscanf(value, "%d:%d", &first, &cos_id) == 2) { last = first; } else { - DLB2_LOG_ERR("Error parsing ldb port port_cos devarg. Should be all:val, port-port:val, or port:val\n"); + DLB2_LOG_ERR("Error parsing ldb port port_cos devarg. Should be port-port:val, or port:val\n"); return -EINVAL; } @@ -511,13 +519,13 @@ set_cos_bw(const char *key __rte_unused, /* format must be %d,%d,%d,%d */ - if (sscanf(value, "%d,%d,%d,%d", &cos_bw->val[0], &cos_bw->val[1], + if (sscanf(value, "%d:%d:%d:%d", &cos_bw->val[0], &cos_bw->val[1], &cos_bw->val[2], &cos_bw->val[3]) != 4) { - DLB2_LOG_ERR("Error parsing cos bandwidth devarg. Should be bw0,bw1,bw2,bw3 where all values combined are <= 100\n"); + DLB2_LOG_ERR("Error parsing cos bandwidth devarg. Should be bw0:bw1:bw2:bw3 where all values combined are <= 100\n"); return -EINVAL; } if (cos_bw->val[0] + cos_bw->val[1] + cos_bw->val[2] + cos_bw->val[3] > 100) { - DLB2_LOG_ERR("Error parsing cos bandwidth devarg. Should be bw0,bw1,bw2,bw3 where all values combined are <= 100\n"); + DLB2_LOG_ERR("Error parsing cos bandwidth devarg. Should be bw0:bw1:bw2:bw3 where all values combined are <= 100\n"); return -EINVAL; } @@ -781,9 +789,9 @@ dlb2_hw_create_sched_domain(struct dlb2_eventdev *dlb2, /* LDB ports */ - /* tally of ports with non default COS */ - cos_ports = dlb2->cos_ports[1] + dlb2->cos_ports[2] + - dlb2->cos_ports[3]; + /* tally of COS ports from cmd line */ + cos_ports = dlb2->cos_ports[0] + dlb2->cos_ports[1] + + dlb2->cos_ports[2] + dlb2->cos_ports[3]; if (cos_ports > resources_asked->num_ldb_ports) { DLB2_LOG_ERR("dlb2: num_ldb_ports < nonzero cos_ports\n"); @@ -4552,6 +4560,17 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev, evdev_dlb2_default_info.max_event_port_enqueue_depth = dlb2->max_enq_depth; + dlb2_init_queue_depth_thresholds(dlb2, + dlb2_args->qid_depth_thresholds.val); + + dlb2_init_cq_weight(dlb2, + dlb2_args->cq_weight.limit); + + dlb2_init_port_cos(dlb2, + dlb2_args->port_cos.cos_id); + + dlb2_init_cos_bw(dlb2, + &dlb2_args->cos_bw); err = dlb2_iface_open(&dlb2->qm_instance, name); if (err < 0) { @@ -4623,18 +4642,6 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev, dlb2_entry_points_init(dev); - dlb2_init_queue_depth_thresholds(dlb2, - dlb2_args->qid_depth_thresholds.val); - - dlb2_init_cq_weight(dlb2, - dlb2_args->cq_weight.limit); - - dlb2_init_port_cos(dlb2, - dlb2_args->port_cos.cos_id); - - dlb2_init_cos_bw(dlb2, - &dlb2_args->cos_bw); - return 0; } diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c index da1949c763..e73d289445 100644 --- a/drivers/event/dlb2/pf/base/dlb2_resource.c +++ b/drivers/event/dlb2/pf/base/dlb2_resource.c @@ -236,9 +236,6 @@ int dlb2_resource_init(struct dlb2_hw *hw, enum dlb2_hw_ver ver) hw->rsrcs.sn_groups[i].slot_use_bitmap = 0; } - for (i = 0; i < DLB2_NUM_COS_DOMAINS; i++) - hw->cos_reservation[i] = 100 / DLB2_NUM_COS_DOMAINS; - return 0; unwind: diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c index 086d4a1cc7..dd3f2b8ece 100644 --- a/drivers/event/dlb2/pf/dlb2_pf.c +++ b/drivers/event/dlb2/pf/dlb2_pf.c @@ -712,10 +712,14 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev) .max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH }; struct dlb2_eventdev *dlb2; + int q; DLB2_LOG_DBG("Enter with dev_id=%d socket_id=%d", eventdev->data->dev_id, eventdev->data->socket_id); + for (q = 0; q < DLB2_MAX_NUM_PORTS_ALL; q++) + dlb2_args.port_cos.cos_id[q] = DLB2_COS_DEFAULT; + dlb2_pf_iface_fn_ptrs_init(); pci_dev = RTE_DEV_TO_PCI(eventdev->dev);