[qca-ssdk-shell]add port_interface_mode_apply command.
Change-Id: I60a8db9204da1990b10ade7a931fb3a9c44fec22
Signed-off-by: Liu Zhongjian <zhongjia@codeaurora.org>
diff --git a/include/api/api_desc.h b/include/api/api_desc.h
index e93f7ee..ae3f0c7 100755
--- a/include/api/api_desc.h
+++ b/include/api/api_desc.h
@@ -393,6 +393,9 @@
SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_GET, SW_INTERFACE_MODE, sizeof(fal_port_interface_mode_t), SW_PARAM_PTR|SW_PARAM_OUT, \
"Interface Mode"),
+#define SW_API_PT_INTERFACE_MODE_APPLY_DESC \
+ SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_APPLY, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"),
+
#define SW_API_PT_INTERFACE_MODE_STATUS_GET_DESC \
SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Dev ID"), \
SW_PARAM_DEF(SW_API_PT_INTERFACE_MODE_STATUS_GET, SW_UINT32, 4, SW_PARAM_IN, "Port ID"), \
diff --git a/include/api/sw_ioctl.h b/include/api/sw_ioctl.h
index dc7f1ab..1dc9715 100755
--- a/include/api/sw_ioctl.h
+++ b/include/api/sw_ioctl.h
@@ -105,6 +105,7 @@
#define SW_API_DEBUG_PHYCOUNTER_SET (71 + SW_API_PORT_OFFSET)
#define SW_API_DEBUG_PHYCOUNTER_GET (72 + SW_API_PORT_OFFSET)
#define SW_API_DEBUG_PHYCOUNTER_SHOW (73 + SW_API_PORT_OFFSET)
+#define SW_API_PT_INTERFACE_MODE_APPLY (74 + SW_API_PORT_OFFSET)
/*vlan*/
#define SW_API_VLAN_OFFSET 110
diff --git a/include/fal/fal_api.h b/include/fal/fal_api.h
index f429c5c..b66b113 100755
--- a/include/fal/fal_api.h
+++ b/include/fal/fal_api.h
@@ -91,6 +91,7 @@
SW_API_DEF(SW_API_PT_PHY_ID_GET, fal_port_phy_id_get), \
SW_API_DEF(SW_API_PT_WOL_STATUS_SET, fal_port_wol_status_set), \
SW_API_DEF(SW_API_PT_WOL_STATUS_GET, fal_port_wol_status_get), \
+ SW_API_DEF(SW_API_PT_INTERFACE_MODE_APPLY, fal_port_interface_mode_apply), \
SW_API_DEF(SW_API_PT_INTERFACE_MODE_SET, fal_port_interface_mode_set), \
SW_API_DEF(SW_API_PT_INTERFACE_MODE_GET, fal_port_interface_mode_get), \
SW_API_DEF(SW_API_PT_INTERFACE_MODE_STATUS_GET, fal_port_interface_mode_status_get), \
@@ -177,6 +178,7 @@
SW_API_DESC(SW_API_PT_WOL_STATUS_GET) \
SW_API_DESC(SW_API_PT_INTERFACE_MODE_SET) \
SW_API_DESC(SW_API_PT_INTERFACE_MODE_GET) \
+ SW_API_DESC(SW_API_PT_INTERFACE_MODE_APPLY) \
SW_API_DESC(SW_API_PT_INTERFACE_MODE_STATUS_GET) \
SW_API_DESC(SW_API_DEBUG_PHYCOUNTER_SET) \
SW_API_DESC(SW_API_DEBUG_PHYCOUNTER_GET) \
diff --git a/include/fal/fal_port_ctrl.h b/include/fal/fal_port_ctrl.h
index 030195a..15e7397 100755
--- a/include/fal/fal_port_ctrl.h
+++ b/include/fal/fal_port_ctrl.h
@@ -71,6 +71,7 @@
#define FAL_PHY_ADV_5000T_FD 0x2000
#define FAL_PHY_ADV_10000T_FD 0x4000
+#define FAL_PHY_ADV_10G_R_FD 0x8000
#define FAL_PHY_ADV_FE_SPEED_ALL \
(FAL_PHY_ADV_10T_HD | FAL_PHY_ADV_10T_FD | FAL_PHY_ADV_100TX_HD |\
@@ -81,7 +82,7 @@
FAL_PHY_ADV_100TX_FD | FAL_PHY_ADV_1000T_FD)
#define FAL_PHY_ADV_BX_SPEED_ALL \
- (FAL_PHY_ADV_1000BX_HD | FAL_PHY_ADV_1000BX_FD)
+ (FAL_PHY_ADV_1000BX_HD | FAL_PHY_ADV_1000BX_FD |FAL_PHY_ADV_10G_R_FD)
#define FAL_PHY_ADV_PAUSE 0x10
#define FAL_PHY_ADV_ASY_PAUSE 0x20
@@ -187,6 +188,7 @@
typedef enum {
PHY_FIBER_100FX = 0, /**< 100FX fiber mode */
PHY_FIBER_1000BX = 1, /**< 1000BX fiber mode */
+ PHY_FIBER_10G_R = 2, /**< 10G-R fiber mode */
} fal_port_fiber_mode_t;
@@ -215,6 +217,15 @@
/**< PSGMII Auto mode */
PHY_SGMII_BASET = 4,
/**< SGMII mode */
+ PORT_QSGMII,
+ /**<QSGMII mode*/
+ PORT_SGMII_PLUS,
+ /**<PORT_SGMII_PLUS mode*/
+ PORT_USXGMII,
+ /**<PORT_USXGMII mode*/
+ PORT_10GBASE_R,
+ /**<PORT_10GBASE_R mode*/
+ PORT_INTERFACE_MODE_MAX = 0xFF
} fal_port_interface_mode_t;
/** Phy counter information */
@@ -262,6 +273,7 @@
FUNC_ADPT_PORT_MDIX_STATUS_GET,
FUNC_ADPT_PORT_MTU_SET,
FUNC_ADPT_PORT_LINK_STATUS_GET,
+
FUNC_ADPT_PORT_8023AZ_SET,
FUNC_ADPT_PORT_POWERSAVE_GET,
FUNC_ADPT_PORT_COMBO_PREFER_MEDIUM_GET,
@@ -294,6 +306,8 @@
FUNC_ADPT_PORT_MAX_FRAME_SIZE_GET,
FUNC_ADPT_PORT_SOURCE_FILTER_GET,
FUNC_ADPT_PORT_SOURCE_FILTER_SET,
+
+ FUNC_ADPT_PORT_INTERFACE_MODE_APPLY,
};
typedef enum {
@@ -627,6 +641,9 @@
fal_port_interface_mode_set(a_uint32_t dev_id, fal_port_t port_id, fal_port_interface_mode_t mode);
sw_error_t
+ fal_port_interface_mode_apply(a_uint32_t dev_id);
+
+ sw_error_t
fal_port_interface_mode_get (a_uint32_t dev_id, fal_port_t port_id,
fal_port_interface_mode_t * mode);
sw_error_t
diff --git a/src/fal_uk/fal_port_ctrl.c b/src/fal_uk/fal_port_ctrl.c
index fe62181..ede5355 100755
--- a/src/fal_uk/fal_port_ctrl.c
+++ b/src/fal_uk/fal_port_ctrl.c
@@ -695,7 +695,6 @@
fal_port_interface_mode_t mode)
{
sw_error_t rv;
-
rv = sw_uk_exec(SW_API_PT_INTERFACE_MODE_SET, dev_id, port_id,(a_uint32_t) mode);
return rv;
}
@@ -711,6 +710,15 @@
}
sw_error_t
+fal_port_interface_mode_apply (a_uint32_t dev_id)
+{
+ sw_error_t rv;
+
+ rv = sw_uk_exec(SW_API_PT_INTERFACE_MODE_APPLY, dev_id);
+ return rv;
+}
+
+sw_error_t
fal_port_interface_mode_status_get (a_uint32_t dev_id, fal_port_t port_id,
fal_port_interface_mode_t * mode)
{
diff --git a/src/shell/shell_config.c b/src/shell/shell_config.c
index b961aca..f96f27c 100755
--- a/src/shell/shell_config.c
+++ b/src/shell/shell_config.c
@@ -78,7 +78,7 @@
{"preferMedium", "set", "set prefer medium of a combo port", "<port_id> <copper|fiber>", SW_API_PT_COMBO_PREFER_MEDIUM_SET, NULL},
{"preferMedium", "get", "get prefer medium of a combo port", "<port_id>", SW_API_PT_COMBO_PREFER_MEDIUM_GET, NULL},
{"mediumType", "get", "get current medium status of a combo port", "<port_id>", SW_API_PT_COMBO_MEDIUM_STATUS_GET, NULL},
- {"fiberMode", "set", "set fiber mode of a combo fiber port", "<port_id> <100fx|1000bx>", SW_API_PT_COMBO_FIBER_MODE_SET, NULL},
+ {"fiberMode", "set", "set fiber mode of a combo fiber port", "<port_id> <100fx|1000bx |10g_r>", SW_API_PT_COMBO_FIBER_MODE_SET, NULL},
{"fiberMode", "get", "get fiber mode of a combo fiber port", "<port_id>", SW_API_PT_COMBO_FIBER_MODE_GET, NULL},
{"localLoopback", "set", "set local loopback of a port", "<port_id> <enable|disable>", SW_API_PT_LOCAL_LOOPBACK_SET, NULL},
{"localLoopback", "get", "get local loopback of a port", "<port_id>", SW_API_PT_LOCAL_LOOPBACK_GET, NULL},
@@ -92,8 +92,9 @@
{"phyId", "get", "get phy id of a port", "<port_id>", SW_API_PT_PHY_ID_GET, NULL},
{"wolstatus", "set", "set wol status of a port", "<port_id> <enable|disable>", SW_API_PT_WOL_STATUS_SET, NULL},
{"wolstatus", "get", "get wol status of a port", "<port_id>", SW_API_PT_WOL_STATUS_GET, NULL},
- {"interfaceMode", "set", "set interface mode of phy", "<port_id> <psgmii_baset|psgmii_bx1000|psgmii_fx100|psgmii_amdet|sgmii_baset>", SW_API_PT_INTERFACE_MODE_SET, NULL},
+ {"interfaceMode", "set", "set interface mode of phy", "<port_id> <psgmii_baset|psgmii_bx1000|psgmii_fx100|psgmii_amdet|sgmii_baset|qsgmii|usxgmii|sgmii_plus|10gbase_r |interfacemode_max>", SW_API_PT_INTERFACE_MODE_SET, NULL},
{"interfaceMode", "get", "get interface mode of phy", "<port_id>", SW_API_PT_INTERFACE_MODE_GET, NULL},
+ {"interfaceMode", "apply", "apply interface mode", "<dev_id>", SW_API_PT_INTERFACE_MODE_APPLY, NULL},
{"interfaceMode", "status", "get current interface mode of phy", "<port_id>", SW_API_PT_INTERFACE_MODE_STATUS_GET, NULL},
{"mtu", "set", "set port mtu value", "", SW_API_PT_MTU_SET, NULL},
{"mtu", "get", "get port mtu value", "", SW_API_PT_MTU_GET, NULL},
diff --git a/src/shell/shell_io.c b/src/shell/shell_io.c
index 3ccce63..01e8402 100755
--- a/src/shell/shell_io.c
+++ b/src/shell/shell_io.c
@@ -1126,6 +1126,8 @@
*arg_val = PHY_FIBER_100FX;
else if (!strncasecmp(cmd_str, "1000bx", 7))
*arg_val = PHY_FIBER_1000BX;
+ else if (!strncasecmp(cmd_str, "10g_r", 7))
+ *arg_val = PHY_FIBER_10G_R;
else
{
//dprintf("input error \n");
@@ -1169,6 +1171,16 @@
*arg_val = PHY_PSGMII_AMDET;
else if (!strncasecmp(cmd_str, "sgmii_baset", 13))
*arg_val = PHY_SGMII_BASET;
+ else if (!strncasecmp(cmd_str, "qsgmii", 13))
+ *arg_val = PORT_QSGMII;
+ else if (!strncasecmp(cmd_str, "sgmii_plus", 13))
+ *arg_val = PORT_SGMII_PLUS;
+ else if (!strncasecmp(cmd_str, "usxgmii", 13))
+ *arg_val = PORT_USXGMII;
+ else if (!strncasecmp(cmd_str, "10gbase_r", 13))
+ *arg_val = PORT_10GBASE_R;
+ else if (!strncasecmp(cmd_str, "interfacemode_max", 20))
+ *arg_val = PORT_INTERFACE_MODE_MAX;
else
{
//dprintf("input error \n");
@@ -1202,6 +1214,27 @@
{
dprintf("SGMII_BASET");
}
+ else if (*(a_uint32_t *) buf == PORT_QSGMII)
+ {
+ dprintf("QSGMII");
+ }
+ else if (*(a_uint32_t *) buf == PORT_SGMII_PLUS)
+ {
+ dprintf("SGMII PLUS");
+ }
+ else if (*(a_uint32_t *) buf == PORT_USXGMII)
+ {
+ dprintf("USXGMII");
+ }
+ else if (*(a_uint32_t *) buf == PORT_10GBASE_R)
+ {
+ dprintf("10gbase_r");
+ }
+ else if (*(a_uint32_t *) buf == PORT_INTERFACE_MODE_MAX)
+ {
+ dprintf("INTERFACEMODE_MAX");
+ }
+
else
{
dprintf("UNKNOWN VALUE");
@@ -1250,7 +1283,6 @@
dprintf("mru_action:unknown\n");
}
-
sw_error_t
cmd_data_check_mtu_entry(char *cmd_str, void * val, a_uint32_t size)
{
@@ -13052,8 +13084,6 @@
return SW_OK;
}
-
-
sw_error_t
cmd_data_check_fx100_config(char *cmd_str, void * val, a_uint32_t size)
{
diff --git a/src/shell/shell_module_ctrl.c b/src/shell/shell_module_ctrl.c
index bebb532..1abcaf0 100755
--- a/src/shell/shell_module_ctrl.c
+++ b/src/shell/shell_module_ctrl.c
@@ -558,7 +558,7 @@
static void cmd_data_print_port_ctrl_func_ctrl(fal_func_ctrl_t *p)
{
a_uint32_t func = 0;
- char *func_name[FUNC_ADPT_PORT_SOURCE_FILTER_SET+1] ={
+ char *func_name[FUNC_ADPT_PORT_INTERFACE_MODE_APPLY+1] ={
"FUNC_ADPT_PORT_LOCAL_LOOPBACK_GET",
"FUNC_ADPT_PORT_AUTONEG_RESTART",
"FUNC_ADPT_PORT_DUPLEX_SET",
@@ -591,6 +591,7 @@
"FUNC_ADPT_PORT_MDIX_STATUS_GET",
"FUNC_ADPT_PORT_MTU_SET",
"FUNC_ADPT_PORT_LINK_STATUS_GET",
+
"FUNC_ADPT_PORT_8023AZ_SET",
"FUNC_ADPT_PORT_POWERSAVE_GET",
"FUNC_ADPT_PORT_COMBO_PREFER_MEDIUM_GET",
@@ -623,6 +624,8 @@
"FUNC_ADPT_PORT_MAX_FRAME_SIZE_GET",
"FUNC_ADPT_PORT_SOURCE_FILTER_GET",
"FUNC_ADPT_PORT_SOURCE_FILTER_SET",
+
+ "FUNC_ADPT_PORT_INTERFACE_MODE_APPLY",
};
for(func = FUNC_ADPT_PORT_LOCAL_LOOPBACK_GET; func <= FUNC_ADPT_PORT_LINK_STATUS_GET; func++)
@@ -649,6 +652,18 @@
}
}
+ for(func = FUNC_ADPT_PORT_INTERFACE_MODE_APPLY; func <= FUNC_ADPT_PORT_INTERFACE_MODE_APPLY; func++)
+ {
+ if(p->bitmap[2] & (1<<(func % 32)))
+ {
+ dprintf("%d %s registered\n", func, func_name[func]);
+ }
+ else
+ {
+ dprintf("%d %s unregistered\n", func, func_name[func]);
+ }
+ }
+
return;
}