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 2A8E1A0540; Mon, 4 Jul 2022 18:11:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEF56410E5; Mon, 4 Jul 2022 18:11:28 +0200 (CEST) Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by mails.dpdk.org (Postfix) with ESMTP id 1195440E09 for ; Mon, 4 Jul 2022 18:11:27 +0200 (CEST) Received: by mail-qt1-f175.google.com with SMTP id l14so10420653qtx.2 for ; Mon, 04 Jul 2022 09:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zODlLRO8/OlywnNBOsQEOX+w/yPKC4zekWbuhxeaibA=; b=p45St7FTW+EyShv/4tKAnvdaFvzdZYPlcZ7JdSSsNoZmqVrmYxBQdZFn7SUoaDQf9t xbSZNBLvOjXUkTBJHchaBpp3NUbmo55qhcHPBpXxeSNXP6mrYKr3TDev3I4FLkqp40/e IhahxKEfwkcUEw/lkcW239wyvOs356lGrDuuCj3AkVuBLgy4sht8WdljTWYwqnTz4QPV fqGS8w/b3MuQk/GKQHArmbFA+KqGbPRTHhKsVLFOmbyZ4P5mWEAbDoJEVvUP/8VuXs4C kUEk5Ya0wuj6WXH3g9Xldyn4ffkQMPDaF0ncCzi+xvFskUvrwUhpq9qyfpRSmd4FjMJX O31w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zODlLRO8/OlywnNBOsQEOX+w/yPKC4zekWbuhxeaibA=; b=6mFgOCTQqvVxeXO57Q+1JfxLO5N7Vwv1rR09k188OB/6Eu/QTmd9lVcrjLRdiJlqtX nFvOS05XA965sUO6L+Hg7JcFN4OiIAp1zB9XplWm7HYV93UzfITCIY46eqWIHZTHJTdm SXcRX6RcotzWVefAlEWhh89GgweITxcO35moQBMtqy8pbHpmh4brDj8ns/Tnw690xe5u bUlkKEz3tJE/a4foMGvwQpl86xKsVcRT2QNyhMn1Np6FpHTcHPpOCZyQmXiL24TSe+xf CGGodOeYLQFkbOpEkMzY00PmHHYvASoGVkI5vkdnwIVuM7zpNNOzUiM2TKf8qDZr7Bzh X14Q== X-Gm-Message-State: AJIora8v727ZqWB3mK3u2UQIL0K0s3Nv8LNUwXasXYjXp0dxGU0ZiPnw 9tdNqVx8i4Zw7oT1RZMTWESH01dEz9FcXfMRXJbqjXkuX9AvzQ== X-Google-Smtp-Source: AGRyM1sM/NAcmUIuN4afo+ofGtjxmzibktmPss4SCHphg1xsIioZt/o0W5ocIn5In8jD/jp8J0od/uLdGwN+yCEpGKY= X-Received: by 2002:ac8:5b06:0:b0:31d:3b22:c8dd with SMTP id m6-20020ac85b06000000b0031d3b22c8ddmr13564872qtw.410.1656951086278; Mon, 04 Jul 2022 09:11:26 -0700 (PDT) MIME-Version: 1.0 References: <20220629153638.1269743-1-timothy.mcdaniel@intel.com> <20220702162239.1646548-1-timothy.mcdaniel@intel.com> <20220702162239.1646548-6-timothy.mcdaniel@intel.com> In-Reply-To: <20220702162239.1646548-6-timothy.mcdaniel@intel.com> From: Jerin Jacob Date: Mon, 4 Jul 2022 21:41:00 +0530 Message-ID: Subject: Re: [PATCH v3 5/5] event/dlb2: fix port COS initialization To: Timothy McDaniel Cc: Jerin Jacob , dpdk-dev Content-Type: text/plain; charset="UTF-8" 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 On Sat, Jul 2, 2022 at 9:53 PM Timothy McDaniel wrote: > > 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 No need to CC yourself. Instead, if it is fix Cc: stable@dpdk.org. I will it on merge. > > Signed-off-by: Timothy McDaniel Fixed check-git-log.sh issues and Updated the git commit as follows and applied to dpdk-next-net-eventdev/for-main. Thanks commit 611ae87343db1ca6fed6a99f5e3c0880e8f0f952 Author: Timothy McDaniel Date: Sat Jul 2 11:22:39 2022 -0500 event/dlb2: fix port COS initialization 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 multi field 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: stable@dpdk.org Signed-off-by: Timothy McDaniel commit d98b716ead2878ede3f75049f89375d67ac43f48 Author: Timothy McDaniel Date: Sat Jul 2 11:22:38 2022 -0500 event/dlb2: fix CQ depth override credit deadlock This commit fixes a bug, where we could encounter a credit deadlock due to changing the CQ depth. To remedy this situation, the commit reduces the maximum CQ depth from 1024 to 128, and also allows configuring the maximum enqueue depth. Maximum enqueue depth must be tuned to the CQ depth, if the CQ depth is increased. Fixes: 86fe66d45667 ("event/dlb2: allow CQ depths up to 1024") Cc: stable@dpdk.org Signed-off-by: Timothy McDaniel commit d0143df3f208e8091b83147c356ba1d3c4f3d97b Author: Timothy McDaniel Date: Sat Jul 2 11:22:37 2022 -0500 event/dlb2: fix CQ depth override This commit fixes a bug, where we could assign a CQ depth of zero, leading to a subsequent divide-by-zero fault. It also fixes an issue where the original default CQ depth was returned on a query, instead of the overridden value. Fixes: 86fe66d45667 ("event/dlb2: allow CQ depths up to 1024") Cc: stable@dpdk.org Signed-off-by: Timothy McDaniel commit d45ba4380684a86f4c723b9da2f854de22389001 Author: Timothy McDaniel Date: Sat Jul 2 11:22:36 2022 -0500 event/dlb2: fix initialization of COS bandwidth args This commit fixes a typo and resultant bug that triggered a coverity warning. Coverity issue: 4607286 Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS") Cc: stable@dpdk.org Signed-off-by: Timothy McDaniel commit 9274d2236be09989c4d18a4a852e77fb87cf53f1 Author: Timothy McDaniel Date: Sat Jul 2 11:22:35 2022 -0500 event/dlb2: fix array sizing This commit fixes a segfault that resulted from reading beyond the end of the port_cos array. The root cause was using the DLB num ports define instead of the eventdev num ports define. Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS") Cc: stable@dpdk.org 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); > -- > 2.25.1 >