Skip to content
Snippets Groups Projects
Commit 0f57f49c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "rmnetctl: Changes for guaranteed padding"

parents 2bd1a268 22fa3888
No related branches found
No related tags found
No related merge requests found
......@@ -125,8 +125,10 @@ static void rmnet_api_usage(void)
printf(_5TABS" byte unsigned integer");
printf(_5TABS" egress_flags\n\n");
printf("rmnetcli setlidf <ingress_flags> Sets the ingress");
printf(_2TABS" <dev_name> data format for a particular");
printf(_5TABS" link. egress_flags is 4");
printf(_2TABS" <tail_spacing> data format for a particular");
printf(_2TABS" <dev_name> link. ingress_flags is 4");
printf(_5TABS" byte unsigned integer.");
printf(_5TABS" tail_spacing is a one.");
printf(_5TABS" byte unsigned integer.");
printf(_5TABS" dev_name cannot be");
printf(_5TABS" larger than 15.");
......@@ -299,10 +301,12 @@ static int rmnet_api_call(int argc, char *argv[])
}
} else if (!strcmp(*argv, "getlidf")) {
uint32_t ingress_flags;
return_code = rmnet_get_link_ingress_data_format(handle,
argv[1], &ingress_flags, &error_number);
uint8_t tail_spacing;
return_code = rmnet_get_link_ingress_data_format_tailspace(
handle, argv[1], &ingress_flags, &tail_spacing, &error_number);
if (return_code == RMNETCTL_SUCCESS) {
printf("ingress_flags is %u\n", ingress_flags);
printf("tail_spacing is %u\n", tail_spacing);
}
} else if (!strcmp(*argv, "newvndprefix")) {
_RMNETCLI_CHECKNULL(argv[1]);
......@@ -328,8 +332,11 @@ static int rmnet_api_call(int argc, char *argv[])
_STRTOUI32(argv[1]), &error_number, RMNETCTL_FREE_VND);
} else if (!strcmp(*argv, "setlidf")) {
_RMNETCLI_CHECKNULL(argv[1]);
return_code = rmnet_set_link_ingress_data_format(handle,
_STRTOUI32(argv[1]), argv[2], &error_number);
_RMNETCLI_CHECKNULL(argv[2]);
_RMNETCLI_CHECKNULL(argv[3]);
return_code = rmnet_set_link_ingress_data_format_tailspace(
handle, _STRTOUI32(argv[1]), _STRTOUI8(argv[2]), argv[3],
&error_number);
} else if (!strcmp(*argv, "delvnctcflow")) {
_RMNETCLI_CHECKNULL(argv[1]);
_RMNETCLI_CHECKNULL(argv[2]);
......
......@@ -238,6 +238,7 @@ int rmnet_get_link_egress_data_format(rmnetctl_hndl_t *hndl,
* @details Message type is RMNET_NETLINK_SET_LINK_INGRESS_DATA_FORMAT.
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
* @param ingress_flags Ingress flags from the device
* @param tail_spacing Tail spacing needed for the packet
* @param dev_name Device on which to set the ingress data format
* @param error_code Status code of this operation returned from the kernel
* @return RMNETCTL_SUCCESS if successful
......@@ -246,10 +247,11 @@ int rmnet_get_link_egress_data_format(rmnetctl_hndl_t *hndl,
* Check error_code
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
*/
int rmnet_set_link_ingress_data_format(rmnetctl_hndl_t *hndl,
uint32_t ingress_flags,
const char *dev_name,
uint16_t *error_code);
int rmnet_set_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
uint32_t ingress_flags,
uint8_t tail_spacing,
const char *dev_name,
uint16_t *error_code);
/*!
* @brief Public API to get the ingress data format for a particular link.
......@@ -257,6 +259,7 @@ int rmnet_set_link_ingress_data_format(rmnetctl_hndl_t *hndl,
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
* @param dev_name Device on which to get the ingress data format
* @param ingress_flags Ingress flags from the device
* @param tail_spacing Tail spacing needed for the packet
* @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
......@@ -264,10 +267,35 @@ int rmnet_set_link_ingress_data_format(rmnetctl_hndl_t *hndl,
* Check error_code
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
*/
int rmnet_get_link_ingress_data_format(rmnetctl_hndl_t *hndl,
const char *dev_name,
uint32_t *ingress_flags,
uint16_t *error_code);
int rmnet_get_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
const char *dev_name,
uint32_t *ingress_flags,
uint8_t *tail_spacing,
uint16_t *error_code);
inline int rmnet_set_link_ingress_data_format(rmnetctl_hndl_t *hndl,
uint32_t ingress_flags,
const char *dev_name,
uint16_t *error_code)
{
return rmnet_set_link_ingress_data_format_tailspace(hndl,
ingress_flags,
0,
dev_name,
error_code);
}
inline int rmnet_get_link_ingress_data_format(rmnetctl_hndl_t *hndl,
const char *dev_name,
uint32_t *ingress_flags,
uint16_t *error_code)
{
return rmnet_get_link_ingress_data_format_tailspace(hndl,
dev_name,
ingress_flags,
0,
error_code);
}
/*!
* @brief Public API to set the logical endpoint configuration for a
......
......@@ -501,10 +501,11 @@ int rmnet_get_link_egress_data_format(rmnetctl_hndl_t *hndl,
return return_code;
}
int rmnet_set_link_ingress_data_format(rmnetctl_hndl_t *hndl,
uint32_t ingress_flags,
const char *dev_name,
uint16_t *error_code) {
int rmnet_set_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
uint32_t ingress_flags,
uint8_t tail_spacing,
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 {
......@@ -523,6 +524,7 @@ int rmnet_set_link_ingress_data_format(rmnetctl_hndl_t *hndl,
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
break;
request.data_format.flags = ingress_flags;
request.data_format.tail_spacing = tail_spacing;
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
!= RMNETCTL_SUCCESS)
......@@ -536,14 +538,15 @@ int rmnet_set_link_ingress_data_format(rmnetctl_hndl_t *hndl,
return return_code;
}
int rmnet_get_link_ingress_data_format(rmnetctl_hndl_t *hndl,
const char *dev_name,
uint32_t *ingress_flags,
uint16_t *error_code) {
int rmnet_get_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
const char *dev_name,
uint32_t *ingress_flags,
uint8_t *tail_spacing,
uint16_t *error_code) {
struct rmnet_nl_msg_s request, response;
int str_len = -1, return_code = RMNETCTL_LIB_ERR;
do {
if ((!hndl) || (!ingress_flags) || (!error_code) ||
if ((!hndl) || (!error_code) ||
_rmnetctl_check_dev_name(dev_name)) {
return_code = RMNETCTL_INVALID_ARG;
break;
......@@ -565,7 +568,12 @@ int rmnet_get_link_ingress_data_format(rmnetctl_hndl_t *hndl,
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
break;
*ingress_flags = response.data_format.flags;
if (ingress_flags)
*ingress_flags = response.data_format.flags;
if (tail_spacing)
*tail_spacing = response.data_format.tail_spacing;
return_code = RMNETCTL_SUCCESS;
} while(0);
return return_code;
......
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