Deleted Added
full compact
nicvf_queues.c (297388) nicvf_queues.c (297389)
1/*
2 * Copyright (C) 2015 Cavium Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*
2 * Copyright (C) 2015 Cavium Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/vnic/nicvf_queues.c 297388 2016-03-29 13:28:13Z zbb $
26 * $FreeBSD: head/sys/dev/vnic/nicvf_queues.c 297389 2016-03-29 13:31:09Z zbb $
27 *
28 */
29#include <sys/cdefs.h>
27 *
28 */
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/vnic/nicvf_queues.c 297388 2016-03-29 13:28:13Z zbb $");
30__FBSDID("$FreeBSD: head/sys/dev/vnic/nicvf_queues.c 297389 2016-03-29 13:31:09Z zbb $");
31
32#include "opt_inet.h"
33#include "opt_inet6.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/bitset.h>
38#include <sys/bitstring.h>

--- 1727 unchanged lines hidden (view full) ---

1766 if (mbuf->m_len < ehdrlen + sizeof(struct ip)) {
1767 mbuf = m_pullup(mbuf, ehdrlen + sizeof(struct ip));
1768 sq->snd_buff[qentry].mbuf = mbuf;
1769 if (mbuf == NULL)
1770 return (ENOBUFS);
1771 }
1772
1773 ip = (struct ip *)(mbuf->m_data + ehdrlen);
31
32#include "opt_inet.h"
33#include "opt_inet6.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/bitset.h>
38#include <sys/bitstring.h>

--- 1727 unchanged lines hidden (view full) ---

1766 if (mbuf->m_len < ehdrlen + sizeof(struct ip)) {
1767 mbuf = m_pullup(mbuf, ehdrlen + sizeof(struct ip));
1768 sq->snd_buff[qentry].mbuf = mbuf;
1769 if (mbuf == NULL)
1770 return (ENOBUFS);
1771 }
1772
1773 ip = (struct ip *)(mbuf->m_data + ehdrlen);
1774 ip->ip_sum = 0;
1775 iphlen = ip->ip_hl << 2;
1776 poff = ehdrlen + iphlen;
1777
1778 if (mbuf->m_pkthdr.csum_flags != 0) {
1779 hdr->csum_l3 = 1; /* Enable IP csum calculation */
1780 switch (ip->ip_p) {
1781 case IPPROTO_TCP:
1782 if ((mbuf->m_pkthdr.csum_flags & CSUM_TCP) == 0)

--- 196 unchanged lines hidden (view full) ---

1979 if (__predict_true(mbuf != NULL)) {
1980 m_fixhdr(mbuf);
1981 mbuf->m_pkthdr.flowid = cqe_rx->rq_idx;
1982 M_HASHTYPE_SET(mbuf, M_HASHTYPE_OPAQUE);
1983 if (__predict_true((if_getcapenable(nic->ifp) & IFCAP_RXCSUM) != 0)) {
1984 /*
1985 * HW by default verifies IP & TCP/UDP/SCTP checksums
1986 */
1774 iphlen = ip->ip_hl << 2;
1775 poff = ehdrlen + iphlen;
1776
1777 if (mbuf->m_pkthdr.csum_flags != 0) {
1778 hdr->csum_l3 = 1; /* Enable IP csum calculation */
1779 switch (ip->ip_p) {
1780 case IPPROTO_TCP:
1781 if ((mbuf->m_pkthdr.csum_flags & CSUM_TCP) == 0)

--- 196 unchanged lines hidden (view full) ---

1978 if (__predict_true(mbuf != NULL)) {
1979 m_fixhdr(mbuf);
1980 mbuf->m_pkthdr.flowid = cqe_rx->rq_idx;
1981 M_HASHTYPE_SET(mbuf, M_HASHTYPE_OPAQUE);
1982 if (__predict_true((if_getcapenable(nic->ifp) & IFCAP_RXCSUM) != 0)) {
1983 /*
1984 * HW by default verifies IP & TCP/UDP/SCTP checksums
1985 */
1987
1988 /* XXX: Do we need to include IP with options too? */
1989 if (__predict_true(cqe_rx->l3_type == L3TYPE_IPV4 ||
1990 cqe_rx->l3_type == L3TYPE_IPV6)) {
1986 if (__predict_true(cqe_rx->l3_type == L3TYPE_IPV4)) {
1991 mbuf->m_pkthdr.csum_flags =
1992 (CSUM_IP_CHECKED | CSUM_IP_VALID);
1993 }
1987 mbuf->m_pkthdr.csum_flags =
1988 (CSUM_IP_CHECKED | CSUM_IP_VALID);
1989 }
1994 if (cqe_rx->l4_type == L4TYPE_TCP ||
1995 cqe_rx->l4_type == L4TYPE_UDP ||
1996 cqe_rx->l4_type == L4TYPE_SCTP) {
1990
1991 switch (cqe_rx->l4_type) {
1992 case L4TYPE_UDP:
1993 case L4TYPE_TCP: /* fall through */
1997 mbuf->m_pkthdr.csum_flags |=
1998 (CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
1994 mbuf->m_pkthdr.csum_flags |=
1995 (CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
1999 mbuf->m_pkthdr.csum_data = htons(0xffff);
1996 mbuf->m_pkthdr.csum_data = 0xffff;
1997 break;
1998 case L4TYPE_SCTP:
1999 mbuf->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
2000 break;
2001 default:
2002 break;
2000 }
2001 }
2002 }
2003
2004 return (mbuf);
2005}
2006
2007/* Enable interrupt */

--- 325 unchanged lines hidden ---
2003 }
2004 }
2005 }
2006
2007 return (mbuf);
2008}
2009
2010/* Enable interrupt */

--- 325 unchanged lines hidden ---