Skip to content
Snippets Groups Projects
Commit a9731655 authored by Harout Hedeshian's avatar Harout Hedeshian
Browse files

rmnetctl: Support of unset logical EP

Adding support for unsetting the logical end point configuration
for a network device (Virtual or Physical). This is required
for clean-up and reference accounting process.

CRs-Fixed: 596227
Change-Id: Ifbb65de69c7bee64d930cf413b0058cb32cf8de7
parent 5ed72120
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
R M N E T C L I . C
Copyright (c) 2013, The Linux Foundation. All rights reserved.
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -151,6 +151,13 @@ static void rmnet_api_usage(void)
printf(_5TABS" cannot be larger");
printf(_5TABS" than 15 tcharacters");
printf(_5TABS" Returns the status code\n\n");
printf("rmnetcli unsetlepc <logical_ep_id> Un-sets the logical");
printf(_2TABS" <dev_name> endpoint configuration for");
printf(_5TABS" a particular link.");
printf(_5TABS" integers from -1 to 31.");
printf(_5TABS" dev_name cannot be larger");
printf(_5TABS" than 15 tcharacters");
printf(_5TABS" Returns the status code\n\n");
printf("rmnetcli getlepc <logical_ep_id> Sets the logical");
printf(_2TABS" <dev_name> enpoint configuration for a");
printf(_5TABS" particular link.");
......@@ -179,7 +186,7 @@ static void rmnet_api_usage(void)
printf(_5TABS" 15 chars. Returns");
printf(_5TABS" the status code\n\n");
printf("rmnetcli getvndname <dev_id> Get name of");
printf(_5TABS" network device node from id");
printf(_5TABS" network device node from id\n\n");
printf("rmnetcli freevnd <dev_id> Removes virtual");
printf(_5TABS" network device node. dev_name");
printf(_5TABS" cannot be larger than 15.");
......@@ -369,6 +376,10 @@ static int rmnet_api_call(int argc, char *argv[])
return_code = rmnet_set_logical_ep_config(handle,
_STRTOI32(argv[1]), _STRTOUI8(argv[2]), argv[3], argv[4],
&error_number);
} else if (!strcmp(*argv, "unsetlepc")) {
_RMNETCLI_CHECKNULL(argv[1]);
return_code = rmnet_unset_logical_ep_config(handle,
_STRTOI32(argv[1]), argv[2], &error_number);
}
print_rmnet_api_status(return_code, error_number);
rmnetctl_cleanup(handle);
......
......@@ -2,7 +2,7 @@
L I B R M N E T C T L . H
Copyright (c) 2013, The Linux Foundation. All rights reserved.
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -294,6 +294,25 @@ int rmnet_set_logical_ep_config(rmnetctl_hndl_t *hndl,
uint16_t *error_code);
/*!
* @brief Public API to un-set the logical endpoint configuration for a
* particular link.
* @details Message type is RMNET_NETLINK_UNSET_LOGICAL_EP_CONFIG.
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
* @param logical_ep_id Logical end point id on which the configuration is to be
* un-set
* @param dev_name Device on which to un-set the logical end point configuration
* @param error_code Status code of this operation returned from the kernel
* @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_unset_logical_ep_config(rmnetctl_hndl_t *hndl,
int32_t ep_id,
const char *dev_name,
uint16_t *error_code);
/*!
* @brief Public API to get the logical endpoint configuration for a
* particular link.
* @details Message type is RMNET_NETLINK_GET_LOGICAL_EP_CONFIG.
......
......@@ -2,7 +2,7 @@
L I B R M N E T C T L . C
Copyright (c) 2013, The Linux Foundation. All rights reserved.
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -616,6 +616,44 @@ int rmnet_set_logical_ep_config(rmnetctl_hndl_t *hndl,
return return_code;
}
int rmnet_unset_logical_ep_config(rmnetctl_hndl_t *hndl,
int32_t ep_id,
const char *dev_name,
uint16_t *error_code) {
struct rmnet_nl_msg_s request, response;
int str_len = -1, return_code = RMNETCTL_LIB_ERR;
do {
if ((!hndl) || ((ep_id < -1) || (ep_id > 31)) || (!error_code) ||
_rmnetctl_check_dev_name(dev_name)) {
return_code = RMNETCTL_INVALID_ARG;
break;
}
request.message_type = RMNET_NETLINK_UNSET_LOGICAL_EP_CONFIG;
request.arg_length = RMNET_MAX_STR_LEN + sizeof(int32_t);
str_len = strlcpy((char *)(request.local_ep_config.dev),
dev_name,
RMNET_MAX_STR_LEN);
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
break;
request.local_ep_config.ep_id = ep_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;
}
int rmnet_get_logical_ep_config(rmnetctl_hndl_t *hndl,
int32_t ep_id,
const char *dev_name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment