/** * rmnet_map_do_flow_control() - Process MAP flow control command * @skb: Socket buffer containing the MAP flow control message * @config: Physical end-point configuration of ingress device * @enable: boolean for enable/disable * * Process in-band MAP flow control messages. Assumes mux ID is mapped to a * RmNet Data vitrual network device. * * Return: * - RMNET_MAP_COMMAND_UNSUPPORTED on any error * - RMNET_MAP_COMMAND_ACK on success */ static uint8_t rmnet_map_do_flow_control(struct sk_buff *skb, struct rmnet_phys_ep_conf_s *config, int enable) { struct rmnet_map_control_command_s *cmd; struct net_device *vnd; struct rmnet_logical_ep_conf_s *ep; uint8_t mux_id; uint16_t ip_family; uint16_t fc_seq; uint32_t qos_id; int r; if (unlikely(!skb || !config)) BUG(); mux_id = RMNET_MAP_GET_MUX_ID(skb); cmd = RMNET_MAP_GET_CMD_START(skb); if (mux_id >= RMNET_DATA_MAX_LOGICAL_EP) { LOGD("Got packet on %s with bad mux id %d", skb->dev->name, mux_id); rmnet_kfree_skb(skb, RMNET_STATS_SKBFREE_MAPC_BAD_MUX); return RX_HANDLER_CONSUMED; } ep = &(config->muxed_ep[mux_id]); if (!ep->refcount) { LOGD("Packet on %s:%d; has no logical endpoint config", skb->dev->name, mux_id); rmnet_kfree_skb(skb, RMNET_STATS_SKBFREE_MAPC_MUX_NO_EP); return RX_HANDLER_CONSUMED; } vnd = ep->egress_dev; ip_family = cmd->flow_control.ip_family; fc_seq = ntohs(cmd->flow_control.flow_control_seq_num); qos_id = ntohl(cmd->flow_control.qos_id); /* Ignore the ip family and pass the sequence number for both v4 and v6 * sequence. User space does not support creating dedicated flows for * the 2 protocols */ r = rmnet_vnd_do_flow_control(vnd, qos_id, fc_seq, fc_seq, enable); LOGD("dev:%s, qos_id:0x%08X, ip_family:%hd, fc_seq %hd, en:%d", skb->dev->name, qos_id, ip_family & 3, fc_seq, enable); if (r) return RMNET_MAP_COMMAND_UNSUPPORTED; else return RMNET_MAP_COMMAND_ACK; }
static u8 rmnet_map_do_flow_control(struct sk_buff *skb, struct rmnet_port *port, int enable) { struct rmnet_map_control_command *cmd; struct rmnet_endpoint *ep; struct net_device *vnd; u16 ip_family; u16 fc_seq; u32 qos_id; u8 mux_id; int r; mux_id = RMNET_MAP_GET_MUX_ID(skb); cmd = RMNET_MAP_GET_CMD_START(skb); if (mux_id >= RMNET_MAX_LOGICAL_EP) { kfree_skb(skb); return RX_HANDLER_CONSUMED; } ep = rmnet_get_endpoint(port, mux_id); if (!ep) { kfree_skb(skb); return RX_HANDLER_CONSUMED; } vnd = ep->egress_dev; ip_family = cmd->flow_control.ip_family; fc_seq = ntohs(cmd->flow_control.flow_control_seq_num); qos_id = ntohl(cmd->flow_control.qos_id); /* Ignore the ip family and pass the sequence number for both v4 and v6 * sequence. User space does not support creating dedicated flows for * the 2 protocols */ r = rmnet_vnd_do_flow_control(vnd, enable); if (r) { kfree_skb(skb); return RMNET_MAP_COMMAND_UNSUPPORTED; } else { return RMNET_MAP_COMMAND_ACK; } }