Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qosmngr
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
Container registry
Model registry
Operate
Environments
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
qosmngr
Merge requests
!19
qosmngr: handle single lan port device
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
qosmngr: handle single lan port device
rt_handle_network_device
into
devel
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Rahul Thakur
requested to merge
rt_handle_network_device
into
devel
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
devel
devel (base)
and
latest version
latest version
4179d88a
1 commit,
1 year ago
1 file
+
51
−
61
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/qosmngr.c
+
51
−
61
Options
@@ -209,101 +209,91 @@ static int init_qstat(void)
struct
json_object
*
lan
=
NULL
;
if
(
!
json_object_object_get_ex
(
network
,
"lan"
,
&
lan
))
{
syslog
(
LOG_ERR
,
"lan object not found in board.json"
);
json_object_put
(
network
);
json_object_put
(
board_json
);
ret
=
-
1
;
goto
free_and_return
;
}
struct
json_object
*
wan
=
NULL
;
if
(
!
json_object_object_get_ex
(
network
,
"wan"
,
&
wan
))
{
syslog
(
LOG_ERR
,
"wan object not found in board.json"
);
ret
=
-
1
;
json_object_put
(
lan
);
json_object_put
(
network
);
json_object_put
(
board_json
);
goto
free_and_return
;
struct
json_object
*
wan_device
=
NULL
;
size_t
wan_device_count
=
0
;
// its not necessary that board.json has wan section at all
if
(
json_object_object_get_ex
(
network
,
"wan"
,
&
wan
))
{
if
(
!
json_object_object_get_ex
(
wan
,
"device"
,
&
wan_device
))
{
syslog
(
LOG_ERR
,
"wan device object not found in board.json"
);
ret
=
-
1
;
json_object_put
(
board_json
);
goto
free_and_return
;
}
wan_device_count
=
1
;
}
struct
json_object
*
lan_ports
=
NULL
;
if
(
!
json_object_object_get_ex
(
lan
,
"ports"
,
&
lan_ports
))
{
syslog
(
LOG_
ERR
,
"
ports object not found in board.json"
);
ret
=
-
1
;
json_object_put
(
lan
);
json_object_put
(
wan
)
;
json_object_put
(
network
);
json_object_put
(
board_json
)
;
goto
free_and_return
;
syslog
(
LOG_
INFO
,
"lan
ports object not found in board.json"
);
if
(
!
json_object_object_get_ex
(
lan
,
"device"
,
&
lan_ports
))
{
syslog
(
LOG_INFO
,
"lan device object not found in board.json"
);
ret
=
-
1
;
json_object_put
(
board_json
);
goto
free_and_return
;
}
}
struct
json_object
*
wan_device
=
NULL
;
if
(
!
json_object_object_get_ex
(
wan
,
"device"
,
&
wan_device
))
{
syslog
(
LOG_ERR
,
"device object not found in board.json"
);
ret
=
-
1
;
json_object_put
(
lan_ports
);
json_object_put
(
lan
);
json_object_put
(
wan
);
json_object_put
(
network
);
json_object_put
(
board_json
);
goto
free_and_return
;
}
// create json object for all ports by reading from lan ports and wan device
interface_count
=
json_object_array_length
(
lan_ports
)
+
1
;
// +1 for wan device
if
(
json_object_is_type
(
lan_ports
,
json_type_array
))
{
interface_count
=
json_object_array_length
(
lan_ports
)
+
wan_device_count
;
}
else
{
// single lan port device
interface_count
=
1
+
wan_device_count
;
}
interfaces
=
(
qos_interface_data
*
)
calloc
(
interface_count
,
sizeof
(
qos_interface_data
));
if
(
interfaces
==
NULL
)
{
syslog
(
LOG_ERR
,
"Initialization failed during memory allocation."
);
ret
=
-
1
;
json_object_put
(
lan_ports
);
json_object_put
(
wan_device
);
json_object_put
(
lan
);
json_object_put
(
wan
);
json_object_put
(
network
);
json_object_put
(
board_json
);
goto
free_and_return
;
}
size_t
i
=
0
;
for
(
i
=
0
;
i
<
json_object_array_length
(
lan_ports
);
i
++
)
{
struct
json_object
*
l_port_name
=
json_object_array_get_idx
(
lan_ports
,
i
);
if
(
!
l_port_name
)
{
syslog
(
LOG_ERR
,
"cannot read lan ports array"
);
ret
=
-
1
;
json_object_put
(
lan_ports
);
json_object_put
(
wan_device
);
json_object_put
(
lan
);
json_object_put
(
wan
);
json_object_put
(
network
);
json_object_put
(
board_json
);
free
(
interfaces
);
goto
free_and_return
;
}
if
(
json_object_is_type
(
lan_ports
,
json_type_array
))
{
for
(
i
=
0
;
i
<
json_object_array_length
(
lan_ports
);
i
++
)
{
struct
json_object
*
l_port_name
=
json_object_array_get_idx
(
lan_ports
,
i
);
if
(
!
l_port_name
)
{
syslog
(
LOG_ERR
,
"cannot read lan ports array"
);
ret
=
-
1
;
json_object_put
(
board_json
);
free
(
interfaces
);
goto
free_and_return
;
}
ret
=
init_interface
(
json_object_get_string
(
l_port_name
),
i
);
ret
=
init_interface
(
json_object_get_string
(
l_port_name
),
i
);
if
(
ret
<
0
)
{
syslog
(
LOG_ERR
,
"cannot int lan ports qos"
);
json_object_put
(
board_json
);
free
(
interfaces
);
goto
free_and_return
;
}
}
}
else
{
ret
=
init_interface
(
json_object_get_string
(
lan_ports
),
i
);
if
(
ret
<
0
)
{
json_object_put
(
l_port_name
);
json_object_put
(
lan_ports
);
json_object_put
(
wan_device
);
json_object_put
(
lan
);
json_object_put
(
wan
);
json_object_put
(
network
);
syslog
(
LOG_ERR
,
"cannot int lan device qos"
);
json_object_put
(
board_json
);
free
(
interfaces
);
goto
free_and_return
;
}
json_object_put
(
l_port_name
);
i
++
;
}
ret
=
init_interface
(
json_object_get_string
(
wan_device
),
i
);
if
(
wan_device
)
ret
=
init_interface
(
json_object_get_string
(
wan_device
),
i
);
json_object_put
(
lan_ports
);
json_object_put
(
wan_device
);
json_object_put
(
lan
);
json_object_put
(
wan
);
json_object_put
(
network
);
json_object_put
(
board_json
);
free_and_return:
Loading