Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
libethernet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HAL
libethernet
Commits
05c72d73
Commit
05c72d73
authored
4 months ago
by
Markus Gothe
Browse files
Options
Downloads
Patches
Plain Diff
econet: Add PON support.
parent
dc6ca0ca
Branches
Branches containing commit
No related tags found
1 merge request
!24
econet: Add PON support.
Pipeline
#191107
passed
4 months ago
Stage: static_code_analysis
Stage: compile_test
Changes
4
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
econet/ecnt_prvt.c
+28
-2
28 additions, 2 deletions
econet/ecnt_prvt.c
econet/ecnt_prvt.h
+1
-0
1 addition, 0 deletions
econet/ecnt_prvt.h
econet/econet.c
+12
-1
12 additions, 1 deletion
econet/econet.c
ethernet.c
+2
-0
2 additions, 0 deletions
ethernet.c
with
43 additions
and
3 deletions
econet/ecnt_prvt.c
+
28
−
2
View file @
05c72d73
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
econet/ecnt_prvt.h
+
1
−
0
View file @
05c72d73
...
@@ -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
}
}
...
...
This diff is collapsed.
Click to expand it.
econet/econet.c
+
12
−
1
View file @
05c72d73
...
@@ -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
r
stats 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
This diff is collapsed.
Click to expand it.
ethernet.c
+
2
−
0
View file @
05c72d73
...
@@ -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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment