From patchwork Thu Apr 7 14:51:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Danilewicz, MarcinX" X-Patchwork-Id: 109427 X-Patchwork-Delegate: thomas@monjalon.net 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 5DA43A0505; Thu, 7 Apr 2022 16:52:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EDE74111B; Thu, 7 Apr 2022 16:52:02 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 5366740689 for ; Thu, 7 Apr 2022 16:52:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649343121; x=1680879121; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=4X+PtgpG+dC6B7kWncNhIA+/bkX29LMilz9M2OLS7gE=; b=mxhkFSWEdehv9zCSSrPMkooqIzwXh1jS1ldfQ5MSsvgpVm5OYRnLZzrt F9pl1OIybSyvplM1BsmUHgZdZNVwG3lNmkNzlrRbsbxOY+9j/hLH36+qY T7HO9Y4GLQ13YmhTsF0qaWs+FsCM/OcCHTePdLAs9gIUpC4I85OE33Pet vdsehYA+GTjh6CRlv0UsHNKkuM7Qof8CZhFZx7L9XZ7PVyOhcyKhSwTj/ X7ddQkD6SASj1SaxXzVe3/2Fu150LPp+vrLHCwosNk8GwU6qUtH4TIaAk 5W7Vid8sIW4/hsyY/W0Sxpq2bl+cv5CKYqWqfs0KWOSVxjIoRio4oFVCq Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10309"; a="261335857" X-IronPort-AV: E=Sophos;i="5.90,242,1643702400"; d="scan'208";a="261335857" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2022 07:52:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,242,1643702400"; d="scan'208";a="524391899" Received: from silpixa00400629.ir.intel.com ([10.237.213.88]) by orsmga002.jf.intel.com with ESMTP; 07 Apr 2022 07:51:59 -0700 From: Marcin Danilewicz To: dev@dpdk.org Subject: [dpdk][PATCH 2/2] sched: fix to manage TC OV at runtime Date: Thu, 7 Apr 2022 14:51:53 +0000 Message-Id: <20220407145153.238969-2-marcinx.danilewicz@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220407145153.238969-1-marcinx.danilewicz@intel.com> References: <20220407145153.238969-1-marcinx.danilewicz@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 Added changes after review and increased throughput. Signed-off-by: Marcin Danilewicz diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index 1d05089d00..6e7d81df46 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -155,7 +155,6 @@ struct rte_sched_subport { uint64_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; /* TC oversubscription */ - uint8_t is_tc_ov_enabled; uint64_t tc_ov_wm; uint64_t tc_ov_wm_min; uint64_t tc_ov_wm_max; @@ -214,6 +213,9 @@ struct rte_sched_subport { uint8_t *bmp_array; struct rte_mbuf **queue_array; uint8_t memory[0] __rte_cache_aligned; + + /* TC oversubscription activation */ + int is_tc_ov_enabled; } __rte_cache_aligned; struct rte_sched_port { @@ -1187,7 +1189,7 @@ rte_sched_subport_tc_ov_config(struct rte_sched_port *port, } s = port->subports[subport_id]; - s->is_tc_ov_enabled = tc_ov_enable; + s->is_tc_ov_enabled = tc_ov_enable ? 1 : 0; if (s->is_tc_ov_enabled) { /* TC oversubscription */ @@ -1294,6 +1296,9 @@ rte_sched_subport_config(struct rte_sched_port *port, s->n_pipe_profiles = params->n_pipe_profiles; s->n_max_pipe_profiles = params->n_max_pipe_profiles; + /* TC over-subscription is disabled by default */ + s->is_tc_ov_enabled = 0; + #ifdef RTE_SCHED_CMAN if (params->cman_params != NULL) { s->cman_enabled = true; @@ -1356,9 +1361,6 @@ rte_sched_subport_config(struct rte_sched_port *port, for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i++) s->grinder_base_bmp_pos[i] = RTE_SCHED_PIPE_INVALID; - - /* TC over-subscription is disabled by default */ - s->is_tc_ov_enabled = 0; } { @@ -2514,12 +2516,15 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pkt_len = pkt->pkt_len + port->frame_overhead; uint32_t be_tc_active; - if (unlikely(subport->is_tc_ov_enabled)) { + switch (subport->is_tc_ov_enabled) { + case 1: if (!grinder_credits_check_with_tc_ov(port, subport, pos)) return 0; - } else { + break; + case 0: if (!grinder_credits_check(port, subport, pos)) return 0; + break; } /* Advance port time */