if_hn.c (314124) | if_hn.c (315437) |
---|---|
1/*- 2 * Copyright (c) 2010-2012 Citrix Inc. 3 * Copyright (c) 2009-2012,2016 Microsoft Corp. 4 * Copyright (c) 2012 NetApp Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 39 unchanged lines hidden (view full) --- 48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 52 * SUCH DAMAGE. 53 */ 54 55#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010-2012 Citrix Inc. 3 * Copyright (c) 2009-2012,2016 Microsoft Corp. 4 * Copyright (c) 2012 NetApp Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 39 unchanged lines hidden (view full) --- 48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 52 * SUCH DAMAGE. 53 */ 54 55#include <sys/cdefs.h> |
56__FBSDID("$FreeBSD: stable/10/sys/dev/hyperv/netvsc/if_hn.c 314124 2017-02-23 07:07:21Z dexuan $"); | 56__FBSDID("$FreeBSD: stable/10/sys/dev/hyperv/netvsc/if_hn.c 315437 2017-03-17 03:03:58Z sephe $"); |
57 58#include "opt_inet6.h" 59#include "opt_inet.h" 60#include "opt_hn.h" 61 62#include <sys/param.h> 63#include <sys/bus.h> 64#include <sys/kernel.h> --- 1703 unchanged lines hidden (view full) --- 1768 pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset + 1769 pkt->rm_pktinfolen); 1770 pkt->rm_pktinfolen += pi_size; 1771 1772 pi->rm_size = pi_size; 1773 pi->rm_type = pi_type; 1774 pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; 1775 | 57 58#include "opt_inet6.h" 59#include "opt_inet.h" 60#include "opt_hn.h" 61 62#include <sys/param.h> 63#include <sys/bus.h> 64#include <sys/kernel.h> --- 1703 unchanged lines hidden (view full) --- 1768 pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset + 1769 pkt->rm_pktinfolen); 1770 pkt->rm_pktinfolen += pi_size; 1771 1772 pi->rm_size = pi_size; 1773 pi->rm_type = pi_type; 1774 pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; 1775 |
1776 /* Data immediately follow per-packet-info. */ 1777 pkt->rm_dataoffset += pi_size; 1778 1779 /* Update RNDIS packet msg length */ 1780 pkt->rm_len += pi_size; 1781 | |
1782 return (pi->rm_data); 1783} 1784 1785static __inline int 1786hn_flush_txagg(struct ifnet *ifp, struct hn_tx_ring *txr) 1787{ 1788 struct hn_txdesc *txd; 1789 struct mbuf *m; --- 125 unchanged lines hidden (view full) --- 1915 if (chim != NULL) 1916 pkt = chim; 1917 } else { 1918 if (txr->hn_agg_txd != NULL) 1919 hn_flush_txagg(ifp, txr); 1920 } 1921 1922 pkt->rm_type = REMOTE_NDIS_PACKET_MSG; | 1776 return (pi->rm_data); 1777} 1778 1779static __inline int 1780hn_flush_txagg(struct ifnet *ifp, struct hn_tx_ring *txr) 1781{ 1782 struct hn_txdesc *txd; 1783 struct mbuf *m; --- 125 unchanged lines hidden (view full) --- 1909 if (chim != NULL) 1910 pkt = chim; 1911 } else { 1912 if (txr->hn_agg_txd != NULL) 1913 hn_flush_txagg(ifp, txr); 1914 } 1915 1916 pkt->rm_type = REMOTE_NDIS_PACKET_MSG; |
1923 pkt->rm_len = sizeof(*pkt) + m_head->m_pkthdr.len; 1924 pkt->rm_dataoffset = sizeof(*pkt); | 1917 pkt->rm_len = m_head->m_pkthdr.len; 1918 pkt->rm_dataoffset = 0; |
1925 pkt->rm_datalen = m_head->m_pkthdr.len; 1926 pkt->rm_oobdataoffset = 0; 1927 pkt->rm_oobdatalen = 0; 1928 pkt->rm_oobdataelements = 0; 1929 pkt->rm_pktinfooffset = sizeof(*pkt); 1930 pkt->rm_pktinfolen = 0; 1931 pkt->rm_vchandle = 0; 1932 pkt->rm_reserved = 0; --- 53 unchanged lines hidden (view full) --- 1986 if (m_head->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) 1987 *pi_data |= NDIS_TXCSUM_INFO_TCPCS; 1988 else if (m_head->m_pkthdr.csum_flags & 1989 (CSUM_IP_UDP | CSUM_IP6_UDP)) 1990 *pi_data |= NDIS_TXCSUM_INFO_UDPCS; 1991 } 1992 1993 pkt_hlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; | 1919 pkt->rm_datalen = m_head->m_pkthdr.len; 1920 pkt->rm_oobdataoffset = 0; 1921 pkt->rm_oobdatalen = 0; 1922 pkt->rm_oobdataelements = 0; 1923 pkt->rm_pktinfooffset = sizeof(*pkt); 1924 pkt->rm_pktinfolen = 0; 1925 pkt->rm_vchandle = 0; 1926 pkt->rm_reserved = 0; --- 53 unchanged lines hidden (view full) --- 1980 if (m_head->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) 1981 *pi_data |= NDIS_TXCSUM_INFO_TCPCS; 1982 else if (m_head->m_pkthdr.csum_flags & 1983 (CSUM_IP_UDP | CSUM_IP6_UDP)) 1984 *pi_data |= NDIS_TXCSUM_INFO_UDPCS; 1985 } 1986 1987 pkt_hlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; |
1988 /* Fixup RNDIS packet message total length */ 1989 pkt->rm_len += pkt_hlen; |
|
1994 /* Convert RNDIS packet message offsets */ | 1990 /* Convert RNDIS packet message offsets */ |
1995 pkt->rm_dataoffset = hn_rndis_pktmsg_offset(pkt->rm_dataoffset); | 1991 pkt->rm_dataoffset = hn_rndis_pktmsg_offset(pkt_hlen); |
1996 pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset); 1997 1998 /* 1999 * Fast path: Chimney sending. 2000 */ 2001 if (chim != NULL) { 2002 struct hn_txdesc *tgt_txd = txd; 2003 --- 3694 unchanged lines hidden --- | 1992 pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset); 1993 1994 /* 1995 * Fast path: Chimney sending. 1996 */ 1997 if (chim != NULL) { 1998 struct hn_txdesc *tgt_txd = txd; 1999 --- 3694 unchanged lines hidden --- |