| /* |
| * Copyright (c) 2013, 2015, 2017-2019, 2021, The Linux Foundation. All rights reserved. |
| * |
| * Permission to use, copy, modify, and/or distribute this software for any |
| * purpose with or without fee is hereby granted, provided that the above |
| * copyright notice and this permission notice appear in all copies. |
| * |
| * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| */ |
| |
| #include "sw.h" |
| #include "ssdk_init.h" |
| #include "fal_init.h" |
| #ifdef IN_MISC |
| #include "fal_misc.h" |
| #endif |
| #ifdef IN_MIB |
| #include "fal_mib.h" |
| #endif |
| #ifdef IN_PORTCONTROL |
| #include "fal_port_ctrl.h" |
| #endif |
| #ifdef IN_PORTVLAN |
| #include "fal_portvlan.h" |
| #endif |
| #ifdef IN_FDB |
| #include "fal_fdb.h" |
| #endif |
| #ifdef IN_STP |
| #include "fal_stp.h" |
| #endif |
| #ifdef IN_IGMP |
| #include "fal_igmp.h" |
| #endif |
| #ifdef IN_QOS |
| #include "fal_qos.h" |
| #endif |
| #ifdef IN_ACL |
| #include "fal_acl.h" |
| #endif |
| #ifdef IN_PPPOE |
| #include "fal_pppoe.h" |
| #endif |
| #ifdef IN_SERVCODE |
| #include "fal_servcode.h" |
| #endif |
| #ifdef IN_CTRLPKT |
| #include "fal_ctrlpkt.h" |
| #endif |
| #ifdef IN_POLICER |
| #include "fal_policer.h" |
| #endif |
| #ifdef IN_SHAPER |
| #include "fal_shaper.h" |
| #endif |
| #include "hsl.h" |
| #include "hsl_dev.h" |
| #include "ssdk_init.h" |
| #include "shell.h" |
| #include "shell_io.h" |
| #include "shell_sw.h" |
| #include <linux/kconfig.h> |
| #include <linux/version.h> |
| #include <linux/kernel.h> |
| #include <linux/module.h> |
| #include <linux/phy.h> |
| #include <linux/platform_device.h> |
| #include <linux/types.h> |
| #include <generated/autoconf.h> |
| #if defined(CONFIG_OF) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| #include <linux/switch.h> |
| #else |
| #include <net/switch.h> |
| #include <linux/ar8216_platform.h> |
| #endif |
| #include <linux/delay.h> |
| #include <linux/phy.h> |
| #include <linux/netdevice.h> |
| #include "ssdk_plat.h" |
| #include <linux/string.h> |
| #include "ref_uci.h" |
| |
| #define MOD_NAME_MAX_LEN 32 |
| #define COMMAND_NAME_MAX_LEN 128 |
| #define COMMAND_LINE_MAX_LEN 1024 |
| #define SWITCH_CFG_LEN_MAX 64 |
| char module_name[MOD_NAME_MAX_LEN] = {0}; |
| char command_name[COMMAND_NAME_MAX_LEN] = {0}; |
| char whole_command_line[COMMAND_LINE_MAX_LEN] = {0}; |
| char *val_ptr[SWITCH_CFG_LEN_MAX] = {0}; |
| static unsigned int parameter_length = 0; |
| #ifdef IN_NAT |
| static char *vrf_dflt_str = "0"; |
| static char *lb_dflt_str = "0"; |
| static char *cookie_dflt_str = "0"; |
| static char *priority_dflt_str = "no"; |
| static char *param_dflt_str = " "; |
| #endif |
| |
| #ifdef IN_QOS |
| #ifndef IN_QOS_MINI |
| static int |
| parse_qos_qtxbufsts(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "buffer_limit")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_qtxbufnr(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "queue_id")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "number")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_pttxbufsts(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "buffer_limit")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_pttxbufnr(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "number")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptrxbufnr(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "number")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptreden(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "red_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptmode(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "status")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptmodepri(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "priority")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptschmode(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "weight")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptdefaultspri(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "stag_pri")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptdefaultcpri(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "ctag_pri")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptfsprists(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "force_stag_pri_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptfcprists(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "force_ctag_pri_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptquremark(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "queue_id")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "table_id")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "status")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptgroup(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "pcpgroup")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dscpgroup")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "flowgroup")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptpri(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "pcpprec")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dscpprec")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "preheaderprec")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "flowprec")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "aclprec")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "postaclprec")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "pcpprecforce")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dscpprecforce")) { |
| val_ptr[8] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ptremark(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "pcp_change_en")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dei_change_en")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dscp_change_en")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| static int |
| parse_qos_pcpmap(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "group_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "pcp")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internalpcp")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldei")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internalpri")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldscp")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldropprec")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dscpmask")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dscpen")) { |
| val_ptr[8] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "pcpen")) { |
| val_ptr[9] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "deien")) { |
| val_ptr[10] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "prien")) { |
| val_ptr[11] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dpen")) { |
| val_ptr[12] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "qosprec")) { |
| val_ptr[13] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_flowmap(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "group_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "flow_id")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internalpcp")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldei")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internalpri")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldscp")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldropprec")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_dscpmap(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "group_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dscp")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internalpcp")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldei")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internalpri")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldscp")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "internaldropprec")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_qscheduler(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "node_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "level")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "spid")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "edrrpri")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "cdrrpri")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "cdrr_id")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "edrr_id")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "edrrweight")) { |
| val_ptr[8] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "cdrrweight")) { |
| val_ptr[9] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "cdrrunit")) { |
| val_ptr[10] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "edrrunit")) { |
| val_ptr[11] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "drr_frame_mode")) { |
| val_ptr[12] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_ringqueue(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "ring_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp0")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp1")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp2")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp3")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp4")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp5")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp6")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp7")) { |
| val_ptr[8] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp8")) { |
| val_ptr[9] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "queuebmp9")) { |
| val_ptr[10] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_dequeue(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "queue_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if (!strcmp(ext_value_p->option_name, "dequeue_ctrl_en")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_qos_portscheduler(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while (switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if (!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if (!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| #endif |
| #endif |
| |
| #ifdef IN_COSMAP |
| static int |
| parse_cos_mappri2q(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "pri")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "queue")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mappri2ehq(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "pri")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "enhance_queue")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| #ifndef IN_COSMAP_MINI |
| static int |
| parse_cos_mapdscp2pri(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "dscp")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "pri")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mapdscp2dp(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "dscp")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cfi")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mapup2pri(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "up")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "pri")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mapup2dp(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "up")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cfi")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mapdscp2ehpri(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "dscp")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "pri")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mapdscp2ehdp(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "dscp")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cfi")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mapup2ehpri(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "up")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "pri")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mapup2ehdp(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "up")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cfi")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_cos_mapegremark(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "remark_dscp")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "remark_up")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "remark_dei")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "green_dscp")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "yellow_dscp")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "green_up")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "yellow_up")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "green_dei")) { |
| val_ptr[8] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "yellow_dei")) { |
| val_ptr[9] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| #endif |
| #endif |
| |
| #ifdef IN_RATE |
| static int |
| parse_rate_portpolicer(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "combine_enable")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "byte_based")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "couple_flag")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "color_aware")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "deficit_flag")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "c_bucket_enable")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cir")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cbs")) { |
| val_ptr[8] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "c_rate_flag")) { |
| val_ptr[9] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "c_meter_interval")) { |
| val_ptr[10] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "e_bucket_enable")) { |
| val_ptr[11] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "eir")) { |
| val_ptr[12] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "ebs")) { |
| val_ptr[13] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "e_rate_flag")) { |
| val_ptr[14] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "e_meter_interval")) { |
| val_ptr[15] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_rate_portshaper(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "byte_based")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cir")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cbs")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "eir")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "ebs")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_rate_queueshaper(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "queue_id")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "status")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "byte_based")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cir")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cbs")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "eir")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "ebs")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_rate_aclpolicer(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "policer_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "counter_mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "byte_based")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "couple_flag")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "color_aware")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "deficit_flag")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cir")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "cbs")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "eir")) { |
| val_ptr[8] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "ebs")) { |
| val_ptr[9] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "meter_interval")) { |
| val_ptr[10] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_rate_ptaddratebyte(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "add_rate_bytes")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_rate_ptgolflowen(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "golbal_flow_control_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| #endif |
| |
| #ifdef IN_PORTCONTROL |
| #ifndef IN_PORTCONTROL_MINI |
| static int |
| parse_port_duplex(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "duplex")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_speed(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "speed")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_autoadv(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "auto_adv")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_autonegenable(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_autonegrestart(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| #endif |
| static int |
| parse_port_txhdr(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "tx_frame_atheros_header_tag_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_rxhdr(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "rx_frame_atheros_header_tag_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_hdrtype(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "atheros_header_tag_status")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "atheros_header_tag_type")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| #ifndef IN_PORTCONTROL_MINI |
| static int |
| parse_port_flowctrl(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "flow_control_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_flowctrlforcemode(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "flow_control_force_mode_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_powersave(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "power_save_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_hibernate(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "hibernate_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_txmacstatus(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "tx_mac_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_rxmacstatus(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "rx_mac_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_txfcstatus(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "tx_flow_control_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_rxfcstatus(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "rx_flow_control_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| #endif |
| #ifndef IN_PORTCONTROL_MINI |
| static int |
| parse_port_bpstatus(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "back_presure_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_linkforcemode(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "link_force_mode_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_macloopback(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mac_loopback_status")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_congedrop(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "queue_id")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "status")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_ringfcthresh(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "ring_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "on_thresh")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "off_thresh")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| |
| |
| static int |
| parse_port_ieee8023az(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_crossover(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_prefermedium(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_fibermode(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_localloopback(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_remoteloopback(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_magicframemac(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "macaddr")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_wolstatus(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_interfacemode(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_interfacemodeapply(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_poweron(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_poweroff(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_reset(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_interface8023az(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_promiscmode(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "promisc_mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| static int |
| parse_port_eeecfg(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "eee_en")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "eee_capability")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "lpi_sleep_timer")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "advertisement")) { |
| val_ptr[4] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "lpi_tx_en")) { |
| val_ptr[5] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "eee_status")) { |
| val_ptr[6] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "lpi_wakeup_timer")) { |
| val_ptr[7] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "link_partner_advertisement")) { |
| val_ptr[8] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_srcfiltercfg(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "srcfilter_enable")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "srcfilter_mode")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_framemaxsize(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "frame_max_size")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_mtu(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mtusize")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mtuaction")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_mru(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mrusize")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "mruaction")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_port_srcfilter(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "status_en")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_switch_port_loopback(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "loopback_en")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "crc_stripped_en")) { |
| val_ptr[2] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "loopback_rate")) { |
| val_ptr[3] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| #endif |
| #endif |
| |
| #ifdef IN_PORTVLAN |
| static int |
| parse_portvlan_ingress(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "ingress_vlan_mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_portvlan_egress(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| while(switch_ext_p) { |
| ext_value_p = switch_ext_p; |
| |
| if(!strcmp(ext_value_p->option_name, "name")) { |
| switch_ext_p = switch_ext_p->next; |
| continue; |
| } else if(!strcmp(ext_value_p->option_name, "port_id")) { |
| val_ptr[0] = (char*)ext_value_p->option_value; |
| } else if(!strcmp(ext_value_p->option_name, "egress_vlan_mode")) { |
| val_ptr[1] = (char*)ext_value_p->option_value; |
| } else { |
| rv = -1; |
| break; |
| } |
| |
| parameter_length++; |
| switch_ext_p = switch_ext_p->next; |
| } |
| |
| return rv; |
| } |
| |
| static int |
| parse_portvlan_member(struct switch_val *val) |
| { |
| struct switch_ext *switch_ext_p, *ext_value_p; |
| int rv = 0; |
| switch_ext_p = val->value.ext_val; |
| |