rmnetctl: Changes for flow handles
Added an option to add or delete the modem flow handle or tc flow handle for a given virtual network device CRs-fixed: 568534 Change-Id: Iaf0b7ecc4e2059e24183567708be08afdd8d9263
This commit is contained in:
@@ -184,6 +184,14 @@ static void rmnet_api_usage(void)
|
|||||||
printf(_5TABS" network device node. dev_name");
|
printf(_5TABS" network device node. dev_name");
|
||||||
printf(_5TABS" cannot be larger than 15.");
|
printf(_5TABS" cannot be larger than 15.");
|
||||||
printf(_5TABS" Returns the status code\n\n");
|
printf(_5TABS" Returns the status code\n\n");
|
||||||
|
printf("rmnetcli addvnctcflow <dev_id> Add a modem flow");
|
||||||
|
printf(_2TABS" <mdm_flow_hndl> handle - tc flow handle");
|
||||||
|
printf(_2TABS" <tc_flow_hndl> mapping for a virtual network");
|
||||||
|
printf(_2TABS" device node\n\n");
|
||||||
|
printf("rmnetcli delvnctcflow <dev_id> Delete a modem flow");
|
||||||
|
printf(_2TABS" <mdm_flow_hndl> handle - tc flow handle");
|
||||||
|
printf(_2TABS" <tc_flow_hndl> mapping for a virtual network");
|
||||||
|
printf(_2TABS" device node\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_rmnetctl_lib_errors(uint16_t error_number) {
|
static void print_rmnetctl_lib_errors(uint16_t error_number) {
|
||||||
@@ -315,6 +323,13 @@ static int rmnet_api_call(int argc, char *argv[])
|
|||||||
_RMNETCLI_CHECKNULL(argv[1]);
|
_RMNETCLI_CHECKNULL(argv[1]);
|
||||||
return_code = rmnet_set_link_ingress_data_format(handle,
|
return_code = rmnet_set_link_ingress_data_format(handle,
|
||||||
_STRTOUI32(argv[1]), argv[2], &error_number);
|
_STRTOUI32(argv[1]), argv[2], &error_number);
|
||||||
|
} else if (!strcmp(*argv, "delvnctcflow")) {
|
||||||
|
_RMNETCLI_CHECKNULL(argv[1]);
|
||||||
|
_RMNETCLI_CHECKNULL(argv[2]);
|
||||||
|
_RMNETCLI_CHECKNULL(argv[3]);
|
||||||
|
return_code = rmnet_add_del_vnd_tc_flow(handle,
|
||||||
|
_STRTOUI32(argv[1]), _STRTOUI32(argv[2]), _STRTOUI32(argv[3]),
|
||||||
|
RMNETCTL_DEL_FLOW, &error_number);
|
||||||
} else if (!strcmp(*argv, "getlepc")) {
|
} else if (!strcmp(*argv, "getlepc")) {
|
||||||
_RMNETCLI_CHECKNULL(argv[1]);
|
_RMNETCLI_CHECKNULL(argv[1]);
|
||||||
uint8_t rmnet_mode;
|
uint8_t rmnet_mode;
|
||||||
@@ -334,6 +349,13 @@ static int rmnet_api_call(int argc, char *argv[])
|
|||||||
printf("rmnet_mode is %u\n", rmnet_mode);
|
printf("rmnet_mode is %u\n", rmnet_mode);
|
||||||
printf("egress_dev_name is %s\n", egress_dev_name);
|
printf("egress_dev_name is %s\n", egress_dev_name);
|
||||||
}
|
}
|
||||||
|
} else if (!strcmp(*argv, "addvnctcflow")) {
|
||||||
|
_RMNETCLI_CHECKNULL(argv[1]);
|
||||||
|
_RMNETCLI_CHECKNULL(argv[2]);
|
||||||
|
_RMNETCLI_CHECKNULL(argv[3]);
|
||||||
|
return_code = rmnet_add_del_vnd_tc_flow(handle,
|
||||||
|
_STRTOUI32(argv[1]), _STRTOUI32(argv[2]), _STRTOUI32(argv[3]),
|
||||||
|
RMNETCTL_ADD_FLOW, &error_number);
|
||||||
} else if (!strcmp(*argv, "setledf")) {
|
} else if (!strcmp(*argv, "setledf")) {
|
||||||
_RMNETCLI_CHECKNULL(argv[1]);
|
_RMNETCLI_CHECKNULL(argv[1]);
|
||||||
_RMNETCLI_CHECKNULL(argv[2]);
|
_RMNETCLI_CHECKNULL(argv[2]);
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define RMNETCTL_NEW_VND 1
|
#define RMNETCTL_NEW_VND 1
|
||||||
/* Flag to free a new virtual network device*/
|
/* Flag to free a new virtual network device*/
|
||||||
#define RMNETCTL_FREE_VND 0
|
#define RMNETCTL_FREE_VND 0
|
||||||
|
/* Flag to add a new flow*/
|
||||||
|
#define RMNETCTL_ADD_FLOW 1
|
||||||
|
/* Flag to delete an existing flow*/
|
||||||
|
#define RMNETCTL_DEL_FLOW 0
|
||||||
|
|
||||||
enum rmnetctl_error_codes_e {
|
enum rmnetctl_error_codes_e {
|
||||||
/* API succeeded. This should always be the first element. */
|
/* API succeeded. This should always be the first element. */
|
||||||
@@ -374,5 +378,29 @@ int rmnet_get_vnd_name(rmnetctl_hndl_t *hndl,
|
|||||||
char *buf,
|
char *buf,
|
||||||
uint32_t buflen);
|
uint32_t buflen);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Public API to set or clear a flow
|
||||||
|
* @details Message type is RMNET_NETLINK_ADD_VND_TC_FLOW or
|
||||||
|
* RMNET_NETLINK_DEL_VND_TC_FLOW based on the flag for set_flow
|
||||||
|
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||||
|
* @param id Node number to set or clear the flow on the virtual network
|
||||||
|
* device node
|
||||||
|
* @param map_flow_id Flow handle of the modem
|
||||||
|
* @param tc_flow_id Software flow handle
|
||||||
|
* @param set_flow sets the flow if RMNET_NETLINK_SET_FLOW or
|
||||||
|
* clears the flow if RMNET_NETLINK_CLEAR_FLOW
|
||||||
|
* @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.
|
||||||
|
* Check error_code
|
||||||
|
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||||
|
*/
|
||||||
|
int rmnet_add_del_vnd_tc_flow(rmnetctl_hndl_t *hndl,
|
||||||
|
uint32_t id,
|
||||||
|
uint32_t map_flow_id,
|
||||||
|
uint32_t tc_flow_id,
|
||||||
|
uint8_t set_flow,
|
||||||
|
uint16_t *error_code);
|
||||||
|
|
||||||
#endif /* not defined LIBRMNETCTL_H */
|
#endif /* not defined LIBRMNETCTL_H */
|
||||||
|
|
||||||
|
|||||||
@@ -753,3 +753,37 @@ int rmnet_get_vnd_name(rmnetctl_hndl_t *hndl,
|
|||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rmnet_add_del_vnd_tc_flow(rmnetctl_hndl_t *hndl,
|
||||||
|
uint32_t id,
|
||||||
|
uint32_t map_flow_id,
|
||||||
|
uint32_t tc_flow_id,
|
||||||
|
uint8_t set_flow,
|
||||||
|
uint16_t *error_code) {
|
||||||
|
struct rmnet_nl_msg_s request, response;
|
||||||
|
int return_code = RMNETCTL_LIB_ERR;
|
||||||
|
do {
|
||||||
|
if ((!hndl) || ((set_flow != RMNETCTL_ADD_FLOW) &&
|
||||||
|
(set_flow != RMNETCTL_DEL_FLOW))) {
|
||||||
|
return_code = RMNETCTL_INVALID_ARG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (set_flow == RMNETCTL_ADD_FLOW)
|
||||||
|
request.message_type = RMNET_NETLINK_ADD_VND_TC_FLOW;
|
||||||
|
else
|
||||||
|
request.message_type = RMNET_NETLINK_DEL_VND_TC_FLOW;
|
||||||
|
|
||||||
|
request.arg_length = (sizeof(uint32_t))*3;
|
||||||
|
request.flow_control.id = id;
|
||||||
|
request.flow_control.map_flow_id = map_flow_id;
|
||||||
|
request.flow_control.tc_flow_id = tc_flow_id;
|
||||||
|
|
||||||
|
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||||
|
!= RMNETCTL_SUCCESS)
|
||||||
|
break;
|
||||||
|
if (_rmnetctl_check_code(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||||
|
break;
|
||||||
|
return_code = _rmnetctl_set_codes(response.return_code, error_code);
|
||||||
|
} while(0);
|
||||||
|
return return_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user