/** * rmnet_set_egress_data_format() - Set egress data format on network device * @dev: Device to egress data format on * @egress_data_format: 32-bit unsigned bitmask of egress format * * Network device must already have association with RmNet Data driver * todo: Bounds check on agg_* * * Return: * - RMNET_CONFIG_OK if successful * - RMNET_CONFIG_NO_SUCH_DEVICE dev is null * - RMNET_CONFIG_UNKNOWN_ERROR net_device private section is null */ int rmnet_set_egress_data_format(struct net_device *dev, uint32_t egress_data_format, uint16_t agg_size, uint16_t agg_count) { struct rmnet_phys_ep_conf_s *config; ASSERT_RTNL(); LOGL("%s(%s,0x%08X, %d, %d);", __func__, dev->name, egress_data_format, agg_size, agg_count); if (!dev) return RMNET_CONFIG_NO_SUCH_DEVICE; config = _rmnet_get_phys_ep_config(dev); if (!config) return RMNET_CONFIG_UNKNOWN_ERROR; config->egress_data_format = egress_data_format; config->egress_agg_size = agg_size; config->egress_agg_count = agg_count; return RMNET_CONFIG_OK; }
static inline void _rmnet_netlink_get_link_ingress_data_format (struct rmnet_nl_msg_s *rmnet_header, struct rmnet_nl_msg_s *resp_rmnet) { struct net_device *dev; struct rmnet_phys_ep_conf_s *config; _RMNET_NETLINK_NULL_CHECKS(); resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNCODE; dev = dev_get_by_name(&init_net, rmnet_header->data_format.dev); if (!dev) { resp_rmnet->return_code = RMNET_CONFIG_NO_SUCH_DEVICE; return; } config = _rmnet_get_phys_ep_config(dev); if (!config) { resp_rmnet->return_code = RMNET_CONFIG_INVALID_REQUEST; return; } /* Begin Data */ resp_rmnet->crd = RMNET_NETLINK_MSG_RETURNDATA; resp_rmnet->arg_length = RMNET_NL_MSG_SIZE(data_format); resp_rmnet->data_format.flags = config->ingress_data_format; }
/** * rmnet_set_ingress_data_format() - Set ingress data format on network device * @dev: Device to ingress data format on * @egress_data_format: 32-bit unsigned bitmask of ingress format * * Network device must already have association with RmNet Data driver * * Return: * - RMNET_CONFIG_OK if successful * - RMNET_CONFIG_NO_SUCH_DEVICE dev is null * - RMNET_CONFIG_UNKNOWN_ERROR net_device private section is null */ int rmnet_set_ingress_data_format(struct net_device *dev, uint32_t ingress_data_format) { struct rmnet_phys_ep_conf_s *config; ASSERT_RTNL(); LOGL("%s(%s,0x%08X);", __func__, dev->name, ingress_data_format); if (!dev) return RMNET_CONFIG_NO_SUCH_DEVICE; config = _rmnet_get_phys_ep_config(dev); if (!config) return RMNET_CONFIG_INVALID_REQUEST; config->ingress_data_format = ingress_data_format; return RMNET_CONFIG_OK; }
/** * _rmnet_get_logical_ep() - Gets the logical end point configuration * structure for a network device * @dev: Device to get endpoint configuration from * @config_id: Logical endpoint id on device * Retrieves the logical_endpoint_config structure. * * Return: * - End point configuration structure * - NULL in case of an error */ struct rmnet_logical_ep_conf_s *_rmnet_get_logical_ep(struct net_device *dev, int config_id) { struct rmnet_phys_ep_conf_s *config; struct rmnet_logical_ep_conf_s *epconfig_l; if (rmnet_vnd_is_vnd(dev)) epconfig_l = rmnet_vnd_get_le_config(dev); else { config = _rmnet_get_phys_ep_config(dev); if (!config) return NULL; if (config_id == RMNET_LOCAL_LOGICAL_ENDPOINT) epconfig_l = &config->local_ep; else epconfig_l = &config->muxed_ep[config_id]; } return epconfig_l; }
/** * _rmnet_set_logical_endpoint_config() - Set logical endpoing config on device * @dev: Device to set endpoint configuration on * @config_id: logical endpoint id on device * @epconfig: endpoing configuration structure to set * * Return: * - RMNET_CONFIG_OK if successful * - RMNET_CONFIG_UNKNOWN_ERROR net_device private section is null * - RMNET_CONFIG_NO_SUCH_DEVICE if device to set config on is null * - RMNET_CONFIG_BAD_ARGUMENTS if logical endpoint id is out of range */ int _rmnet_set_logical_endpoint_config(struct net_device *dev, int config_id, struct rmnet_logical_ep_conf_s *epconfig) { struct rmnet_phys_ep_conf_s *config; struct rmnet_logical_ep_conf_s *epconfig_l; ASSERT_RTNL(); if (!dev) return RMNET_CONFIG_NO_SUCH_DEVICE; if (config_id < RMNET_LOCAL_LOGICAL_ENDPOINT || config_id >= RMNET_DATA_MAX_LOGICAL_EP) return RMNET_CONFIG_BAD_ARGUMENTS; if (rmnet_vnd_is_vnd(dev)) epconfig_l = rmnet_vnd_get_le_config(dev); else { config = _rmnet_get_phys_ep_config(dev); if (!config) return RMNET_CONFIG_UNKNOWN_ERROR; if (config_id == RMNET_LOCAL_LOGICAL_ENDPOINT) epconfig_l = &config->local_ep; else epconfig_l = &config->muxed_ep[config_id]; } memcpy(epconfig_l, epconfig, sizeof(struct rmnet_logical_ep_conf_s)); if (config_id == RMNET_LOCAL_LOGICAL_ENDPOINT) epconfig_l->mux_id = 0; else epconfig_l->mux_id = config_id; return RMNET_CONFIG_OK; }