From patchwork Tue Jun 6 07:19:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268406 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B16446112 for ; Tue, 6 Jun 2023 07:20:30 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 580BC1702 for ; Tue, 6 Jun 2023 00:20:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036009; x=1717572009; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=lihZEA8md6Ln0rRdNt1bbPU1NnyU/TsRvNIoNfvDfGM=; b=VyRav/OuS1zMF5n5g1BMTLw1F84D7xiD5LGUsC1rbbnj0uGVn73bMszR cATTUSi1qlgc1DbcvyHCG2niaLXgsPpNd4GZTwxFHZ5Tmgx10ZbnBWhMX TSLFucf85f7BqznxhWNTf9xZyEWtpwp5x3Y5tQrh+PefIfz946tP28myf 0maOsPPLsHnybltO0TnbRjfasWP96GG/2AgAskU4m3Q1lsGHevjOQG1bw Oe2N90FAYshPHnvuj1xjVjWCN5HOxlic5kgyHeq+ikyDkSWF8/2bEsxbp 6/Wm4j3sbzpSPQzHzD8+yFOXxt+/51r8n8gIAoW3WLGm+m+3aHLF/Qbvy Q==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="216378678" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:08 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:08 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:06 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:36 +0200 Subject: [PATCH iproute2-next v3 01/12] dcb: app: add new dcbnl attribute field Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-1-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com Add a new field 'attr' to the dcb_app_table struct, in order to inject different dcbnl get/set attributes for APP and rewrite. Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/dcb_app.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index eeb78e70f63f..8073415ad084 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -71,6 +71,7 @@ static void dcb_app_help(void) struct dcb_app_table { struct dcb_app *apps; size_t n_apps; + int attr; }; enum ieee_attrs_app dcb_app_attr_type_get(__u8 selector) @@ -583,7 +584,7 @@ static int dcb_app_get(struct dcb *dcb, const char *dev, struct dcb_app_table *t void *payload; int ret; - ret = dcb_get_attribute_va(dcb, dev, DCB_ATTR_IEEE_APP_TABLE, &payload, &payload_len); + ret = dcb_get_attribute_va(dcb, dev, tab->attr, &payload, &payload_len); if (ret != 0) return ret; @@ -606,7 +607,7 @@ static int dcb_app_add_del_cb(struct dcb *dcb, struct nlmsghdr *nlh, void *data) struct nlattr *nest; size_t i; - nest = mnl_attr_nest_start(nlh, DCB_ATTR_IEEE_APP_TABLE); + nest = mnl_attr_nest_start(nlh, add_del->tab->attr); for (i = 0; i < add_del->tab->n_apps; i++) { const struct dcb_app *app = &add_del->tab->apps[i]; @@ -715,7 +716,7 @@ static int dcb_cmd_app_parse_add_del(struct dcb *dcb, const char *dev, static int dcb_cmd_app_add(struct dcb *dcb, const char *dev, int argc, char **argv) { - struct dcb_app_table tab = {}; + struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE }; int ret; ret = dcb_cmd_app_parse_add_del(dcb, dev, argc, argv, &tab); @@ -729,7 +730,7 @@ static int dcb_cmd_app_add(struct dcb *dcb, const char *dev, int argc, char **ar static int dcb_cmd_app_del(struct dcb *dcb, const char *dev, int argc, char **argv) { - struct dcb_app_table tab = {}; + struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE }; int ret; ret = dcb_cmd_app_parse_add_del(dcb, dev, argc, argv, &tab); @@ -743,7 +744,7 @@ static int dcb_cmd_app_del(struct dcb *dcb, const char *dev, int argc, char **ar static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **argv) { - struct dcb_app_table tab = {}; + struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE }; int ret; ret = dcb_app_get(dcb, dev, &tab); @@ -795,7 +796,7 @@ out: static int dcb_cmd_app_flush(struct dcb *dcb, const char *dev, int argc, char **argv) { - struct dcb_app_table tab = {}; + struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE }; int ret; ret = dcb_app_get(dcb, dev, &tab); @@ -848,9 +849,9 @@ out: static int dcb_cmd_app_replace(struct dcb *dcb, const char *dev, int argc, char **argv) { - struct dcb_app_table orig = {}; - struct dcb_app_table tab = {}; - struct dcb_app_table new = {}; + struct dcb_app_table orig = { .attr = DCB_ATTR_IEEE_APP_TABLE }; + struct dcb_app_table tab = { .attr = DCB_ATTR_IEEE_APP_TABLE }; + struct dcb_app_table new = { .attr = DCB_ATTR_IEEE_APP_TABLE }; int ret; ret = dcb_app_get(dcb, dev, &orig); From patchwork Tue Jun 6 07:19:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268407 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51DF56112 for ; Tue, 6 Jun 2023 07:20:31 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9579FE7D for ; Tue, 6 Jun 2023 00:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036012; x=1717572012; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=+qUa9ZCKa1qwvZTUwTGk3ipymnAXatsEgkst/+aVBmw=; b=zsZsLuKojhLniBl6UwVrT+kyGR+sBVp6DMLxAu7d2U9Ux71W59j9NDOk /KIvunX01aK/ZTk6St500FW8naLam59Mal8DQZ2HlxuMYvb4Ox/s5WlMm nZZRRCsBta7wUR+NQekO8RHCERLBVdFvztH+n1U7tCSTT3XmxQ4O3uKZD YMWI6foMRQU/IU1hNzi9YH8xEreOuOMuT7O4a5uVDW2WxGF2fxkfcPX+f UglDtSoeWrKXPaaQThoyNwzIwiSNEFxi780ezFSuMlo61iHc6c+e07M81 ud21RL7MP1yl531Ylbj5TGbtiCcoHs1ZKkAR5qdOfCferqQZsfU6oLzr4 w==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="214809783" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:11 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:10 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:08 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:37 +0200 Subject: [PATCH iproute2-next v3 02/12] dcb: app: replace occurrences of %d with %u for printing unsigned int Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-2-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com In preparation for changing the prototype of dcb_app_print_filtered(), replace occurrences of %d for printing unsigned integer, with %u as it ought to be. Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/dcb_app.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index 8073415ad084..644c37d36ffb 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -405,7 +405,7 @@ static bool dcb_app_is_port(const struct dcb_app *app) static int dcb_app_print_key_dec(__u16 protocol) { - return print_uint(PRINT_ANY, NULL, "%d:", protocol); + return print_uint(PRINT_ANY, NULL, "%u:", protocol); } static int dcb_app_print_key_hex(__u16 protocol) @@ -420,14 +420,14 @@ static int dcb_app_print_key_dscp(__u16 protocol) if (!is_json_context() && name != NULL) return print_string(PRINT_FP, NULL, "%s:", name); - return print_uint(PRINT_ANY, NULL, "%d:", protocol); + return print_uint(PRINT_ANY, NULL, "%u:", protocol); } static int dcb_app_print_key_pcp(__u16 protocol) { /* Print in numerical form, if protocol value is out-of-range */ if (protocol > DCB_APP_PCP_MAX) - return print_uint(PRINT_ANY, NULL, "%d:", protocol); + return print_uint(PRINT_ANY, NULL, "%u:", protocol); return print_string(PRINT_ANY, NULL, "%s:", pcp_names[protocol]); } @@ -454,7 +454,7 @@ static void dcb_app_print_filtered(const struct dcb_app_table *tab, open_json_array(PRINT_JSON, NULL); print_key(app->protocol); - print_uint(PRINT_ANY, NULL, "%d ", app->priority); + print_uint(PRINT_ANY, NULL, "%u ", app->priority); close_json_array(PRINT_JSON, NULL); } @@ -519,7 +519,7 @@ static void dcb_app_print_default_prio(const struct dcb_app_table *tab) print_string(PRINT_FP, NULL, "default-prio ", NULL); first = false; } - print_uint(PRINT_ANY, NULL, "%d ", tab->apps[i].priority); + print_uint(PRINT_ANY, NULL, "%u ", tab->apps[i].priority); } if (!first) { @@ -550,13 +550,13 @@ static int dcb_app_get_table_attr_cb(const struct nlattr *attr, void *data) if (!dcb_app_attr_type_validate(type)) { fprintf(stderr, - "Unknown attribute in DCB_ATTR_IEEE_APP_TABLE: %d\n", + "Unknown attribute in DCB_ATTR_IEEE_APP_TABLE: %u\n", type); return MNL_CB_OK; } if (mnl_attr_get_payload_len(attr) < sizeof(struct dcb_app)) { fprintf(stderr, - "%s payload expected to have size %zd, not %d\n", + "%s payload expected to have size %zu, not %u\n", ieee_attrs_app_names[type], sizeof(struct dcb_app), mnl_attr_get_payload_len(attr)); return MNL_CB_OK; From patchwork Tue Jun 6 07:19:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268408 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A60576AA2 for ; Tue, 6 Jun 2023 07:20:32 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C9A10CC for ; Tue, 6 Jun 2023 00:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036014; x=1717572014; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=jFnSIp8lbMkQt3WOYP17mjK2yAni6DdS7zWSiCIvY5Y=; b=VDsPF5Yb7zJtSHxWP0ULVcRct86O9/OtFf8MyBe+PFmunEBNy2rzgF/R Cb7i1TMVkG6Gc/5i9g4rAVpASKVGn2cEMHHOfmco+en000mWCrZIs/YJe zqBtUa/DJUifrJQ0oS5xuWJz6KdafVJQiTHV4cAwkZqUcRBX8LohWGfB4 0Dyu4j3INhnGGIzTC1Fi6ysRZtOVYqf0pQBP5wwUdKIeUXaSfDJ7zjX+B Nk6/6OR5Wgfp6F87SSqXgMSJqTyT2oKCKbKBUKbv+8lXJ5bWXq2yMAmoF vCxIvedGoi5Y2LiY8e/JvMGHLR/DXXog7SMqKiy1OaYGPEVC+59Wz9X2d Q==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="219027958" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:13 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:11 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:10 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:38 +0200 Subject: [PATCH iproute2-next v3 03/12] dcb: app: move colon printing out of callbacks Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-3-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com In preparation for changing the prototype of dcb_app_print_filtered(), move the colon printing out of the callbacks, and into dcb_app_print_filtered(). Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/dcb_app.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index 644c37d36ffb..ed7930ae7b37 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -405,12 +405,12 @@ static bool dcb_app_is_port(const struct dcb_app *app) static int dcb_app_print_key_dec(__u16 protocol) { - return print_uint(PRINT_ANY, NULL, "%u:", protocol); + return print_uint(PRINT_ANY, NULL, "%u", protocol); } static int dcb_app_print_key_hex(__u16 protocol) { - return print_uint(PRINT_ANY, NULL, "%x:", protocol); + return print_uint(PRINT_ANY, NULL, "%x", protocol); } static int dcb_app_print_key_dscp(__u16 protocol) @@ -419,17 +419,17 @@ static int dcb_app_print_key_dscp(__u16 protocol) if (!is_json_context() && name != NULL) - return print_string(PRINT_FP, NULL, "%s:", name); - return print_uint(PRINT_ANY, NULL, "%u:", protocol); + return print_string(PRINT_FP, NULL, "%s", name); + return print_uint(PRINT_ANY, NULL, "%u", protocol); } static int dcb_app_print_key_pcp(__u16 protocol) { /* Print in numerical form, if protocol value is out-of-range */ if (protocol > DCB_APP_PCP_MAX) - return print_uint(PRINT_ANY, NULL, "%u:", protocol); + return print_uint(PRINT_ANY, NULL, "%u", protocol); - return print_string(PRINT_ANY, NULL, "%s:", pcp_names[protocol]); + return print_string(PRINT_ANY, NULL, "%s", pcp_names[protocol]); } static void dcb_app_print_filtered(const struct dcb_app_table *tab, @@ -454,7 +454,7 @@ static void dcb_app_print_filtered(const struct dcb_app_table *tab, open_json_array(PRINT_JSON, NULL); print_key(app->protocol); - print_uint(PRINT_ANY, NULL, "%u ", app->priority); + print_uint(PRINT_ANY, NULL, ":%u ", app->priority); close_json_array(PRINT_JSON, NULL); } From patchwork Tue Jun 6 07:19:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268409 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F34261097E for ; Tue, 6 Jun 2023 07:20:32 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C0910D0 for ; Tue, 6 Jun 2023 00:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036014; x=1717572014; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=loEFBV9uD0uMUW/MxstjP1kjKYMn/HSFoDn/oCMlINU=; b=PD2YVHkDpt9YyLd9JiZOimbNAKXYWm+4v/d0kxcGhj+KtPbY82vkf7lg 2LLhsffM+FlwkYV0syWEVi0+9jk8miMUOZBdJ5cnYJGVfxHxTBIxsrBtv ZHWoJrZ+qRu4aZ3YkZZnr/6VoaT0LD3AV+jqVCeSghBWtsbuAtOwCbphH EnV00I8rjqrOJnvmxLiq25AZwl7kjhcDHnd5icMyVfucJkguIT8RDI2aW SR07Nu3zwdcEBqNfPkLA6GcsLt3jQLMDGtA/DMwCz7dscx8+ecHnmd3vy ILWsnG3QK+k4XbxDmHYmy9CIqCfhGi6Ceb46ujmHqU55AK7c8YejODKmB w==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="214809808" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:13 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:13 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:12 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:39 +0200 Subject: [PATCH iproute2-next v3 04/12] dcb: app: rename dcb_app_print_key_*() functions Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-4-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com In preparation for changing the prototype of dcb_app_print_filtered(), rename the _print_key_*() functions to _print_pid_*(), as the protocol can both be key and value with the introduction of dcb-rewr. Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/dcb_app.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index ed7930ae7b37..a8f3424db9f7 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -403,17 +403,17 @@ static bool dcb_app_is_port(const struct dcb_app *app) return app->selector == IEEE_8021QAZ_APP_SEL_ANY; } -static int dcb_app_print_key_dec(__u16 protocol) +static int dcb_app_print_pid_dec(__u16 protocol) { return print_uint(PRINT_ANY, NULL, "%u", protocol); } -static int dcb_app_print_key_hex(__u16 protocol) +static int dcb_app_print_pid_hex(__u16 protocol) { return print_uint(PRINT_ANY, NULL, "%x", protocol); } -static int dcb_app_print_key_dscp(__u16 protocol) +static int dcb_app_print_pid_dscp(__u16 protocol) { const char *name = rtnl_dsfield_get_name(protocol << 2); @@ -423,7 +423,7 @@ static int dcb_app_print_key_dscp(__u16 protocol) return print_uint(PRINT_ANY, NULL, "%u", protocol); } -static int dcb_app_print_key_pcp(__u16 protocol) +static int dcb_app_print_pid_pcp(__u16 protocol) { /* Print in numerical form, if protocol value is out-of-range */ if (protocol > DCB_APP_PCP_MAX) @@ -466,7 +466,7 @@ static void dcb_app_print_filtered(const struct dcb_app_table *tab, static void dcb_app_print_ethtype_prio(const struct dcb_app_table *tab) { - dcb_app_print_filtered(tab, dcb_app_is_ethtype, dcb_app_print_key_hex, + dcb_app_print_filtered(tab, dcb_app_is_ethtype, dcb_app_print_pid_hex, "ethtype_prio", "ethtype-prio"); } @@ -474,8 +474,8 @@ static void dcb_app_print_pcp_prio(const struct dcb *dcb, const struct dcb_app_table *tab) { dcb_app_print_filtered(tab, dcb_app_is_pcp, - dcb->numeric ? dcb_app_print_key_dec - : dcb_app_print_key_pcp, + dcb->numeric ? dcb_app_print_pid_dec + : dcb_app_print_pid_pcp, "pcp_prio", "pcp-prio"); } @@ -483,26 +483,26 @@ static void dcb_app_print_dscp_prio(const struct dcb *dcb, const struct dcb_app_table *tab) { dcb_app_print_filtered(tab, dcb_app_is_dscp, - dcb->numeric ? dcb_app_print_key_dec - : dcb_app_print_key_dscp, + dcb->numeric ? dcb_app_print_pid_dec + : dcb_app_print_pid_dscp, "dscp_prio", "dscp-prio"); } static void dcb_app_print_stream_port_prio(const struct dcb_app_table *tab) { - dcb_app_print_filtered(tab, dcb_app_is_stream_port, dcb_app_print_key_dec, + dcb_app_print_filtered(tab, dcb_app_is_stream_port, dcb_app_print_pid_dec, "stream_port_prio", "stream-port-prio"); } static void dcb_app_print_dgram_port_prio(const struct dcb_app_table *tab) { - dcb_app_print_filtered(tab, dcb_app_is_dgram_port, dcb_app_print_key_dec, + dcb_app_print_filtered(tab, dcb_app_is_dgram_port, dcb_app_print_pid_dec, "dgram_port_prio", "dgram-port-prio"); } static void dcb_app_print_port_prio(const struct dcb_app_table *tab) { - dcb_app_print_filtered(tab, dcb_app_is_port, dcb_app_print_key_dec, + dcb_app_print_filtered(tab, dcb_app_is_port, dcb_app_print_pid_dec, "port_prio", "port-prio"); } From patchwork Tue Jun 6 07:19:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268411 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FEBC24132 for ; Tue, 6 Jun 2023 07:20:33 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CECBC10CB for ; Tue, 6 Jun 2023 00:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036015; x=1717572015; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=/mGXLFJ93FJ8GUFL1KF9OktNd9g1tlzoZgFFvKACtu0=; b=MPC03y9vcjQJ5cXxctHzTXM/Lfxi0OE8xg8zcT1HUhpmUrmU08OlJiGf 9COCm9isKAKgtqOlo4OexTlJzDLSvNV7rdvq3TADDkQIgxScHD0WSIAD8 2ZvjPJo6pfEt02qk3xhVYJv6iL2NwjCLqG+XCq/pvG9iftnz4pt4dgoAK xZrOj97Q7pnTRGe3oLjwOyEOHLsRV+7rF9uMSoHC5ja+UdkPO5A/4mJfh 2UA96kKrIvitKJEYHv9EYRNtr43EIV0P1ARZYDBhhtAaV/9FJFFyZWKBp tnYh4yZQygz+A6pqzxwJoP8sxrWCFYkfBxTQFrQZg+ZKYAZNR80flAZ6L g==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="228600036" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:15 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:15 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:13 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:40 +0200 Subject: [PATCH iproute2-next v3 05/12] dcb: app: modify dcb_app_print_filtered() for dcb-rewr reuse Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-5-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com Where dcb-app requires protocol to be the printed key, dcb-rewr requires it to be the priority. Adapt existing dcb-app print functions for this. dcb_app_print_filtered() has been modified, to take two callbacks; one for printing the entire string (pid and prio), and one for the pid type (dec, hex, dscp, pcp). This saves us for making one dedicated function for each pid type for both app and rewr. Also, printing the colon is now expected to be handled by the print_pid_prio() callback. Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/dcb_app.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index a8f3424db9f7..aa248cc40bdf 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -434,7 +434,9 @@ static int dcb_app_print_pid_pcp(__u16 protocol) static void dcb_app_print_filtered(const struct dcb_app_table *tab, bool (*filter)(const struct dcb_app *), - int (*print_key)(__u16 protocol), + void (*print_pid_prio)(int (*print_pid)(__u16), + const struct dcb_app *), + int (*print_pid)(__u16 protocol), const char *json_name, const char *fp_name) { @@ -453,8 +455,8 @@ static void dcb_app_print_filtered(const struct dcb_app_table *tab, } open_json_array(PRINT_JSON, NULL); - print_key(app->protocol); - print_uint(PRINT_ANY, NULL, ":%u ", app->priority); + print_pid_prio(print_pid, app); + print_string(PRINT_ANY, NULL, "%s", " "); close_json_array(PRINT_JSON, NULL); } @@ -464,9 +466,17 @@ static void dcb_app_print_filtered(const struct dcb_app_table *tab, } } +static void dcb_app_print_pid_prio(int (*print_pid)(__u16 protocol), + const struct dcb_app *app) +{ + print_pid(app->protocol); + print_uint(PRINT_ANY, NULL, ":%u", app->priority); +} + static void dcb_app_print_ethtype_prio(const struct dcb_app_table *tab) { - dcb_app_print_filtered(tab, dcb_app_is_ethtype, dcb_app_print_pid_hex, + dcb_app_print_filtered(tab, dcb_app_is_ethtype, + dcb_app_print_pid_prio, dcb_app_print_pid_hex, "ethtype_prio", "ethtype-prio"); } @@ -474,8 +484,9 @@ static void dcb_app_print_pcp_prio(const struct dcb *dcb, const struct dcb_app_table *tab) { dcb_app_print_filtered(tab, dcb_app_is_pcp, - dcb->numeric ? dcb_app_print_pid_dec - : dcb_app_print_pid_pcp, + dcb_app_print_pid_prio, + dcb->numeric ? dcb_app_print_pid_dec : + dcb_app_print_pid_pcp, "pcp_prio", "pcp-prio"); } @@ -483,26 +494,30 @@ static void dcb_app_print_dscp_prio(const struct dcb *dcb, const struct dcb_app_table *tab) { dcb_app_print_filtered(tab, dcb_app_is_dscp, - dcb->numeric ? dcb_app_print_pid_dec - : dcb_app_print_pid_dscp, + dcb_app_print_pid_prio, + dcb->numeric ? dcb_app_print_pid_dec : + dcb_app_print_pid_dscp, "dscp_prio", "dscp-prio"); } static void dcb_app_print_stream_port_prio(const struct dcb_app_table *tab) { - dcb_app_print_filtered(tab, dcb_app_is_stream_port, dcb_app_print_pid_dec, + dcb_app_print_filtered(tab, dcb_app_is_stream_port, + dcb_app_print_pid_prio, dcb_app_print_pid_dec, "stream_port_prio", "stream-port-prio"); } static void dcb_app_print_dgram_port_prio(const struct dcb_app_table *tab) { - dcb_app_print_filtered(tab, dcb_app_is_dgram_port, dcb_app_print_pid_dec, + dcb_app_print_filtered(tab, dcb_app_is_dgram_port, + dcb_app_print_pid_prio, dcb_app_print_pid_dec, "dgram_port_prio", "dgram-port-prio"); } static void dcb_app_print_port_prio(const struct dcb_app_table *tab) { - dcb_app_print_filtered(tab, dcb_app_is_port, dcb_app_print_pid_dec, + dcb_app_print_filtered(tab, dcb_app_is_port, + dcb_app_print_pid_prio, dcb_app_print_pid_dec, "port_prio", "port-prio"); } From patchwork Tue Jun 6 07:19:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268410 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2446811CB7 for ; Tue, 6 Jun 2023 07:20:33 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1388E40 for ; Tue, 6 Jun 2023 00:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036017; x=1717572017; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=/b0vlFBMmpaGtvdJcraK0mZPYL+hb/4YXfWKj4Xsn0g=; b=jkR/aOdw4mwNVxAvzFKnGDSl6/2BBr6usj/126HxQgGxSwVM+enhOZUi e03qRkO387P/SFeCL/ITk31IOjCBtWv8xJ/EYS8yk7KYpq6KJvR0TJ9OQ 1oawrBsFq8zU0UfHX7aW/LNhPPEiznwJy1VTpRpD7kvvFTgy9Ic8BWLbZ oqoICnxD0BjnavOu7kI6ot69vqL/WnT6lnK29nogbD7WVrcP8F8qgfDnO hauF6DEWZ2wW7PdKzX4KEqYg+evXj1roAOTEgOLrXB0jz70O+9kzOhy70 BLXX1jhkttrONTJnKFAYqXTSxw07MxkArw6bM+N+Ru09rpvUiyTcAIKlI w==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="216378703" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:17 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:16 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:15 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:41 +0200 Subject: [PATCH iproute2-next v3 06/12] dcb: app: modify dcb_app_table_remove_replaced() for dcb-rewr reuse Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-6-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com When doing a replace command, entries are checked against selector and protocol. Rewrite requires the check to be against selector and priority. Adapt the existing dcb_app_table_remove_replace function for this, by using callback functions for selector, pid and prio checks. Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/dcb_app.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index aa248cc40bdf..4b309016fb65 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -153,8 +153,16 @@ static void dcb_app_table_remove_existing(struct dcb_app_table *a, a->n_apps = ja; } +static bool dcb_app_pid_eq(const struct dcb_app *aa, const struct dcb_app *ab) +{ + return aa->selector == ab->selector && + aa->protocol == ab->protocol; +} + static void dcb_app_table_remove_replaced(struct dcb_app_table *a, - const struct dcb_app_table *b) + const struct dcb_app_table *b, + bool (*key_eq)(const struct dcb_app *aa, + const struct dcb_app *ab)) { size_t ia, ja; size_t ib; @@ -167,13 +175,13 @@ static void dcb_app_table_remove_replaced(struct dcb_app_table *a, for (ib = 0; ib < b->n_apps; ib++) { const struct dcb_app *ab = &b->apps[ib]; - if (aa->selector == ab->selector && - aa->protocol == ab->protocol) + if (key_eq(aa, ab)) present = true; else continue; - if (aa->priority == ab->priority) { + if (aa->protocol == ab->protocol && + aa->priority == ab->priority) { found = true; break; } @@ -892,7 +900,7 @@ static int dcb_cmd_app_replace(struct dcb *dcb, const char *dev, int argc, char } /* Remove the obsolete entries. */ - dcb_app_table_remove_replaced(&orig, &tab); + dcb_app_table_remove_replaced(&orig, &tab, dcb_app_pid_eq); ret = dcb_app_add_del(dcb, dev, DCB_CMD_IEEE_DEL, &orig, NULL); if (ret != 0) { fprintf(stderr, "Could not remove replaced APP entries\n"); From patchwork Tue Jun 6 07:19:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268412 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5174E24132 for ; Tue, 6 Jun 2023 07:20:34 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6203DE5E for ; Tue, 6 Jun 2023 00:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036019; x=1717572019; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=0aLnW9TTygaOt5fQ/F0TLi/eHZkLYdaHltxKvVsC+1Y=; b=m0OpFc25FSruExk5Vp18149H+cZMvi5ftEhF8ahywDGPiuoJYA0DxIm2 j30zcqrmVV2HH7c02YE+Ln0+l4+3DwFBwobXgDt1AaiKmZ2w/xiUSoLBy qGsH5AJQfD12DwRgT+OKSijO4fgWnU3NvAfoh5RwkdGZLIfH1Ss0HLgvK lu88JMr/h7Pmu3BZAXl70VBqdiDHxgKPMW8S/NUnLM44v90GnUefEDGh+ o+uxd+t2/z+sPSavZFSprMyjjtR9VfUvSU3XFsX6Ouq8XmIMKU0VFxWQX hBbzN9KJ4Qh1T8nn3XPoizKvNgFmh7vWXlOs30wrP+7oWgXpau7M7x9Gw A==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="219027996" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:18 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:18 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:17 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:42 +0200 Subject: [PATCH iproute2-next v3 07/12] dcb: app: expose functions required by dcb-rewr Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-7-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com In preparation for the dcb-rewr implementation, expose required functions, and structs. Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/dcb.h | 49 ++++++++++++++++++++++++++++++++++++++++++++ dcb/dcb_app.c | 66 +++++++++++++++++++++++------------------------------------ 2 files changed, 75 insertions(+), 40 deletions(-) diff --git a/dcb/dcb.h b/dcb/dcb.h index d40664f29dad..82ad72bc9ff3 100644 --- a/dcb/dcb.h +++ b/dcb/dcb.h @@ -56,11 +56,60 @@ void dcb_print_array_kw(const __u8 *array, size_t array_size, /* dcb_app.c */ +struct dcb_app_table { + struct dcb_app *apps; + size_t n_apps; + int attr; +}; + +struct dcb_app_parse_mapping { + __u8 selector; + struct dcb_app_table *tab; + int err; +}; + +#define DCB_APP_PCP_MAX 15 + int dcb_cmd_app(struct dcb *dcb, int argc, char **argv); + +int dcb_app_get(struct dcb *dcb, const char *dev, struct dcb_app_table *tab); +int dcb_app_add_del(struct dcb *dcb, const char *dev, int command, + const struct dcb_app_table *tab, + bool (*filter)(const struct dcb_app *)); + +bool dcb_app_is_dscp(const struct dcb_app *app); +bool dcb_app_is_pcp(const struct dcb_app *app); + +int dcb_app_print_pid_dscp(__u16 protocol); +int dcb_app_print_pid_pcp(__u16 protocol); +int dcb_app_print_pid_dec(__u16 protocol); +void dcb_app_print_filtered(const struct dcb_app_table *tab, + bool (*filter)(const struct dcb_app *), + void (*print_pid_prio)(int (*print_pid)(__u16), + const struct dcb_app *), + int (*print_pid)(__u16 protocol), + const char *json_name, + const char *fp_name); + enum ieee_attrs_app dcb_app_attr_type_get(__u8 selector); bool dcb_app_attr_type_validate(enum ieee_attrs_app type); bool dcb_app_selector_validate(enum ieee_attrs_app type, __u8 selector); +int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app); +int dcb_app_table_copy(struct dcb_app_table *a, + const struct dcb_app_table *b); +void dcb_app_table_sort(struct dcb_app_table *tab); +void dcb_app_table_fini(struct dcb_app_table *tab); +void dcb_app_table_remove_existing(struct dcb_app_table *a, + const struct dcb_app_table *b); +void dcb_app_table_remove_replaced(struct dcb_app_table *a, + const struct dcb_app_table *b, + bool (*key_eq)(const struct dcb_app *aa, + const struct dcb_app *ab)); + +int dcb_app_parse_pcp(__u32 *key, const char *arg); +int dcb_app_parse_dscp(__u32 *key, const char *arg); + /* dcb_apptrust.c */ int dcb_cmd_apptrust(struct dcb *dcb, int argc, char **argv); diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index 4b309016fb65..9c2727eff7d8 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -10,8 +10,6 @@ #include "utils.h" #include "rt_names.h" -#define DCB_APP_PCP_MAX 15 - static const char *const pcp_names[DCB_APP_PCP_MAX + 1] = { "0nd", "1nd", "2nd", "3nd", "4nd", "5nd", "6nd", "7nd", "0de", "1de", "2de", "3de", "4de", "5de", "6de", "7de" @@ -68,12 +66,6 @@ static void dcb_app_help(void) dcb_app_help_add(); } -struct dcb_app_table { - struct dcb_app *apps; - size_t n_apps; - int attr; -}; - enum ieee_attrs_app dcb_app_attr_type_get(__u8 selector) { switch (selector) { @@ -106,12 +98,12 @@ bool dcb_app_selector_validate(enum ieee_attrs_app type, __u8 selector) return dcb_app_attr_type_get(selector) == type; } -static void dcb_app_table_fini(struct dcb_app_table *tab) +void dcb_app_table_fini(struct dcb_app_table *tab) { free(tab->apps); } -static int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app) +int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app) { struct dcb_app *apps = realloc(tab->apps, (tab->n_apps + 1) * sizeof(*tab->apps)); @@ -125,8 +117,8 @@ static int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app) return 0; } -static void dcb_app_table_remove_existing(struct dcb_app_table *a, - const struct dcb_app_table *b) +void dcb_app_table_remove_existing(struct dcb_app_table *a, + const struct dcb_app_table *b) { size_t ia, ja; size_t ib; @@ -159,7 +151,7 @@ static bool dcb_app_pid_eq(const struct dcb_app *aa, const struct dcb_app *ab) aa->protocol == ab->protocol; } -static void dcb_app_table_remove_replaced(struct dcb_app_table *a, +void dcb_app_table_remove_replaced(struct dcb_app_table *a, const struct dcb_app_table *b, bool (*key_eq)(const struct dcb_app *aa, const struct dcb_app *ab)) @@ -198,8 +190,8 @@ static void dcb_app_table_remove_replaced(struct dcb_app_table *a, a->n_apps = ja; } -static int dcb_app_table_copy(struct dcb_app_table *a, - const struct dcb_app_table *b) +int dcb_app_table_copy(struct dcb_app_table *a, + const struct dcb_app_table *b) { size_t i; int ret; @@ -226,17 +218,11 @@ static int dcb_app_cmp_cb(const void *a, const void *b) return dcb_app_cmp(a, b); } -static void dcb_app_table_sort(struct dcb_app_table *tab) +void dcb_app_table_sort(struct dcb_app_table *tab) { qsort(tab->apps, tab->n_apps, sizeof(*tab->apps), dcb_app_cmp_cb); } -struct dcb_app_parse_mapping { - __u8 selector; - struct dcb_app_table *tab; - int err; -}; - static void dcb_app_parse_mapping_cb(__u32 key, __u64 value, void *data) { struct dcb_app_parse_mapping *pm = data; @@ -269,7 +255,7 @@ static int dcb_app_parse_mapping_ethtype_prio(__u32 key, char *value, void *data dcb_app_parse_mapping_cb, data); } -static int dcb_app_parse_pcp(__u32 *key, const char *arg) +int dcb_app_parse_pcp(__u32 *key, const char *arg) { int i; @@ -295,7 +281,7 @@ static int dcb_app_parse_mapping_pcp_prio(__u32 key, char *value, void *data) dcb_app_parse_mapping_cb, data); } -static int dcb_app_parse_dscp(__u32 *key, const char *arg) +int dcb_app_parse_dscp(__u32 *key, const char *arg) { if (parse_mapping_num_all(key, arg) == 0) return 0; @@ -386,12 +372,12 @@ static bool dcb_app_is_default(const struct dcb_app *app) app->protocol == 0; } -static bool dcb_app_is_dscp(const struct dcb_app *app) +bool dcb_app_is_dscp(const struct dcb_app *app) { return app->selector == IEEE_8021QAZ_APP_SEL_DSCP; } -static bool dcb_app_is_pcp(const struct dcb_app *app) +bool dcb_app_is_pcp(const struct dcb_app *app) { return app->selector == DCB_APP_SEL_PCP; } @@ -411,7 +397,7 @@ static bool dcb_app_is_port(const struct dcb_app *app) return app->selector == IEEE_8021QAZ_APP_SEL_ANY; } -static int dcb_app_print_pid_dec(__u16 protocol) +int dcb_app_print_pid_dec(__u16 protocol) { return print_uint(PRINT_ANY, NULL, "%u", protocol); } @@ -421,7 +407,7 @@ static int dcb_app_print_pid_hex(__u16 protocol) return print_uint(PRINT_ANY, NULL, "%x", protocol); } -static int dcb_app_print_pid_dscp(__u16 protocol) +int dcb_app_print_pid_dscp(__u16 protocol) { const char *name = rtnl_dsfield_get_name(protocol << 2); @@ -431,7 +417,7 @@ static int dcb_app_print_pid_dscp(__u16 protocol) return print_uint(PRINT_ANY, NULL, "%u", protocol); } -static int dcb_app_print_pid_pcp(__u16 protocol) +int dcb_app_print_pid_pcp(__u16 protocol) { /* Print in numerical form, if protocol value is out-of-range */ if (protocol > DCB_APP_PCP_MAX) @@ -440,13 +426,13 @@ static int dcb_app_print_pid_pcp(__u16 protocol) return print_string(PRINT_ANY, NULL, "%s", pcp_names[protocol]); } -static void dcb_app_print_filtered(const struct dcb_app_table *tab, - bool (*filter)(const struct dcb_app *), - void (*print_pid_prio)(int (*print_pid)(__u16), - const struct dcb_app *), - int (*print_pid)(__u16 protocol), - const char *json_name, - const char *fp_name) +void dcb_app_print_filtered(const struct dcb_app_table *tab, + bool (*filter)(const struct dcb_app *), + void (*print_pid_prio)(int (*print_pid)(__u16), + const struct dcb_app *), + int (*print_pid)(__u16 protocol), + const char *json_name, + const char *fp_name) { bool first = true; size_t i; @@ -601,7 +587,7 @@ static int dcb_app_get_table_attr_cb(const struct nlattr *attr, void *data) return MNL_CB_OK; } -static int dcb_app_get(struct dcb *dcb, const char *dev, struct dcb_app_table *tab) +int dcb_app_get(struct dcb *dcb, const char *dev, struct dcb_app_table *tab) { uint16_t payload_len; void *payload; @@ -644,9 +630,9 @@ static int dcb_app_add_del_cb(struct dcb *dcb, struct nlmsghdr *nlh, void *data) return 0; } -static int dcb_app_add_del(struct dcb *dcb, const char *dev, int command, - const struct dcb_app_table *tab, - bool (*filter)(const struct dcb_app *)) +int dcb_app_add_del(struct dcb *dcb, const char *dev, int command, + const struct dcb_app_table *tab, + bool (*filter)(const struct dcb_app *)) { struct dcb_app_add_del add_del = { .tab = tab, From patchwork Tue Jun 6 07:19:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268414 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C1D028C24 for ; Tue, 6 Jun 2023 07:20:35 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4C95109 for ; Tue, 6 Jun 2023 00:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036020; x=1717572020; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=J6GCvOrPuS54o05RRMCY2J9/zvK3g8OKDrg8nGJfn8s=; b=JHNrRHKpUVFZRkcbVik1S4vfFsmV7eRoGBACvOkSGM5/ldxKA/g3m67A fYOT2EZqBnyuoiSCnSILVBpwuMU8ZEf5zpMGZt4kf/vR29IVswtRBW1Jf BDxQW6ADYIJD6NN53WHvJ9P+0uz5BQrRtTEKjGnkqvggggH6mOCNoSpqw /CeDJIUq18J8+XWYg6gOnJuCJGx8R5Oyc953rZ7P0Yqw+ssAcevEQDZIu jLaaV2aXXqd8IBQv5UYPHXTLpeXisrrnyMGeeNG+4A8Rr7D3NKYSaTlUq LSOCPFoSuYLsrEpMYXvMeA5nJEzlHNEy3/EyUH0LMTOpR7HpMV94UaT7y w==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="228600045" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:20 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:20 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:18 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:43 +0200 Subject: [PATCH iproute2-next v3 08/12] dcb: rewr: add new dcb-rewr subcommand Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-8-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com Add a new subcommand 'rewr' for configuring the in-kernel DCB rewrite table. The rewrite table of the kernel is similar to the APP table, therefore, much of the existing bookkeeping code from dcb-app, can be reused in the dcb-rewr implementation. Initially, only support for configuring PCP and DSCP-based rewrite has been added. Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/Makefile | 3 +- dcb/dcb.c | 4 +- dcb/dcb.h | 4 + dcb/dcb_rewr.c | 363 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 372 insertions(+), 2 deletions(-) diff --git a/dcb/Makefile b/dcb/Makefile index dd41a559a0c8..10794c9dc19f 100644 --- a/dcb/Makefile +++ b/dcb/Makefile @@ -8,7 +8,8 @@ DCBOBJ = dcb.o \ dcb_ets.o \ dcb_maxrate.o \ dcb_pfc.o \ - dcb_apptrust.o + dcb_apptrust.o \ + dcb_rewr.o TARGETS += dcb LDLIBS += -lm diff --git a/dcb/dcb.c b/dcb/dcb.c index 9b996abac529..fe0a0f04143d 100644 --- a/dcb/dcb.c +++ b/dcb/dcb.c @@ -470,7 +470,7 @@ static void dcb_help(void) fprintf(stderr, "Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n" " dcb [ -f | --force ] { -b | --batch } filename [ -n | --netns ] netnsname\n" - "where OBJECT := { app | apptrust | buffer | dcbx | ets | maxrate | pfc }\n" + "where OBJECT := { app | apptrust | buffer | dcbx | ets | maxrate | pfc | rewr }\n" " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" " | -N | --Numeric | -p | --pretty\n" " | -s | --statistics | -v | --verbose]\n"); @@ -485,6 +485,8 @@ static int dcb_cmd(struct dcb *dcb, int argc, char **argv) return dcb_cmd_app(dcb, argc - 1, argv + 1); } else if (strcmp(*argv, "apptrust") == 0) { return dcb_cmd_apptrust(dcb, argc - 1, argv + 1); + } else if (strcmp(*argv, "rewr") == 0) { + return dcb_cmd_rewr(dcb, argc - 1, argv + 1); } else if (matches(*argv, "buffer") == 0) { return dcb_cmd_buffer(dcb, argc - 1, argv + 1); } else if (matches(*argv, "dcbx") == 0) { diff --git a/dcb/dcb.h b/dcb/dcb.h index 82ad72bc9ff3..ff11a122ba37 100644 --- a/dcb/dcb.h +++ b/dcb/dcb.h @@ -54,6 +54,10 @@ void dcb_print_array_on_off(const __u8 *array, size_t size); void dcb_print_array_kw(const __u8 *array, size_t array_size, const char *const kw[], size_t kw_size); +/* dcp_rewr.c */ + +int dcb_cmd_rewr(struct dcb *dcb, int argc, char **argv); + /* dcb_app.c */ struct dcb_app_table { diff --git a/dcb/dcb_rewr.c b/dcb/dcb_rewr.c new file mode 100644 index 000000000000..facbdbe664a4 --- /dev/null +++ b/dcb/dcb_rewr.c @@ -0,0 +1,363 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include + +#include "dcb.h" +#include "utils.h" + +static void dcb_rewr_help_add(void) +{ + fprintf(stderr, + "Usage: dcb rewr { add | del | replace } dev STRING\n" + " [ prio-pcp PRIO:PCP ]\n" + " [ prio-dscp PRIO:DSCP ]\n" + "\n" + " where PRIO := { 0 .. 7 }\n" + " PCP := { 0(nd/de) .. 7(nd/de) }\n" + " DSCP := { 0 .. 63 }\n" + "\n" + ); +} + +static void dcb_rewr_help_show_flush(void) +{ + fprintf(stderr, + "Usage: dcb rewr { show | flush } dev STRING\n" + " [ prio-pcp ]\n" + " [ prio-dscp ]\n" + "\n" + ); +} + +static void dcb_rewr_help(void) +{ + fprintf(stderr, + "Usage: dcb rewr help\n" + "\n" + ); + dcb_rewr_help_show_flush(); + dcb_rewr_help_add(); +} + +static void dcb_rewr_parse_mapping_cb(__u32 key, __u64 value, void *data) +{ + struct dcb_app_parse_mapping *pm = data; + struct dcb_app app = { + .selector = pm->selector, + .priority = key, + .protocol = value, + }; + + if (pm->err) + return; + + pm->err = dcb_app_table_push(pm->tab, &app); +} + +static int dcb_rewr_parse_mapping_prio_pcp(__u32 key, char *value, void *data) +{ + __u32 pcp; + + if (dcb_app_parse_pcp(&pcp, value)) + return -EINVAL; + + return dcb_parse_mapping("PRIO", key, IEEE_8021QAZ_MAX_TCS - 1, + "PCP", pcp, DCB_APP_PCP_MAX, + dcb_rewr_parse_mapping_cb, data); +} + +static int dcb_rewr_parse_mapping_prio_dscp(__u32 key, char *value, void *data) +{ + __u32 dscp; + + if (dcb_app_parse_dscp(&dscp, value)) + return -EINVAL; + + return dcb_parse_mapping("PRIO", key, IEEE_8021QAZ_MAX_TCS - 1, + "DSCP", dscp, 63, + dcb_rewr_parse_mapping_cb, data); +} + +static void dcb_rewr_print_prio_pid(int (*print_pid)(__u16 protocol), + const struct dcb_app *app) +{ + print_uint(PRINT_ANY, NULL, "%u:", app->priority); + print_pid(app->protocol); +} + +static void dcb_rewr_print_prio_pcp(const struct dcb *dcb, + const struct dcb_app_table *tab) +{ + dcb_app_print_filtered(tab, dcb_app_is_pcp, + dcb_rewr_print_prio_pid, + dcb->numeric ? dcb_app_print_pid_dec : + dcb_app_print_pid_pcp, + "prio_pcp", "prio-pcp"); +} + +static void dcb_rewr_print_prio_dscp(const struct dcb *dcb, + const struct dcb_app_table *tab) +{ + dcb_app_print_filtered(tab, dcb_app_is_dscp, + dcb_rewr_print_prio_pid, + dcb->numeric ? dcb_app_print_pid_dec : + dcb_app_print_pid_dscp, + "prio_dscp", "prio-dscp"); +} + +static void dcb_rewr_print(const struct dcb *dcb, + const struct dcb_app_table *tab) +{ + dcb_rewr_print_prio_pcp(dcb, tab); + dcb_rewr_print_prio_dscp(dcb, tab); +} + +static bool dcb_rewr_prio_eq(const struct dcb_app *aa, const struct dcb_app *ab) +{ + return aa->selector == ab->selector && + aa->priority == ab->priority; +} + +static int dcb_cmd_rewr_parse_add_del(struct dcb *dcb, const char *dev, + int argc, char **argv, + struct dcb_app_table *tab) +{ + struct dcb_app_parse_mapping pm = { + .tab = tab, + }; + int ret; + + if (!argc) { + dcb_rewr_help_add(); + return 0; + } + + do { + if (strcmp(*argv, "help") == 0) { + dcb_rewr_help_add(); + return 0; + } else if (strcmp(*argv, "prio-pcp") == 0) { + NEXT_ARG(); + pm.selector = DCB_APP_SEL_PCP; + ret = parse_mapping(&argc, &argv, false, + &dcb_rewr_parse_mapping_prio_pcp, + &pm); + } else if (strcmp(*argv, "prio-dscp") == 0) { + NEXT_ARG(); + pm.selector = IEEE_8021QAZ_APP_SEL_DSCP; + ret = parse_mapping(&argc, &argv, false, + &dcb_rewr_parse_mapping_prio_dscp, + &pm); + } else { + fprintf(stderr, "What is \"%s\"?\n", *argv); + dcb_rewr_help_add(); + return -EINVAL; + } + + if (ret != 0) { + fprintf(stderr, "Invalid mapping %s\n", *argv); + return ret; + } + if (pm.err) + return pm.err; + } while (argc > 0); + + return 0; +} + +static int dcb_cmd_rewr_add(struct dcb *dcb, const char *dev, int argc, + char **argv) +{ + struct dcb_app_table tab = { .attr = DCB_ATTR_DCB_REWR_TABLE }; + int ret; + + ret = dcb_cmd_rewr_parse_add_del(dcb, dev, argc, argv, &tab); + if (ret != 0) + return ret; + + ret = dcb_app_add_del(dcb, dev, DCB_CMD_IEEE_SET, &tab, NULL); + dcb_app_table_fini(&tab); + return ret; +} + +static int dcb_cmd_rewr_del(struct dcb *dcb, const char *dev, int argc, + char **argv) +{ + struct dcb_app_table tab = { .attr = DCB_ATTR_DCB_REWR_TABLE }; + int ret; + + ret = dcb_cmd_rewr_parse_add_del(dcb, dev, argc, argv, &tab); + if (ret != 0) + return ret; + + ret = dcb_app_add_del(dcb, dev, DCB_CMD_IEEE_DEL, &tab, NULL); + dcb_app_table_fini(&tab); + return ret; +} + +static int dcb_cmd_rewr_replace(struct dcb *dcb, const char *dev, int argc, + char **argv) +{ + struct dcb_app_table orig = { .attr = DCB_ATTR_DCB_REWR_TABLE }; + struct dcb_app_table tab = { .attr = DCB_ATTR_DCB_REWR_TABLE }; + struct dcb_app_table new = { .attr = DCB_ATTR_DCB_REWR_TABLE }; + int ret; + + ret = dcb_app_get(dcb, dev, &orig); + if (ret != 0) + return ret; + + ret = dcb_cmd_rewr_parse_add_del(dcb, dev, argc, argv, &tab); + if (ret != 0) + goto out; + + /* Attempts to add an existing entry would be rejected, so drop + * these entries from tab. + */ + ret = dcb_app_table_copy(&new, &tab); + if (ret != 0) + goto out; + dcb_app_table_remove_existing(&new, &orig); + + ret = dcb_app_add_del(dcb, dev, DCB_CMD_IEEE_SET, &new, NULL); + if (ret != 0) { + fprintf(stderr, "Could not add new rewrite entries\n"); + goto out; + } + + /* Remove the obsolete entries. */ + dcb_app_table_remove_replaced(&orig, &tab, dcb_rewr_prio_eq); + ret = dcb_app_add_del(dcb, dev, DCB_CMD_IEEE_DEL, &orig, NULL); + if (ret != 0) { + fprintf(stderr, "Could not remove replaced rewrite entries\n"); + goto out; + } + +out: + dcb_app_table_fini(&new); + dcb_app_table_fini(&tab); + dcb_app_table_fini(&orig); + return 0; +} + +static int dcb_cmd_rewr_show(struct dcb *dcb, const char *dev, int argc, + char **argv) +{ + struct dcb_app_table tab = { .attr = DCB_ATTR_DCB_REWR_TABLE }; + int ret; + + ret = dcb_app_get(dcb, dev, &tab); + if (ret != 0) + return ret; + + dcb_app_table_sort(&tab); + + open_json_object(NULL); + + if (!argc) { + dcb_rewr_print(dcb, &tab); + goto out; + } + + do { + if (strcmp(*argv, "help") == 0) { + dcb_rewr_help_show_flush(); + goto out; + } else if (strcmp(*argv, "prio-pcp") == 0) { + dcb_rewr_print_prio_pcp(dcb, &tab); + } else if (strcmp(*argv, "prio-dscp") == 0) { + dcb_rewr_print_prio_dscp(dcb, &tab); + } else { + fprintf(stderr, "What is \"%s\"?\n", *argv); + dcb_rewr_help_show_flush(); + ret = -EINVAL; + goto out; + } + + NEXT_ARG_FWD(); + } while (argc > 0); + +out: + close_json_object(); + dcb_app_table_fini(&tab); + return ret; +} + +static int dcb_cmd_rewr_flush(struct dcb *dcb, const char *dev, int argc, + char **argv) +{ + struct dcb_app_table tab = { .attr = DCB_ATTR_DCB_REWR_TABLE }; + int ret; + + ret = dcb_app_get(dcb, dev, &tab); + if (ret != 0) + return ret; + + if (!argc) { + ret = dcb_app_add_del(dcb, dev, DCB_CMD_IEEE_DEL, &tab, + NULL); + goto out; + } + + do { + if (strcmp(*argv, "help") == 0) { + dcb_rewr_help_show_flush(); + goto out; + } else if (strcmp(*argv, "prio-pcp") == 0) { + ret = dcb_app_add_del(dcb, dev, DCB_CMD_IEEE_DEL, &tab, + &dcb_app_is_pcp); + if (ret != 0) + goto out; + } else if (strcmp(*argv, "prio-dscp") == 0) { + ret = dcb_app_add_del(dcb, dev, DCB_CMD_IEEE_DEL, &tab, + &dcb_app_is_dscp); + if (ret != 0) + goto out; + } else { + fprintf(stderr, "What is \"%s\"?\n", *argv); + dcb_rewr_help_show_flush(); + ret = -EINVAL; + goto out; + } + + NEXT_ARG_FWD(); + } while (argc > 0); + +out: + dcb_app_table_fini(&tab); + return ret; +} + +int dcb_cmd_rewr(struct dcb *dcb, int argc, char **argv) +{ + if (!argc || strcmp(*argv, "help") == 0) { + dcb_rewr_help(); + return 0; + } else if (strcmp(*argv, "show") == 0) { + NEXT_ARG_FWD(); + return dcb_cmd_parse_dev(dcb, argc, argv, dcb_cmd_rewr_show, + dcb_rewr_help_show_flush); + } else if (strcmp(*argv, "flush") == 0) { + NEXT_ARG_FWD(); + return dcb_cmd_parse_dev(dcb, argc, argv, dcb_cmd_rewr_flush, + dcb_rewr_help_show_flush); + } else if (strcmp(*argv, "add") == 0) { + NEXT_ARG_FWD(); + return dcb_cmd_parse_dev(dcb, argc, argv, dcb_cmd_rewr_add, + dcb_rewr_help_add); + } else if (strcmp(*argv, "del") == 0) { + NEXT_ARG_FWD(); + return dcb_cmd_parse_dev(dcb, argc, argv, dcb_cmd_rewr_del, + dcb_rewr_help_add); + } else if (strcmp(*argv, "replace") == 0) { + NEXT_ARG_FWD(); + return dcb_cmd_parse_dev(dcb, argc, argv, dcb_cmd_rewr_replace, + dcb_rewr_help_add); + } else { + fprintf(stderr, "What is \"%s\"?\n", *argv); + dcb_rewr_help(); + return -EINVAL; + } +} From patchwork Tue Jun 6 07:19:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268413 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBDCE611B for ; Tue, 6 Jun 2023 07:20:35 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F50AE60 for ; Tue, 6 Jun 2023 00:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036023; x=1717572023; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=zN+PjeDzSFDEdv5Jhk42nP1VBAljb2fleW0XlIZxKBc=; b=Zx1XQ3Q6ct7a4U+hKpOmdBtDzFwuIF2qKr/5kOzl0ub0MqYBDZglLZG3 dxZrQz0hhkCXwU4V30s9dOnANMJo+oU4Fx67HYt7Em37LcfYYZ2jdJ6rj vW4hrl0xaKWOfQQVj5CdZscIDiEaZB26Sl0K3gLcqFc3hqYnO7t6AqyRp 1UgEkp6/WHBEnO4s+jSuQJiJQCmhzuapFQ6DU2yY7Qh+yd3XJ9hCAoqCK +51ilQGCAexOP6Ssm0D8kcMPkiBLn32D9so+5QEs0/ymzIb5RW/x5TxXO Ubzc+VOvayzFGDLjN9uJk9QmDgBtjmZxJ/PBvMgYKAl/1aGxAY/x0rhCc g==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="216983824" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:23 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:22 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:20 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:44 +0200 Subject: [PATCH iproute2-next v3 09/12] dcb: rewr: add symbol for max DSCP value Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-9-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com A symbol, DCB_APP_PCP_MAX, for maximum PCP value, already exists. Lets add a symbol DCB_APP_DSCP_MAX and update accordingly. Signed-off-by: Daniel Machon Reviewed-by: Petr Machata --- dcb/dcb.h | 1 + dcb/dcb_app.c | 2 +- dcb/dcb_rewr.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dcb/dcb.h b/dcb/dcb.h index ff11a122ba37..b2e8e89f7701 100644 --- a/dcb/dcb.h +++ b/dcb/dcb.h @@ -73,6 +73,7 @@ struct dcb_app_parse_mapping { }; #define DCB_APP_PCP_MAX 15 +#define DCB_APP_DSCP_MAX 63 int dcb_cmd_app(struct dcb *dcb, int argc, char **argv); diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index 9c2727eff7d8..7040e62cbb47 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -306,7 +306,7 @@ static int dcb_app_parse_mapping_dscp_prio(__u32 key, char *value, void *data) if (get_u8(&prio, value, 0)) return -EINVAL; - return dcb_parse_mapping("DSCP", key, 63, + return dcb_parse_mapping("DSCP", key, DCB_APP_DSCP_MAX, "PRIO", prio, IEEE_8021QAZ_MAX_TCS - 1, dcb_app_parse_mapping_cb, data); } diff --git a/dcb/dcb_rewr.c b/dcb/dcb_rewr.c index facbdbe664a4..5bb649adce24 100644 --- a/dcb/dcb_rewr.c +++ b/dcb/dcb_rewr.c @@ -76,7 +76,7 @@ static int dcb_rewr_parse_mapping_prio_dscp(__u32 key, char *value, void *data) return -EINVAL; return dcb_parse_mapping("PRIO", key, IEEE_8021QAZ_MAX_TCS - 1, - "DSCP", dscp, 63, + "DSCP", dscp, DCB_APP_DSCP_MAX, dcb_rewr_parse_mapping_cb, data); } From patchwork Tue Jun 6 07:19:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268415 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3375C28C24 for ; Tue, 6 Jun 2023 07:20:37 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB028E5D for ; Tue, 6 Jun 2023 00:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036024; x=1717572024; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=sfMcENT5sSSg8ReQv/7vQ4p1CD8bMZbraTu/udkjZQU=; b=v4p/FgRknkBwqE68u4fdCdkq2VkRDQCdvVhrCo9v0UwI7+SsgmVzhzhX VePeHXCGabkLf0v4ZoNT5b10UZSn0oiScssDKgtLHzgxQbRIy8qHMblhf 3MNVN0/CXjSJZ715iYU/KdHlomy5rF/usJgDIAgcCNlo7jnM0GXdbe/a9 iRlSDByQ4pCivkXBKXW7KE5rw2o5RsyHd/mjEpE1qnARWOjtrQs1Q0TTw bDp9Qn0LAi9vXG1jgVq8al4z+FnQSauLvwgWNHyJMiejRbhKfB7gJAPt2 kzxECFWbpP6nlx4oyxVWVDVDZKyUzq3vN1JwLhZ+sBc6j9SWyYcxJ0JyQ A==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="155720512" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:24 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:23 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:22 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:45 +0200 Subject: [PATCH iproute2-next v3 10/12] man: dcb-rewr: add new manpage for dcb-rewr Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-10-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , , Petr Machata X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com Add a new manpage for dcb-rewr. Most of the content is copied over from dcb-app, as the same set of commands and parameters (in reverse) applies to dcb-rewr. Reviewed-by: Petr Machata Signed-off-by: Daniel Machon --- man/man8/dcb-rewr.8 | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) diff --git a/man/man8/dcb-rewr.8 b/man/man8/dcb-rewr.8 new file mode 100644 index 000000000000..03b59cf4837c --- /dev/null +++ b/man/man8/dcb-rewr.8 @@ -0,0 +1,206 @@ +.TH DCB-REWR 8 "15 may 2023" "iproute2" "Linux" +.SH NAME +dcb-rewr \- show / manipulate the rewrite table of +the DCB (Data Center Bridging) subsystem +.SH SYNOPSIS +.sp +.ad l +.in +8 + +.ti -8 +.B dcb +.RI "[ " OPTIONS " ] " +.B rewr +.RI "{ " COMMAND " | " help " }" +.sp + +.ti -8 +.B dcb rewr " { " show " | " flush " } " dev +.RI DEV +.RB "[ " prio-dscp " ]" +.RB "[ " prio-pcp " ]" + +.ti -8 +.B dcb rewr " { " add " | " del " | " replace " } " dev +.RI DEV +.RB "[ " prio-dscp " " \fIDSCP-MAP\fB " ]" +.RB "[ " prio-pcp " " \fIPCP-MAP\fB " ]" + +.ti -8 +.IR DSCP-MAP " := [ " DSCP-MAP " ] " DSCP-MAPPING + +.ti -8 +.IR DSCP-MAPPING " := " \fIPRIO \fB:\fR "{ " DSCP " | " \fBall\fR " }" + +.ti -8 +.IR PCP-MAP " := [ " PCP-MAP " ] " PCP-MAPPING + +.ti -8 +.IR PCP-MAPPING " := " \fIPRIO \fB:\fR PCP\fR + +.ti -8 +.IR DSCP " := { " \fB0\fR " .. " \fB63\fR " }" + +.ti -8 +.IR PCP " := { " \fB0(nd/de)\fR " .. " \fB7(nd/de)\fR " }" + +.ti -8 +.IR PRIO " := { " \fB0\fR " .. " \fB7\fR " }" + +.SH DESCRIPTION + +.B dcb rewr +is used to configure the rewrite table, in the DCB (Data Center Bridging) +subsystem. The rewrite table is used to rewrite certain values in the packet +headers, based on packet priority. + +DCB rewrite entries are, like DCB APP entries, 3-tuples of selector, protocol +ID, and priority. Selector is an enumeration that picks one of the +prioritization namespaces. Currently, only the DSCP and PCP selector namespaces +are supported by dcb rewr. + +The rewrite table is a list of DCB rewrite rules, that applies to packets +with matching priority. Notably, it is valid to have conflicting rewrite +assignment for the same selector and priority. For example, the set of two +rewrite entries (DSCP, 10, 1) and (DSCP, 11, 1), where packets with priority 1 +should have its DSCP value rewritten to both 10 and 11, form a well-defined +rewrite table. +.B dcb rewr +tool allows low-level management of the rewrite table by adding and deleting +individual rewrite 3-tuples through +.B add +and +.B del +commands. On the other hand, the command +.B replace +does what one would typically want in this situation--first adds the new +configuration, and then removes the obsolete one, so that only one +rewrite rule is in effect for a given selector and priority. + +.SH COMMANDS + +.TP +.B show +Display all entries with a given selector. When no selector is given, shows all +rewrite table entries categorized per selector. + +.TP +.B flush +Remove all entries with a given selector. When no selector is given, removes all +rewrite table entries. + +.TP +.B add +.TQ +.B del +Add and, respectively, remove individual rewrite 3-tuples to and from the DCB +rewrite table. + +.TP +.B replace +Take the list of entries mentioned as parameter, and add those that are not +present in the rewrite table yet. Then remove those entries, whose selector and +priority have been mentioned as parameter, but not with the exact same +protocol ID. This has the effect of, for the given selector and priority, +causing that the table only contains the protocol ID (or ID's) given as +parameter. + +.SH PARAMETERS + +The following table shows parameters in a way that they would be used with +\fBadd\fR, \fBdel\fR and \fBreplace\fR commands. For \fBshow\fR and +\fBflush\fR, the parameter name is to be used as a simple keyword without +further arguments. + +.TP +.B prio-dscp \fIDSCP-MAP +\fIDSCP-MAP\fR uses the array parameter syntax, see +.BR dcb (8) +for details. Keys are priorities, values are DSCP points for traffic +with matching priority. DSCP points can be written either directly as numeric +values, or using symbolic names specified in +.B /etc/iproute2/rt_dsfield +(however note that the file specifies full 8-bit dsfield values, whereas +.B dcb rewr +will only use the higher six bits). +.B dcb rewr show +will similarly format DSCP values as symbolic names if possible. The +command line option +.B -N +turns the show translation off. + +.TP +.B prio-pcp \fIPCP-MAP +\fIPCP-MAP\fR uses the array parameter syntax, see +.BR dcb (8) +for details. Keys are priorities. Values are PCP/DEI for traffic with +matching priority. PCP/DEI values are written as a combination of numeric- and +symbolic values, to accommodate for both. PCP always in numeric form e.g 0 .. +7 and DEI in symbolic form e.g 'de' (drop-eligible), indicating that the DEI +bit is 1 or 'nd' (not-drop-eligible), indicating that the DEI bit is 0. In +combination 1:2de translates to a mapping of priority 1 to PCP=2 and DEI=1. + +.SH EXAMPLE & USAGE + +Add a rule to rewrite DSCP to 0, 24 and 48 for traffic with priority 0, 3 and +6, respectively: +.P +# dcb rewr add dev eth0 prio-dscp 0:0 3:24 6:48 + +Add a rule to rewrite DSCP to 25 for traffic with priority 3: +.P +# dcb rewr add dev eth0 prio-dscp 3:25 +.br +# dcb rewr show dev eth0 prio-dscp +.br +prio-dscp 0:0 3:CS3 3:25 6:CS6 +.br +# dcb -N rewr show dev eth0 prio-dscp +.br +prio-dscp 0:0 3:24 3:25 6:48 + +Reconfigure the table so that only one rule exists for rewriting traffic with +priority 3. + +.P +# dcb rewr replace dev eth0 prio-dscp 3:26 +.br +# dcb rewr -N show dev eth0 prio-dscp +.br +prio-dscp 0:0 3:26 6:48 + +Flush all DSCP rules: + +.P +# dcb rewr flush dev eth0 prio-dscp +.br +# dcb rewr show dev eth0 prio-dscp +.br +(nothing) + +Add a rule to rewrite PCP to 1 and DEI to 0 for traffic with priority 1 and a +rule to rewrite PCP to 2 and DEI to 1 for traffic with priority 2: + +.P +# dcb rewr add dev eth0 prio-pcp 1:1nd 2:2de +.br +# dcb rewr show dev eth0 prio-pcp +.br +prio-pcp 1:1nd 2:2de + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR dcb (8) +.BR dcb-app (8) +.BR dcb-apptrust (8) + +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. You do not have to be +subscribed to the list to send a message there. + +.SH AUTHOR +Daniel Machon From patchwork Tue Jun 6 07:19:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268417 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EE05290E0 for ; Tue, 6 Jun 2023 07:20:37 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C588E53 for ; Tue, 6 Jun 2023 00:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036027; x=1717572027; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=mtr0h9VSvF+WISdT9y1UHZ72141SUkMcfTrhzE1QMIg=; b=wIDrUNjLzOW37TIyVi/PaHzmFAkEnsHQ01NZvomXOMlr5c071/nz0Spp EPChjzToCIb1f6jNCHCfOaU0J0SXsGBOT8qHmYOaiokJhrqquglXHLtr+ sjIskx/EGb+ULUAs6MZgE+cJObh7zvIuvol6dVBVLHarqXQ3FYNO9Rqkq WGqr02TGljMGrcm7uPq+1kK/3SDW+EcBQE1JwbuvGHQLFcuczRDyZIFs9 PX7y2gPhy/pAN5Zh/OV04YB/2Lv2TxoU14UnmIAvBUKqmBLAM3dUuEXZt dfmQ3j43uK3T++JxksLSL+abuyXBQzQchbYuTT4Ou/S+Z5rz4Hlia+Kyq g==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="155720539" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:26 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:25 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:24 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:46 +0200 Subject: [PATCH iproute2-next v3 11/12] man: dcb: add additional references under 'SEE ALSO' Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-11-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , , Petr Machata X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com Add dcb-apptrust and dcb-rewr to the 'SEE ALSO' section of the dcb manpage. Reviewed-by: Petr Machata Signed-off-by: Daniel Machon --- man/man8/dcb.8 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/man/man8/dcb.8 b/man/man8/dcb.8 index 24944b73816b..a1d6505e93b4 100644 --- a/man/man8/dcb.8 +++ b/man/man8/dcb.8 @@ -140,10 +140,12 @@ Exit status is 0 if command was successful or a positive integer upon failure. .SH SEE ALSO .BR dcb-app (8), +.BR dcb-apptrust (8), .BR dcb-buffer (8), .BR dcb-ets (8), .BR dcb-maxrate (8), -.BR dcb-pfc (8) +.BR dcb-pfc (8), +.BR dcb-rewr (8) .br .SH REPORTING BUGS From patchwork Tue Jun 6 07:19:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13268416 X-Patchwork-Delegate: dsahern@gmail.com Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 960D228C24 for ; Tue, 6 Jun 2023 07:20:37 +0000 (UTC) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3944E6A for ; Tue, 6 Jun 2023 00:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686036028; x=1717572028; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=AGv4lPXHU5eJgtaaPAoaB4UPxBdJkz1z16tKjNX6mzI=; b=oUUd7Qd426dF2JDzWVJL4pL8GA/Yiz5YnjEIQV/5BmUTF8fMkg7ETupU 2Dr0dkdGMm+cGg8V8NZkRmTpsrynlDOP9Yzuvn+vTTIoUyE35xffadM6P p7iLmqZp2wDzFiJw/Ikxc2DSN1AoGZlBNktoRZ5tA1PNQf0qQi1Da1Vti fBXyK9P7jifoXmDjScsTDrEoAaGwnXDGw+xLKIO4IG40az3MT+ZJ3FqJ2 b3jhmOQ8n9+XZwoirW8MhLcjo9PS5Y3rSld+JFQaEMFS7Efw8zGeq2M55 VCMH0bAbcK9n5+0z0372YDvyHheJx2YynPmTzo+vzIlaaU8vjVVhkpXeV g==; X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="155720552" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jun 2023 00:20:28 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 6 Jun 2023 00:20:27 -0700 Received: from [10.205.21.38] (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 6 Jun 2023 00:20:26 -0700 From: Daniel Machon Date: Tue, 6 Jun 2023 09:19:47 +0200 Subject: [PATCH iproute2-next v3 12/12] man: dcb-app: clean up a few mistakes Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20230510-dcb-rewr-v3-12-60a766f72e61@microchip.com> References: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> In-Reply-To: <20230510-dcb-rewr-v3-0-60a766f72e61@microchip.com> To: CC: , , , , , Petr Machata X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: dsahern@gmail.com While referencing the dcb-app manpage, I spotted a few mistakes. Lets fix them. Reviewed-by: Petr Machata Signed-off-by: Daniel Machon --- man/man8/dcb-app.8 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/man/man8/dcb-app.8 b/man/man8/dcb-app.8 index ecb38591168e..be505a0be308 100644 --- a/man/man8/dcb-app.8 +++ b/man/man8/dcb-app.8 @@ -1,4 +1,4 @@ -.TH DCB-ETS 8 "6 December 2020" "iproute2" "Linux" +.TH DCB-APP 8 "6 December 2020" "iproute2" "Linux" .SH NAME dcb-app \- show / manipulate application priority table of the DCB (Data Center Bridging) subsystem @@ -26,7 +26,7 @@ the DCB (Data Center Bridging) subsystem .RB "[ " pcp-prio " ]" .ti -8 -.B dcb ets " { " add " | " del " | " replace " } " dev +.B dcb app " { " add " | " del " | " replace " } " dev .RI DEV .RB "[ " default-prio " " \fIPRIO-LIST\fB " ]" .RB "[ " ethtype-prio " " \fIET-MAP\fB " ]" @@ -106,7 +106,7 @@ individual APP 3-tuples through .B add and .B del -commands. On the other other hand, the command +commands. On the other hand, the command .B replace does what one would typically want in this situation--first adds the new configuration, and then removes the obsolete one, so that only one @@ -184,7 +184,7 @@ for details. Keys are DSCP points, values are priorities assigned to traffic with matching DSCP. DSCP points can be written either directly as numeric values, or using symbolic names specified in .B /etc/iproute2/rt_dsfield -(however note that that file specifies full 8-bit dsfield values, whereas +(however note that the file specifies full 8-bit dsfield values, whereas .B dcb app will only use the higher six bits). .B dcb app show @@ -230,7 +230,7 @@ priority 4: .P # dcb app replace dev eth0 dscp-prio 24:4 .br -# dcb app show dev eth0 dscp-prio +# dcb app -N show dev eth0 dscp-prio .br dscp-prio 0:0 24:4 48:6