+/* *** Delete Port Meter Policy Object *** */
+struct cmd_del_port_meter_policy_result {
+ cmdline_fixed_string_t del;
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t meter;
+ cmdline_fixed_string_t policy;
+ uint16_t port_id;
+ uint32_t policy_id;
+};
+
+cmdline_parse_token_string_t cmd_del_port_meter_policy_del =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_del_port_meter_policy_result, del, "del");
+cmdline_parse_token_string_t cmd_del_port_meter_policy_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_del_port_meter_policy_result, port, "port");
+cmdline_parse_token_string_t cmd_del_port_meter_policy_meter =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_del_port_meter_policy_result, meter, "meter");
+cmdline_parse_token_string_t cmd_del_port_meter_policy_policy =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_del_port_meter_policy_result, policy, "policy");
+cmdline_parse_token_num_t cmd_del_port_meter_policy_port_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_del_port_meter_policy_result, port_id, RTE_UINT16);
+cmdline_parse_token_num_t cmd_del_port_meter_policy_policy_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_del_port_meter_policy_result, policy_id, RTE_UINT32);
+
+static void cmd_del_port_meter_policy_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_del_port_meter_policy_result *res = parsed_result;
+ struct rte_mtr_error error;
+ uint32_t policy_id = res->policy_id;
+ uint16_t port_id = res->port_id;
+ int ret;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
+ /* Delete Meter Policy*/
+ ret = rte_mtr_meter_policy_delete(port_id, policy_id, &error);
+ if (ret != 0) {
+ print_err_msg(&error);
+ return;
+ }
+}
+
+cmdline_parse_inst_t cmd_del_port_meter_policy = {
+ .f = cmd_del_port_meter_policy_parsed,
+ .data = NULL,
+ .help_str = "Delete port meter policy",
+ .tokens = {
+ (void *)&cmd_del_port_meter_policy_del,
+ (void *)&cmd_del_port_meter_policy_port,
+ (void *)&cmd_del_port_meter_policy_meter,
+ (void *)&cmd_del_port_meter_policy_policy,
+ (void *)&cmd_del_port_meter_policy_port_id,
+ (void *)&cmd_del_port_meter_policy_policy_id,
+ NULL,
+ },
+};
+