/** * rmnet_map_command() - Entry point for handling MAP commands * @skb: Socket buffer containing the MAP command message * @config: Physical end-point configuration of ingress device * * Process MAP command frame and send N/ACK message as appropriate. Message cmd * name is decoded here and appropriate handler is called. * * Return: * - RX_HANDLER_CONSUMED. Command frames are always consumed. */ rx_handler_result_t rmnet_map_command(struct sk_buff *skb, struct rmnet_phys_ep_conf_s *config) { struct rmnet_map_control_command_s *cmd; unsigned char command_name; unsigned char rc = 0; if (unlikely(!skb)) BUG(); cmd = RMNET_MAP_GET_CMD_START(skb); command_name = cmd->command_name; if (command_name < RMNET_MAP_COMMAND_ENUM_LENGTH) rmnet_map_command_stats[command_name]++; switch (command_name) { case RMNET_MAP_COMMAND_FLOW_ENABLE: rc = rmnet_map_do_flow_control(skb, config, 1); break; case RMNET_MAP_COMMAND_FLOW_DISABLE: rc = rmnet_map_do_flow_control(skb, config, 0); break; default: rmnet_map_command_stats[RMNET_MAP_COMMAND_UNKNOWN]++; LOGM("Uknown MAP command: %d", command_name); rc = RMNET_MAP_COMMAND_UNSUPPORTED; break; } rmnet_map_send_ack(skb, rc, config); return RX_HANDLER_CONSUMED; }
/* Process MAP command frame and send N/ACK message as appropriate. Message cmd * name is decoded here and appropriate handler is called. */ void rmnet_map_command(struct sk_buff *skb, struct rmnet_port *port) { struct rmnet_map_control_command *cmd; unsigned char command_name; unsigned char rc = 0; cmd = RMNET_MAP_GET_CMD_START(skb); command_name = cmd->command_name; switch (command_name) { case RMNET_MAP_COMMAND_FLOW_ENABLE: rc = rmnet_map_do_flow_control(skb, port, 1); break; case RMNET_MAP_COMMAND_FLOW_DISABLE: rc = rmnet_map_do_flow_control(skb, port, 0); break; default: rc = RMNET_MAP_COMMAND_UNSUPPORTED; kfree_skb(skb); break; } if (rc == RMNET_MAP_COMMAND_ACK) rmnet_map_send_ack(skb, rc, port); }