rmnetctl: Add uplink aggregation parameters to getlink

The rtrmnet_ctl_getvnd() API and corresponding rmnetcli -n getlink
command now report the values of the 3 paramters used during uplink
aggregation: the maximum packet count, byte count, and time limit.

Change-Id: Id8e9046aba4f5fba79ba5d20884aedb457bbb0a5
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
This commit is contained in:
Sean Tranchetti
2019-04-22 16:45:19 -06:00
parent 85c32d074b
commit 406fd8138f
3 changed files with 32 additions and 3 deletions

View File

@@ -374,14 +374,23 @@ static int rmnet_api_call(int argc, char *argv[])
_RMNETCLI_CHECKNULL(argv[1]);
uint32_t flags = 0;
uint16_t mux_id = 0;
uint16_t agg_count = 0;
uint16_t agg_size = 0;
uint32_t agg_time = 0;
return_code = rtrmnet_ctl_getvnd(handle, argv[1],
&error_number,
&mux_id, &flags);
&mux_id, &flags,
&agg_count, &agg_size,
&agg_time);
if (return_code == RMNETCTL_API_SUCCESS) {
printf("Configuration for device %s:\n", argv[1]);
printf("\tMux id: %d\n", mux_id);
printf("\tData format: 0x%04x\n", flags);
printf("\tUplink Aggregation parameters:\n");
printf("\t\tPacket limit: %d\n", agg_count);
printf("\t\tByte limit: %d\n", agg_size);
printf("\t\tTime limit (ns): %d\n", agg_time);
}
} else if (!strcmp(*argv, "dellink")) {
_RMNETCLI_CHECKNULL(argv[1]);

View File

@@ -598,6 +598,12 @@ int rtrmnet_ctl_changevnd(rmnetctl_hndl_t *hndl, char *devname, char *vndname,
* @param error_code Status code of this operation returned from the kernel
* @param mux_id Where to store the value of the node's mux id
* @param flagconfig Where to store the value of the node's data format flags
* @param agg_count Where to store the value of the node's maximum packet count
* for uplink aggregation
* @param agg_size Where to store the value of the node's maximum byte count
* for uplink aggregation
* @param agg_time Where to store the value of the node's maximum time limit
* for uplink aggregation
* @return RMNETCTL_SUCCESS if successful
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
@@ -606,7 +612,8 @@ int rtrmnet_ctl_changevnd(rmnetctl_hndl_t *hndl, char *devname, char *vndname,
*/
int rtrmnet_ctl_getvnd(rmnetctl_hndl_t *hndl, char *vndname,
uint16_t *error_code, uint16_t *mux_id,
uint32_t *flagconfig);
uint32_t *flagconfig, uint16_t *agg_count,
uint16_t *agg_size, uint32_t *agg_time);
/* @brief Public API to bridge a vnd and device
* @details Message type is RTM_NEWLINK

View File

@@ -1512,7 +1512,8 @@ int rtrmnet_ctl_changevnd(rmnetctl_hndl_t *hndl, char *devname, char *vndname,
int rtrmnet_ctl_getvnd(rmnetctl_hndl_t *hndl, char *vndname,
uint16_t *error_code, uint16_t *mux_id,
uint32_t *flagconfig)
uint32_t *flagconfig, uint16_t *agg_count,
uint16_t *agg_size, uint32_t *agg_time)
{
struct nlmsg req;
struct nlmsghdr *resp;
@@ -1596,6 +1597,18 @@ int rtrmnet_ctl_getvnd(rmnetctl_hndl_t *hndl, char *vndname,
RTA_DATA(tb[RMNETCTL_IFLA_FLAGS]);
*flagconfig = flags->flags;
}
if (tb[RMNETCTL_IFLA_UPLINK_PARAMS]) {
struct rmnetctl_uplink_params *ul_agg;
ul_agg = (struct rmnetctl_uplink_params *)
RTA_DATA(tb[RMNETCTL_IFLA_UPLINK_PARAMS]);
if (agg_count)
*agg_count = ul_agg->packet_count;
if (agg_size)
*agg_size = ul_agg->byte_count;
if (agg_time)
*agg_time = ul_agg->time_limit;
}
free(resp);
return RMNETCTL_API_SUCCESS;