Lines Matching refs:mb
76 struct mbuf *mb; in mlx4_en_alloc_mbuf() local
79 mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ring->rx_mb_size); in mlx4_en_alloc_mbuf()
80 if (likely(mb != NULL)) in mlx4_en_alloc_mbuf()
81 mb->m_pkthdr.len = mb->m_len = ring->rx_mb_size; in mlx4_en_alloc_mbuf()
83 mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MLX4_EN_MAX_RX_BYTES); in mlx4_en_alloc_mbuf()
84 if (likely(mb != NULL)) { in mlx4_en_alloc_mbuf()
85 struct mbuf *mb_head = mb; in mlx4_en_alloc_mbuf()
88 mb->m_len = MLX4_EN_MAX_RX_BYTES; in mlx4_en_alloc_mbuf()
89 mb->m_pkthdr.len = MLX4_EN_MAX_RX_BYTES; in mlx4_en_alloc_mbuf()
94 mb = (mb->m_next = m_getjcl(M_NOWAIT, MT_DATA, 0, MLX4_EN_MAX_RX_BYTES)); in mlx4_en_alloc_mbuf()
95 if (unlikely(mb == NULL)) { in mlx4_en_alloc_mbuf()
99 mb->m_len = MLX4_EN_MAX_RX_BYTES; in mlx4_en_alloc_mbuf()
103 mb = mb_head; in mlx4_en_alloc_mbuf()
106 return (mb); in mlx4_en_alloc_mbuf()
115 struct mbuf *mb; in mlx4_en_alloc_buf() local
124 mb = mlx4_en_alloc_mbuf(ring); in mlx4_en_alloc_buf()
125 if (unlikely(mb == NULL)) in mlx4_en_alloc_buf()
129 m_adj(mb, MLX4_NET_IP_ALIGN); in mlx4_en_alloc_buf()
133 mb, ring->spare.segs, &nsegs, BUS_DMA_NOWAIT); in mlx4_en_alloc_buf()
135 m_freem(mb); in mlx4_en_alloc_buf()
140 ring->spare.mbuf = mb; in mlx4_en_alloc_buf()
160 mb = mlx4_en_alloc_mbuf(ring); in mlx4_en_alloc_buf()
161 if (unlikely(mb == NULL)) in mlx4_en_alloc_buf()
165 m_adj(mb, MLX4_NET_IP_ALIGN); in mlx4_en_alloc_buf()
168 mb, segs, &nsegs, BUS_DMA_NOWAIT); in mlx4_en_alloc_buf()
170 m_freem(mb); in mlx4_en_alloc_buf()
188 mb_list->mbuf = mb; in mlx4_en_alloc_buf()
586 static void validate_loopback(struct mlx4_en_priv *priv, struct mbuf *mb) in validate_loopback() argument
592 if (*(mb->m_data + offset) != (unsigned char) (i & 0xff)) in validate_loopback()
599 m_freem(mb); in validate_loopback()
630 struct mbuf *mb; in mlx4_en_rx_mb() local
634 (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { in mlx4_en_rx_mb()
637 mb->m_pkthdr.len = mb->m_len = length; in mlx4_en_rx_mb()
640 mb->m_data += MLX4_NET_IP_ALIGN; in mlx4_en_rx_mb()
645 bcopy(mtod(mb_list->mbuf, caddr_t), mtod(mb, caddr_t), length); in mlx4_en_rx_mb()
647 return (mb); in mlx4_en_rx_mb()
651 mb = mb_list->mbuf; in mlx4_en_rx_mb()
658 if (unlikely(length > mb->m_pkthdr.len)) in mlx4_en_rx_mb()
659 length = mb->m_pkthdr.len; in mlx4_en_rx_mb()
663 mb->m_len = mb->m_pkthdr.len = length; in mlx4_en_rx_mb()
665 mb->m_pkthdr.len = length; in mlx4_en_rx_mb()
666 for (mb_head = mb; mb != NULL; mb = mb->m_next) { in mlx4_en_rx_mb()
667 if (mb->m_len > length) in mlx4_en_rx_mb()
668 mb->m_len = length; in mlx4_en_rx_mb()
669 length -= mb->m_len; in mlx4_en_rx_mb()
671 if (likely(mb->m_next != NULL)) { in mlx4_en_rx_mb()
673 m_freem(mb->m_next); in mlx4_en_rx_mb()
674 mb->m_next = NULL; in mlx4_en_rx_mb()
680 mb = mb_head; in mlx4_en_rx_mb()
682 return (mb); in mlx4_en_rx_mb()
745 struct mbuf *mb; in mlx4_en_process_rx_cq() local
786 mb = mlx4_en_rx_mb(priv, ring, rx_desc, mb_list, length); in mlx4_en_process_rx_cq()
787 if (unlikely(!mb)) { in mlx4_en_process_rx_cq()
796 validate_loopback(priv, mb); in mlx4_en_process_rx_cq()
801 mb->m_pkthdr.flowid = be32_to_cpu(cqe->immed_rss_invalid); in mlx4_en_process_rx_cq()
802 M_HASHTYPE_SET(mb, mlx4_en_rss_hash(cqe->status, udp_rss)); in mlx4_en_process_rx_cq()
803 mb->m_pkthdr.rcvif = dev; in mlx4_en_process_rx_cq()
806 mb->m_pkthdr.ether_vtag = be16_to_cpu(cqe->sl_vid); in mlx4_en_process_rx_cq()
807 mb->m_flags |= M_VLANTAG; in mlx4_en_process_rx_cq()
814 mb->m_pkthdr.csum_flags = in mlx4_en_process_rx_cq()
817 mb->m_pkthdr.csum_data = htons(0xffff); in mlx4_en_process_rx_cq()
828 tcp_lro_rx(&ring->lro, mb, 0) == 0) in mlx4_en_process_rx_cq()
836 mb->m_pkthdr.csum_flags = 0; in mlx4_en_process_rx_cq()
841 if_input(dev, mb); in mlx4_en_process_rx_cq()