static void sq_prepare_task(struct hinic_sq_task *task) { task->pkt_info0 = HINIC_SQ_TASK_INFO0_SET(0, L2HDR_LEN) | HINIC_SQ_TASK_INFO0_SET(HINIC_L4_OFF_DISABLE, L4_OFFLOAD) | HINIC_SQ_TASK_INFO0_SET(HINIC_OUTER_L3TYPE_UNKNOWN, INNER_L3TYPE) | HINIC_SQ_TASK_INFO0_SET(HINIC_VLAN_OFF_DISABLE, VLAN_OFFLOAD) | HINIC_SQ_TASK_INFO0_SET(HINIC_PKT_NOT_PARSED, PARSE_FLAG); task->pkt_info1 = HINIC_SQ_TASK_INFO1_SET(HINIC_MEDIA_UNKNOWN, MEDIA_TYPE) | HINIC_SQ_TASK_INFO1_SET(0, INNER_L4_LEN) | HINIC_SQ_TASK_INFO1_SET(0, INNER_L3_LEN); task->pkt_info2 = HINIC_SQ_TASK_INFO2_SET(0, TUNNEL_L4_LEN) | HINIC_SQ_TASK_INFO2_SET(0, OUTER_L3_LEN) | HINIC_SQ_TASK_INFO2_SET(HINIC_TUNNEL_L4TYPE_UNKNOWN, TUNNEL_L4TYPE) | HINIC_SQ_TASK_INFO2_SET(HINIC_OUTER_L3TYPE_UNKNOWN, OUTER_L3TYPE); task->ufo_v6_identify = 0; task->pkt_info4 = HINIC_SQ_TASK_INFO4_SET(HINIC_L2TYPE_ETH, L2TYPE); task->zero_pad = 0; }
void hinic_set_tso_inner_l4(struct hinic_sq_task *task, u32 *queue_info, enum hinic_l4_offload_type l4_offload, u32 l4_len, u32 offset, u32 ip_ident, u32 mss) { u32 tso = 0, ufo = 0; if (l4_offload == TCP_OFFLOAD_ENABLE) tso = 1; else if (l4_offload == UDP_OFFLOAD_ENABLE) ufo = 1; task->ufo_v6_identify = ip_ident; task->pkt_info0 |= HINIC_SQ_TASK_INFO0_SET(l4_offload, L4_OFFLOAD); task->pkt_info0 |= HINIC_SQ_TASK_INFO0_SET(tso || ufo, TSO_FLAG); task->pkt_info1 |= HINIC_SQ_TASK_INFO1_SET(l4_len, INNER_L4LEN); *queue_info |= HINIC_SQ_CTRL_SET(offset, QUEUE_INFO_PLDOFF) | HINIC_SQ_CTRL_SET(tso, QUEUE_INFO_TSO) | HINIC_SQ_CTRL_SET(ufo, QUEUE_INFO_UFO) | HINIC_SQ_CTRL_SET(!!l4_offload, QUEUE_INFO_TCPUDP_CS); /* set MSS value */ *queue_info = HINIC_SQ_CTRL_CLEAR(*queue_info, QUEUE_INFO_MSS); *queue_info |= HINIC_SQ_CTRL_SET(mss, QUEUE_INFO_MSS); }
void hinic_task_set_inner_l3(struct hinic_sq_task *task, enum hinic_l3_offload_type l3_type, u32 network_len) { task->pkt_info0 |= HINIC_SQ_TASK_INFO0_SET(l3_type, INNER_L3TYPE); task->pkt_info1 |= HINIC_SQ_TASK_INFO1_SET(network_len, INNER_L3LEN); }
void hinic_set_cs_inner_l4(struct hinic_sq_task *task, u32 *queue_info, enum hinic_l4_offload_type l4_offload, u32 l4_len, u32 offset) { u32 tcp_udp_cs = 0, sctp = 0; u32 mss = HINIC_MSS_DEFAULT; if (l4_offload == TCP_OFFLOAD_ENABLE || l4_offload == UDP_OFFLOAD_ENABLE) tcp_udp_cs = 1; else if (l4_offload == SCTP_OFFLOAD_ENABLE) sctp = 1; task->pkt_info0 |= HINIC_SQ_TASK_INFO0_SET(l4_offload, L4_OFFLOAD); task->pkt_info1 |= HINIC_SQ_TASK_INFO1_SET(l4_len, INNER_L4LEN); *queue_info |= HINIC_SQ_CTRL_SET(offset, QUEUE_INFO_PLDOFF) | HINIC_SQ_CTRL_SET(tcp_udp_cs, QUEUE_INFO_TCPUDP_CS) | HINIC_SQ_CTRL_SET(sctp, QUEUE_INFO_SCTP); *queue_info = HINIC_SQ_CTRL_CLEAR(*queue_info, QUEUE_INFO_MSS); *queue_info |= HINIC_SQ_CTRL_SET(mss, QUEUE_INFO_MSS); }
void hinic_task_set_l2hdr(struct hinic_sq_task *task, u32 len) { task->pkt_info0 |= HINIC_SQ_TASK_INFO0_SET(len, L2HDR_LEN); }