Lines Matching refs:packet

103     IN  lm_packet_t     *packet,
131 packet->u1.tx.hdr_nbds = hdr_nbds;
134 static void lm_process_lso_packet(IN lm_packet_t *packet,
150 if ((packet->l2pkt_tx_info->lso_ip_hdr_len + packet->l2pkt_tx_info->lso_tcp_hdr_len) > 120) {
158 parse_bd_e1x->lso_mss = mm_cpu_to_le16(packet->l2pkt_tx_info->lso_mss);
159 parse_bd_e1x->ip_id = mm_cpu_to_le16(packet->l2pkt_tx_info->lso_ipid);
160 parse_bd_e1x->tcp_send_seq = mm_cpu_to_le32(packet->l2pkt_tx_info->lso_tcp_send_seq);
161 parse_bd_e1x->tcp_flags = packet->l2pkt_tx_info->lso_tcp_flags; // no endianity since it is u8_t
167 if GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_TCP_LSO_SNAP_FRAME)
175 parse_bd_e2->parsing_data |= ETH_TX_PARSE_BD_E2_LSO_MSS & (packet->l2pkt_tx_info->lso_mss << ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT);
180 SET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_COMPUTE_TCP_UDP_CKSUM);
182 if (!GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_IPV6_PACKET))
184 SET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_COMPUTE_IP_CKSUM);
190 start_bd->general_data |= ((packet->u1.tx.hdr_nbds & ETH_TX_START_BD_HDR_NBDS) << ETH_TX_START_BD_HDR_NBDS_SHIFT);
246 packet->size += (*frag)->size;
330 * copy given packet into available coalesce buffer of given txq
337 * - The coalesce buffer frag size will be set to the given packet size
338 * - RESOURCE - no available coalecse buffer for given packet
339 * (according to packet size)
363 /* Determine packet size. */
369 /* Find a buffer large enough for copying this packet. In the case
381 /* copy the packet into the coalesce buffer */
399 * check if packet requires copying to coalesce buf (packet too fregmented)
413 static u32_t const MAX_FETCH_BD = 13; /* HW max bds per packet capabitily */
423 /* Too fragmented LSO packet, check if it needs to be copied: */
439 "#copy to coalesce buffer IS REQUIRED for LSO packet, (lmpkt=0x%p,num_frags=%d)\n",
449 /* in non LSO, too fragmented packet should always
452 "#copy to coalesce buffer IS REQUIRED for NON LSO packet, (lmpkt=0x%p,num_frags=%d)\n",
467 * @param packet
474 lm_packet_t *packet)
479 if GET_FLAGS(packet->l2pkt_tx_info->flags , (LM_TX_FLAG_INSERT_VLAN_TAG | LM_TX_FLAG_VLAN_TAG_EXISTS))
481 DbgMessage(pdev, INFORMl2, "Outband vlan 0X%x\n",packet->l2pkt_tx_info->vlan_tag);
483 pri = LM_GET_PRI_FROM_VLAN(packet->l2pkt_tx_info->vlan_tag);
492 lm_packet_t *packet,
502 packet->l2pkt_tx_info->dst_mac_addr);
504 // Inner IP header offset in WORDs (16-bit) from start of packet
505 tunnel_data->ip_hdr_start_inner_w = (packet->l2pkt_tx_info->encap_packet_inner_frame_offset +
506 packet->l2pkt_tx_info->encap_packet_inner_ip_relative_offset) >> 1;
509 tunnel_data->pseudo_csum = mm_cpu_to_le16(packet->l2pkt_tx_info->tcp_pseudo_csum);
510 // Outer ip header checksum (with ALL ip header fields) for non-lso encaulated packet
511 tunnel_data->fw_ip_hdr_csum = mm_cpu_to_le16(packet->l2pkt_tx_info->fw_ip_csum);
513 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_IPV6_PACKET))
524 // Outer IP header offset in WORDs (16-bit) from start of packet
527 if (!(GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_IPV6_PACKET)))
530 parse_bd_2nd_ptr->global_data |= ( ((packet->l2pkt_tx_info->lso_ip_hdr_len) >> 1) << ETH_TX_PARSE_2ND_BD_IP_HDR_LEN_OUTER_W_SHIFT);
534 parse_bd_2nd_ptr->global_data |= (packet->l2pkt_tx_info->tcp_nonce_sum_bit << ETH_TX_PARSE_2ND_BD_NS_FLG_SHIFT);
537 parse_bd_2nd_ptr->tcp_send_seq = mm_cpu_to_le32(packet->l2pkt_tx_info->lso_tcp_send_seq);
538 parse_bd_2nd_ptr->tcp_flags = packet->l2pkt_tx_info->lso_tcp_flags; // no endianity since it is u8_t
544 parse_bd_2nd_ptr->fw_ip_csum_wo_len_flags_frag = mm_cpu_to_le16(packet->l2pkt_tx_info->fw_ip_csum);
545 parse_bd_2nd_ptr->hw_ip_id = mm_cpu_to_le16(packet->l2pkt_tx_info->lso_ipid);
547 parse_bd_2nd_ptr->fw_ip_hdr_to_payload_w = (packet->l2pkt_tx_info->encap_packet_inner_frame_offset +
548 packet->l2pkt_tx_info->encap_packet_inner_ip_relative_offset +
549 packet->l2pkt_tx_info->encap_packet_inner_tcp_relative_offset +
550 packet->l2pkt_tx_info->lso_tcp_hdr_len -
553 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_IPV6_PACKET))
578 lm_packet_t *packet,
614 if GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_VLAN_TAG_EXISTS)
619 if GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_TCP_LSO_SNAP_FRAME)
624 is_encapsulated_offload = (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_IS_ENCAP_PACKET) &&
625 GET_FLAGS(packet->l2pkt_tx_info->flags, (LM_TX_FLAG_COMPUTE_IP_CKSUM | LM_TX_FLAG_COMPUTE_TCP_UDP_CKSUM | LM_TX_FLAG_TCP_LSO_FRAME)));
629 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_TCP_LSO_FRAME))
631 // only for encapsulated packet with lso offload we need second parsing bd
634 // encapsulated packet header size includes both outer and inner headers
635 total_hlen_bytes = packet->l2pkt_tx_info->encap_packet_inner_frame_offset +
636 packet->l2pkt_tx_info->encap_packet_inner_ip_relative_offset +
637 packet->l2pkt_tx_info->encap_packet_inner_tcp_relative_offset +
638 packet->l2pkt_tx_info->lso_tcp_hdr_len;
643 total_hlen_bytes = packet->l2pkt_tx_info->lso_ip_hdr_len + packet->l2pkt_tx_info->lso_tcp_hdr_len + eth_hlen;
646 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_TCP_LSO_FRAME))
648 lm_pre_process_lso_packet(pdev, packet, frags, &split_required, total_hlen_bytes);
651 /* handle packet coalescing - if required, copy the too fregmented packet
653 if (lm_is_packet_coalescing_required(pdev, packet, frags, num_parsing_bds))
658 if (ERR_IF(packet->u1.tx.coalesce_buf != NULL))
666 pdev, tx_chain, packet, frags, &coalesce_buf);
672 packet->u1.tx.coalesce_buf = coalesce_buf; /* saved to be freed upon completion */
674 packet->u1.tx.hdr_nbds = 1;
691 if (packet->u1.tx.coalesce_buf)
694 lm_put_coalesce_buffer(pdev, tx_chain, packet->u1.tx.coalesce_buf);
695 packet->u1.tx.coalesce_buf = NULL;
700 packet->size = 0;
710 // set the number of parsing BDs in packet.
711 // parse_nbds is set to: the number of parsing BDs in packet - 1
715 // tunnel_exist should be set iff the packet is encapsulated
719 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_ENCAP_PACKET_IS_INNER_IPV6))
726 // set in case ipV6 packet
727 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_IPV6_PACKET))
733 if (GET_FLAGS(packet->l2pkt_tx_info->flags , LM_TX_FLAG_INSERT_VLAN_TAG))
735 DbgMessage(pdev, INFORMl2, "Outband vlan 0X%x\n",packet->l2pkt_tx_info->vlan_tag);
738 vlan_tag = packet->l2pkt_tx_info->vlan_tag;
740 else if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_VLAN_TAG_EXISTS))
742 DbgMessage(pdev, INFORMl2, "Inband vlan 0X%x\n",packet->l2pkt_tx_info->vlan_tag);
745 vlan_tag = packet->l2pkt_tx_info->vlan_tag;
750 ((u8_t*)&vlan_tag)[0] = packet->l2pkt_tx_info->eth_type[1]; //VF is in secure mode
751 ((u8_t*)&vlan_tag)[1] = packet->l2pkt_tx_info->eth_type[0]; //VF is in secure mode
753 ((u8_t*)&vlan_tag)[0] = packet->l2pkt_tx_info->eth_type[3]; //VF is in secure mode
754 ((u8_t*)&vlan_tag)[1] = packet->l2pkt_tx_info->eth_type[2]; //VF is in secure mode
755 DbgMessage(pdev, INFORMl2, "Inband vlan (from packet) 0X%x\n",vlan_tag);
765 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_FORCE_VLAN_MODE))
771 packet->size += frag->size;
796 // lso offload for encapsulated packet - two parsing bds are required
805 fill_bds_for_encapsulated_packet(pdev, packet, &parse_bd_e2->data.tunnel_data, parse_bd_2nd_ptr, eth_hlen);
813 if GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_TCP_LSO_FRAME)
816 lm_process_lso_packet(packet, pdev, tx_chain, frags, parse_bd_ptr, start_bd,
828 // the parsing bd) will be of the above type.total_pkt_bytes will hold the total packet length,
852 packet->size += frag->size;
860 total_pkt_bytes_bd->total_pkt_bytes = mm_cpu_to_le16((u16_t) packet->size);
865 //It is definitely legit for a packet to be csum offloaded with or without LSO!
866 //If the packet is LSO, we must enter here!!!!
867 if (GET_FLAGS(packet->l2pkt_tx_info->flags, (LM_TX_FLAG_COMPUTE_IP_CKSUM | LM_TX_FLAG_COMPUTE_TCP_UDP_CKSUM)))
869 // non-encapsulated packet: set bit if LM_TX_FLAG_COMPUTE_IP_CKSUM is on (LM_TX_FLAG_ENCAP_PACKET_IS_INNER_IPV6 is always equal to zero)
870 // encapsulated packet: set bit if LM_TX_FLAG_COMPUTE_IP_CKSUM is on and inner ip header is ipv4
871 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_COMPUTE_IP_CKSUM) &&
872 (!GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_ENCAP_PACKET_IS_INNER_IPV6)))
877 if (GET_FLAGS(packet->l2pkt_tx_info->flags, LM_TX_FLAG_COMPUTE_TCP_UDP_CKSUM))
880 if(packet->l2pkt_tx_info->cs_any_offset)
894 parse_bd_e1x->ip_hlen_w = packet->l2pkt_tx_info->lso_ip_hdr_len >> 1;
896 parse_bd_e1x->total_hlen_w = mm_cpu_to_le16((packet->l2pkt_tx_info->lso_ip_hdr_len >> 1) + ( (eth_hlen) >> 1));
898 if(packet->l2pkt_tx_info->flags & LM_TX_FLAG_TCP_LSO_SNAP_FRAME) {
902 if (packet->l2pkt_tx_info->flags & LM_TX_FLAG_COMPUTE_TCP_UDP_CKSUM)
904 parse_bd_e1x->tcp_pseudo_csum = mm_cpu_to_le16(packet->l2pkt_tx_info->tcp_pseudo_csum);
905 parse_bd_e1x->global_data |= (packet->l2pkt_tx_info->tcp_nonce_sum_bit << ETH_TX_PARSE_BD_E1X_NS_FLG_SHIFT);
913 // TCP header Offset in WORDs from start of packet
916 val = (( packet->l2pkt_tx_info->encap_packet_inner_frame_offset +
917 packet->l2pkt_tx_info->encap_packet_inner_ip_relative_offset +
918 packet->l2pkt_tx_info->encap_packet_inner_tcp_relative_offset ) >> 1 );
921 if (packet->l2pkt_tx_info->encap_packet_inner_tcp_relative_offset > 40) {
927 val = ((packet->l2pkt_tx_info->lso_ip_hdr_len + eth_hlen) >> 1);
929 if (packet->l2pkt_tx_info->lso_ip_hdr_len > 40) {
936 val = (packet->l2pkt_tx_info->lso_tcp_hdr_len >> 2);
951 packet->l2pkt_tx_info->dst_mac_addr);
955 packet->l2pkt_tx_info->src_mac_addr);
963 if (IS_ETH_MULTICAST(packet->l2pkt_tx_info->dst_mac_addr))
965 if (IS_ETH_BROADCAST(packet->l2pkt_tx_info->dst_mac_addr))
989 // to tx_chain->bd_left when the packet is sent.
990 packet->u1.tx.bd_used = start_bd_nbd += (u16_t)frags->cnt;
992 packet->u1.tx.next_bd_idx = lm_bd_chain_prod_idx(&tx_chain->bd_chain);
993 tx_chain->prod_bseq += packet->size;
995 /* There is a PBF limitation on minimum packet size (9B)
996 * We assert since we do not expect packet length < 14 */
997 DbgBreakIfFastPath(packet->size < ETHERNET_PACKET_HEADER_SIZE);
1036 s_list_push_tail(&tx_chain->active_descq, &packet->link);
1038 //in case of a packet consisting of 1 frag only, but with the use of parsing info BD,
1122 /* Advance the old_idx to the start bd_idx of the next packet. */