Skip to content

Commit

Permalink
Revert "OS-2340 vnics should support LSO" [breaks COAL]
Browse files Browse the repository at this point in the history
This reverts commit 104c538.
  • Loading branch information
rzezeski committed Oct 23, 2018
1 parent ffe74e1 commit 92b1263
Show file tree
Hide file tree
Showing 23 changed files with 434 additions and 1,761 deletions.
16 changes: 6 additions & 10 deletions usr/src/uts/common/inet/ip/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
#include <sys/vtrace.h>
#include <sys/isa_defs.h>
#include <sys/mac.h>
#include <sys/mac_client.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/route.h>
Expand Down Expand Up @@ -660,13 +659,11 @@ ill_input_short_v4(mblk_t *mp, void *iph_arg, void *nexthop_arg,
}

/*
* If the packet originated from a same-machine sender or
* there is a good HW IP header checksum, we clear the need
* If there is a good HW IP header checksum we clear the need
* look at the IP header checksum.
*/
if ((DB_CKSUMFLAGS(mp) & HW_LOCAL_MAC) ||
((DB_CKSUMFLAGS(mp) & HCK_IPV4_HDRCKSUM) &&
ILL_HCKSUM_CAPABLE(ill) && dohwcksum)) {
if ((DB_CKSUMFLAGS(mp) & HCK_IPV4_HDRCKSUM) &&
ILL_HCKSUM_CAPABLE(ill) && dohwcksum) {
/* Header checksum was ok. Clear the flag */
DB_CKSUMFLAGS(mp) &= ~HCK_IPV4_HDRCKSUM;
ira->ira_flags &= ~IRAF_VERIFY_IP_CKSUM;
Expand Down Expand Up @@ -2259,13 +2256,12 @@ ip_input_cksum_v4(iaflags_t iraflags, mblk_t *mp, ipha_t *ipha,
* We apply this for all ULP protocols. Does the HW know to
* not set the flags for SCTP and other protocols.
*/

hck_flags = DB_CKSUMFLAGS(mp);

if ((hck_flags & HCK_FULLCKSUM_OK) || (hck_flags & HW_LOCAL_MAC)) {
if (hck_flags & HCK_FULLCKSUM_OK) {
/*
* Either the hardware already verified the checksum
* or the packet is from a same-machine sender in
* which case we assume data integrity.
* Hardware has already verified the checksum.
*/
return (B_TRUE);
}
Expand Down
23 changes: 2 additions & 21 deletions usr/src/uts/common/inet/ip_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2018 Joyent, Inc.
*/

#ifndef _INET_IP_IMPL_H
Expand Down Expand Up @@ -160,27 +159,9 @@ extern "C" {
#define ILL_DIRECT_CAPABLE(ill) \
(((ill)->ill_capabilities & ILL_CAPAB_DLD_DIRECT) != 0)

/*
* Determine if a mblk needs to take the "slow path", aka OTH
* softring. There are multiple reasons why a mblk might take the slow
* path.
*
* o The mblk is not a data message.
*
* o There is more than one outstanding reference to the mblk and it
* does not originate from a local MAC client. If the mblk does
* originate from a local MAC then allow it to pass through with
* more than one reference and leave the copying up to the consumer.
*
* o The IP header is not aligned (we assume alignment in the checksum
* routine).
*
* o The mblk doesn't contain enough data to populate a simple IP header.
*/
/* This macro is used by the mac layer */
#define MBLK_RX_FANOUT_SLOWPATH(mp, ipha) \
(DB_TYPE(mp) != M_DATA || \
(DB_REF(mp) != 1 && ((DB_CKSUMFLAGS(mp) & HW_LOCAL_MAC) == 0)) || \
!OK_32PTR(ipha) || \
(DB_TYPE(mp) != M_DATA || DB_REF(mp) != 1 || !OK_32PTR(ipha) || \
(((uchar_t *)ipha + IP_SIMPLE_HDR_LENGTH) >= (mp)->b_wptr))

/*
Expand Down
192 changes: 43 additions & 149 deletions usr/src/uts/common/io/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright (c) 2016 by Delphix. All rights reserved.
* Copyright 2018 Joyent, Inc.
*/

/*
Expand All @@ -42,7 +41,6 @@
#include <sys/modctl.h>
#include <sys/note.h>
#include <sys/param.h>
#include <sys/pattr.h>
#include <sys/policy.h>
#include <sys/sdt.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -1694,8 +1692,7 @@ bridge_learn(bridge_link_t *blp, const uint8_t *saddr, uint16_t ingress_nick,
* The passed-in tci is the "impossible" value 0xFFFF when no tag is present.
*/
static mblk_t *
reform_vlan_header(mblk_t *mp, uint16_t vlanid, uint16_t tci, uint16_t pvid,
boolean_t keep_flags)
reform_vlan_header(mblk_t *mp, uint16_t vlanid, uint16_t tci, uint16_t pvid)
{
boolean_t source_has_tag = (tci != 0xFFFF);
mblk_t *mpcopy;
Expand All @@ -1707,13 +1704,8 @@ reform_vlan_header(mblk_t *mp, uint16_t vlanid, uint16_t tci, uint16_t pvid,
if (mp == NULL)
return (mp);

/*
* A forwarded packet cannot have HW offloads enabled unless
* the destination is known to be local to the host and HW
* offloads haven't been emulated.
*/
if (!keep_flags)
DB_CKSUMFLAGS(mp) = 0;
/* No forwarded packet can have hardware checksum enabled */
DB_CKSUMFLAGS(mp) = 0;

/* Get the no-modification cases out of the way first */
if (!source_has_tag && vlanid == pvid) /* 1a */
Expand Down Expand Up @@ -1914,46 +1906,17 @@ bridge_forward(bridge_link_t *blp, mac_header_info_t *hdr_info, mblk_t *mp,
blp->bl_trillthreads++;
mutex_exit(&blp->bl_trilllock);
update_header(mp, hdr_info, B_FALSE);

if (is_xmit) {
mac_hw_emul(&mp, NULL, NULL,
MAC_HWCKSUM_EMUL | MAC_LSO_EMUL);

if (mp == NULL) {
KIINCR(bki_drops);
goto done;
}
}

while (mp != NULL) {
mblk_t *next = mp->b_next;

mp->b_next = NULL;

/*
* All trill data frames have
* Inner.VLAN.
*/
mp = reform_vlan_header(mp, vlanid, tci,
0, B_FALSE);

if (mp == NULL) {
/*
* Make sure to free
* any remaining
* segments.
*/
freemsgchain(next);
KIINCR(bki_drops);
goto done;
}

trill_encap_fn(tdp, blp, hdr_info, mp,
bfp->bf_trill_nick);
mp = next;
if (is_xmit)
mp = mac_fix_cksum(mp);
/* all trill data frames have Inner.VLAN */
mp = reform_vlan_header(mp, vlanid, tci, 0);
if (mp == NULL) {
KIINCR(bki_drops);
fwd_unref(bfp);
return (NULL);
}

done:
trill_encap_fn(tdp, blp, hdr_info, mp,
bfp->bf_trill_nick);
mutex_enter(&blp->bl_trilllock);
if (--blp->bl_trillthreads == 0 &&
blp->bl_trilldata == NULL)
Expand Down Expand Up @@ -1995,68 +1958,31 @@ bridge_forward(bridge_link_t *blp, mac_header_info_t *hdr_info, mblk_t *mp,
mpsend = copymsg(mp);
}

/*
* If the destination is not local to the host
* then we need to emulate HW offloads because
* we can't guarantee the forwarding
* destination provides them.
*/
if (!from_trill && is_xmit &&
!(bfp->bf_flags & BFF_LOCALADDR)) {
mac_hw_emul(&mpsend, NULL, NULL,
MAC_HWCKSUM_EMUL | MAC_LSO_EMUL);

if (mpsend == NULL) {
KIINCR(bki_drops);
continue;
}
}

/*
* The HW emulation above may have segmented
* an LSO mblk.
*/
while ((mpsend != NULL) &&
!(bfp->bf_flags & BFF_LOCALADDR)) {
mblk_t *next = mpsend->b_next;
if (!from_trill && is_xmit)
mpsend = mac_fix_cksum(mpsend);

mpsend->b_next = NULL;
mpsend = reform_vlan_header(mpsend, vlanid, tci,
blpsend->bl_pvid, B_FALSE);

if (mpsend == NULL) {
KIINCR(bki_drops);
mpsend = next;
continue;
}

KIINCR(bki_forwards);
KLPINCR(blpsend, bkl_xmit);
MAC_RING_TX(blpsend->bl_mh, NULL, mpsend,
mpsend);
freemsg(mpsend);
mpsend = next;
mpsend = reform_vlan_header(mpsend, vlanid, tci,
blpsend->bl_pvid);
if (mpsend == NULL) {
KIINCR(bki_drops);
continue;
}

KIINCR(bki_forwards);
/*
* No need to bump up the link reference count, as
* the forwarding entry itself holds a reference to
* the link.
*/
if (bfp->bf_flags & BFF_LOCALADDR) {
mpsend = reform_vlan_header(mpsend, vlanid, tci,
blpsend->bl_pvid, B_TRUE);

if (mpsend == NULL) {
KIINCR(bki_drops);
continue;
}

KIINCR(bki_forwards);
mac_rx_common(blpsend->bl_mh, NULL, mpsend);
} else {
KLPINCR(blpsend, bkl_xmit);
MAC_RING_TX(blpsend->bl_mh, NULL, mpsend,
mpsend);
freemsg(mpsend);
}
}

/*
* Handle a special case: if we're transmitting to the original
* link, then check whether the localaddr flag is set. If it
Expand Down Expand Up @@ -2092,7 +2018,7 @@ bridge_forward(bridge_link_t *blp, mac_header_info_t *hdr_info, mblk_t *mp,
* Inner.VLAN
*/
mpsend = reform_vlan_header(mpsend,
vlanid, tci, 0, B_FALSE);
vlanid, tci, 0);
if (mpsend == NULL) {
KIINCR(bki_drops);
} else {
Expand Down Expand Up @@ -2143,57 +2069,25 @@ bridge_forward(bridge_link_t *blp, mac_header_info_t *hdr_info, mblk_t *mp,
mpsend = copymsg(mp);
}

/*
* In this case, send to all links connected
* to the bridge. Some of these destinations
* may not provide HW offload -- so just
* emulate it here.
*/
if (!from_trill && is_xmit) {
mac_hw_emul(&mpsend, NULL, NULL,
MAC_HWCKSUM_EMUL | MAC_LSO_EMUL);

if (mpsend == NULL) {
KIINCR(bki_drops);
continue;
}
}

/*
* The HW emulation above may have segmented
* an LSO mblk.
*/
while (mpsend != NULL) {
mblk_t *next = mpsend->b_next;

mpsend->b_next = NULL;
mpsend = reform_vlan_header(mpsend, vlanid, tci,
blpsend->bl_pvid, B_FALSE);

if (mpsend == NULL) {
KIINCR(bki_drops);
mpsend = next;
continue;
}

if (hdr_info->mhi_dsttype ==
MAC_ADDRTYPE_UNICAST)
KIINCR(bki_unknown);
else
KIINCR(bki_mbcast);
if (!from_trill && is_xmit)
mpsend = mac_fix_cksum(mpsend);

KLPINCR(blpsend, bkl_xmit);
if ((mpcopy = copymsg(mpsend)) != NULL) {
mac_rx_common(blpsend->bl_mh, NULL,
mpcopy);
}

MAC_RING_TX(blpsend->bl_mh, NULL, mpsend,
mpsend);
freemsg(mpsend);
mpsend = next;
mpsend = reform_vlan_header(mpsend, vlanid, tci,
blpsend->bl_pvid);
if (mpsend == NULL) {
KIINCR(bki_drops);
continue;
}

if (hdr_info->mhi_dsttype == MAC_ADDRTYPE_UNICAST)
KIINCR(bki_unknown);
else
KIINCR(bki_mbcast);
KLPINCR(blpsend, bkl_xmit);
if ((mpcopy = copymsg(mpsend)) != NULL)
mac_rx_common(blpsend->bl_mh, NULL, mpcopy);
MAC_RING_TX(blpsend->bl_mh, NULL, mpsend, mpsend);
freemsg(mpsend);
link_unref(blpsend);
}
}
Expand Down
Loading

0 comments on commit 92b1263

Please sign in to comment.