Skip to content
Snippets Groups Projects
Commit 05c72d73 authored by Markus Gothe's avatar Markus Gothe :ok_hand:
Browse files

econet: Add PON support.

parent dc6ca0ca
Branches
No related tags found
1 merge request!24econet: Add PON support.
Pipeline #191107 passed
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#define IFNAME_ETH0 "eth0." #define IFNAME_ETH0 "eth0."
#define IFNAME_NAS "nas" #define IFNAME_NAS "nas"
#define IFNAME_AE_WAN "ae_wan" #define IFNAME_AE_WAN "ae_wan"
#define IFNAME_PON "pon"
#define DRIVER_NAME "hsgmii_lan" #define DRIVER_NAME "hsgmii_lan"
#define DRIVER_NAME_LEN 20 #define DRIVER_NAME_LEN 20
...@@ -267,7 +268,9 @@ int ae_wan_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_sta ...@@ -267,7 +268,9 @@ int ae_wan_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_sta
memset(&rx_stats, 0, sizeof(ECNT_FEMGR_GDMA2_RX_STATISTICS)); memset(&rx_stats, 0, sizeof(ECNT_FEMGR_GDMA2_RX_STATISTICS));
chrCmd(cmdbuf, sizeof(cmdbuf), "cat /proc/tc3162/ae_wan_switch_hsgmii_lan"); chrCmd(cmdbuf, sizeof(cmdbuf), "cat /proc/tc3162/ae_wan_switch_hsgmii_lan");
if (cmdbuf[0] != '\0' && strcmp(cmdbuf, "pon") != 0) { if (cmdbuf[0] == '\0') {
return -1;
} else if (strcmp(cmdbuf, "pon") != 0) {
int i = 0, hsgmii_index = -1; int i = 0, hsgmii_index = -1;
for (; i < ARRAY_SIZE(hsgmii_lookup_tbl); i++) { for (; i < ARRAY_SIZE(hsgmii_lookup_tbl); i++) {
if (!strcmp(cmdbuf, hsgmii_lookup_tbl[i].iftype)) { if (!strcmp(cmdbuf, hsgmii_lookup_tbl[i].iftype)) {
...@@ -308,6 +311,28 @@ int ae_wan_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_sta ...@@ -308,6 +311,28 @@ int ae_wan_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_sta
return 0; return 0;
} }
int pon_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_stats *rstats) {
ECNT_FEMGR_GDMA2_TX_STATISTICS tx_stats;
ECNT_FEMGR_GDMA2_RX_STATISTICS rx_stats;
char driver_name[DRIVER_NAME_LEN] = {0};
if (get_drv_info_by_ifname(IFNAME_PON, driver_name))
return -1;
memset(&tx_stats, 0, sizeof(ECNT_FEMGR_GDMA2_TX_STATISTICS));
memset(&rx_stats, 0, sizeof(ECNT_FEMGR_GDMA2_RX_STATISTICS));
if (!fe_lib_get_gdma2_tx_statistics(&tx_stats)) {
fill_stats_tx_from_gdma(stats, rstats, &tx_stats);
}
if (!fe_lib_get_gdma2_rx_statistics(&rx_stats)) {
fill_stats_rx_from_gdma(stats, rstats, &rx_stats);
}
return 0;
}
int ecnt_prvt_get_port_statistics(uint32_t port, int ecnt_prvt_get_port_statistics(uint32_t port,
struct eth_stats *stats, struct eth_stats *stats,
struct eth_rmon_stats *rstats) struct eth_rmon_stats *rstats)
...@@ -479,7 +504,8 @@ uint32_t ecnt_prvt_get_port_num(const char *ifname) ...@@ -479,7 +504,8 @@ uint32_t ecnt_prvt_get_port_num(const char *ifname)
return ECNT_PRVT_PORT_NUM_INVALID; return ECNT_PRVT_PORT_NUM_INVALID;
} }
} else if (strncmp(ifname, IFNAME_NAS, strlen(IFNAME_NAS)) == 0 || } else if (strncmp(ifname, IFNAME_NAS, strlen(IFNAME_NAS)) == 0 ||
strncmp(ifname, IFNAME_AE_WAN, strlen(IFNAME_AE_WAN)) == 0) { strncmp(ifname, IFNAME_AE_WAN, strlen(IFNAME_AE_WAN)) == 0 ||
strncmp(ifname, IFNAME_PON, strlen(IFNAME_PON)) == 0) {
is_wan = true; is_wan = true;
} else { } else {
return ECNT_PRVT_PORT_NUM_INVALID; return ECNT_PRVT_PORT_NUM_INVALID;
......
...@@ -113,6 +113,7 @@ int ecnt_prvt_set_port_state(uint32_t port_num, bool state); ...@@ -113,6 +113,7 @@ int ecnt_prvt_set_port_state(uint32_t port_num, bool state);
int hsgmii_lan_prvt_get_port_statistics(char *ifname, struct eth_stats *stats, struct eth_rmon_stats *rstats); int hsgmii_lan_prvt_get_port_statistics(char *ifname, struct eth_stats *stats, struct eth_rmon_stats *rstats);
int ae_wan_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_stats *rstats); int ae_wan_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_stats *rstats);
int pon_prvt_get_port_statistics(struct eth_stats *stats, struct eth_rmon_stats *rstats);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -68,10 +68,15 @@ int econet_eth_get_stats(const char *ifname, struct eth_stats *stats) ...@@ -68,10 +68,15 @@ int econet_eth_get_stats(const char *ifname, struct eth_stats *stats)
if (!hsgmii_lan_prvt_get_port_statistics(ifname, stats, NULL)) { if (!hsgmii_lan_prvt_get_port_statistics(ifname, stats, NULL)) {
return 0; return 0;
} else if (!strcmp(ifname, "ae_wan")) { } else if (!strcmp(ifname, "ae_wan")) {
/* Check and fetch rstats if the Interface belongs to ae_wan driver */ /* Check and fetch stats if the Interface belongs to ae_wan driver */
if (!ae_wan_prvt_get_port_statistics(stats, NULL)) { if (!ae_wan_prvt_get_port_statistics(stats, NULL)) {
return 0; return 0;
} }
} else if (!strcmp(ifname, "pon")) {
/* Check and fetch stats if the Interface belongs to PON driver */
if (!pon_prvt_get_port_statistics(stats, NULL)) {
return 0;
}
} }
libethernet_err("error reading stats for interface %s\n", ifname); libethernet_err("error reading stats for interface %s\n", ifname);
...@@ -101,6 +106,11 @@ int econet_eth_get_rmon_stats(const char *ifname, struct eth_rmon_stats *rstats) ...@@ -101,6 +106,11 @@ int econet_eth_get_rmon_stats(const char *ifname, struct eth_rmon_stats *rstats)
if (!ae_wan_prvt_get_port_statistics(NULL, rstats)) { if (!ae_wan_prvt_get_port_statistics(NULL, rstats)) {
return 0; return 0;
} }
} else if (!strcmp(ifname, "pon")) {
/* Check and fetch rstats if the Interface belongs to PON driver */
if (!pon_prvt_get_port_statistics(NULL, rstats)) {
return 0;
}
} }
libethernet_err("error reading rmon stats for interface %s\n", ifname); libethernet_err("error reading rmon stats for interface %s\n", ifname);
...@@ -187,5 +197,6 @@ const struct eth_ops __name = { \ ...@@ -187,5 +197,6 @@ const struct eth_ops __name = { \
ECNT_ETH_OPS(econet_gen_eth_ops, "eth"); ECNT_ETH_OPS(econet_gen_eth_ops, "eth");
ECNT_ETH_OPS(econet_nas_wan_eth_ops, "nas"); ECNT_ETH_OPS(econet_nas_wan_eth_ops, "nas");
ECNT_ETH_OPS(econet_ae_wan_eth_ops, "ae_wan"); ECNT_ETH_OPS(econet_ae_wan_eth_ops, "ae_wan");
ECNT_ETH_OPS(econet_pon_ops, "pon");
#undef ECNT_ETH_OPS #undef ECNT_ETH_OPS
...@@ -47,6 +47,7 @@ extern const struct eth_ops test_eth_ops; ...@@ -47,6 +47,7 @@ extern const struct eth_ops test_eth_ops;
extern const struct eth_ops econet_gen_eth_ops; extern const struct eth_ops econet_gen_eth_ops;
extern const struct eth_ops econet_nas_wan_eth_ops; extern const struct eth_ops econet_nas_wan_eth_ops;
extern const struct eth_ops econet_ae_wan_eth_ops; extern const struct eth_ops econet_ae_wan_eth_ops;
extern const struct eth_ops econet_pon_ops;
#elif defined(IOPSYS_MEDIATEK) #elif defined(IOPSYS_MEDIATEK)
extern const struct eth_ops mtk_eth_ops; extern const struct eth_ops mtk_eth_ops;
#elif defined(IOPSYS_LINUX) #elif defined(IOPSYS_LINUX)
...@@ -64,6 +65,7 @@ const struct eth_ops *eth_ops[] = { ...@@ -64,6 +65,7 @@ const struct eth_ops *eth_ops[] = {
&econet_gen_eth_ops, &econet_gen_eth_ops,
&econet_nas_wan_eth_ops, &econet_nas_wan_eth_ops,
&econet_ae_wan_eth_ops, &econet_ae_wan_eth_ops,
&econet_pon_ops,
#elif defined(IOPSYS_MEDIATEK) #elif defined(IOPSYS_MEDIATEK)
&mtk_eth_ops &mtk_eth_ops
#elif defined(IOPSYS_LINUX) #elif defined(IOPSYS_LINUX)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment