diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2013-11-20 15:29:19 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2013-11-20 15:29:19 -0800 |
commit | 5ed721209059acb4277e6aed862f415dd2d5f623 (patch) | |
tree | bfcfdfde6dd86cafbaf69dca328078ecc0203018 | |
parent | dde5d94329dd1bca139302f41aac3f78bcabcd85 (diff) | |
parent | 97a1e987e2eb90b78b207c334df56addd377aa6a (diff) | |
download | android_vendor_qcom_opensource_dataservices-5ed721209059acb4277e6aed862f415dd2d5f623.tar.gz android_vendor_qcom_opensource_dataservices-5ed721209059acb4277e6aed862f415dd2d5f623.tar.bz2 android_vendor_qcom_opensource_dataservices-5ed721209059acb4277e6aed862f415dd2d5f623.zip |
Merge "rmnetctl: Changes for flow handles"
-rw-r--r-- | rmnetctl/cli/rmnetcli.c | 22 | ||||
-rw-r--r-- | rmnetctl/inc/librmnetctl.h | 28 | ||||
-rw-r--r-- | rmnetctl/src/librmnetctl.c | 34 |
3 files changed, 84 insertions, 0 deletions
diff --git a/rmnetctl/cli/rmnetcli.c b/rmnetctl/cli/rmnetcli.c index 405626d..01b5444 100644 --- a/rmnetctl/cli/rmnetcli.c +++ b/rmnetctl/cli/rmnetcli.c @@ -184,6 +184,14 @@ static void rmnet_api_usage(void) printf(_5TABS" network device node. dev_name"); printf(_5TABS" cannot be larger than 15."); 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) { @@ -315,6 +323,13 @@ static int rmnet_api_call(int argc, char *argv[]) _RMNETCLI_CHECKNULL(argv[1]); return_code = rmnet_set_link_ingress_data_format(handle, _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")) { _RMNETCLI_CHECKNULL(argv[1]); 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("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")) { _RMNETCLI_CHECKNULL(argv[1]); _RMNETCLI_CHECKNULL(argv[2]); diff --git a/rmnetctl/inc/librmnetctl.h b/rmnetctl/inc/librmnetctl.h index 29ce442..45a5e02 100644 --- a/rmnetctl/inc/librmnetctl.h +++ b/rmnetctl/inc/librmnetctl.h @@ -58,6 +58,10 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define RMNETCTL_NEW_VND 1 /* Flag to free a new virtual network device*/ #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 { /* API succeeded. This should always be the first element. */ @@ -374,5 +378,29 @@ int rmnet_get_vnd_name(rmnetctl_hndl_t *hndl, char *buf, 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 */ diff --git a/rmnetctl/src/librmnetctl.c b/rmnetctl/src/librmnetctl.c index 2975103..31fa417 100644 --- a/rmnetctl/src/librmnetctl.c +++ b/rmnetctl/src/librmnetctl.c @@ -753,3 +753,37 @@ int rmnet_get_vnd_name(rmnetctl_hndl_t *hndl, 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; +} + |