diff options
author | John Levon <john.levon@joyent.com> | 2020-05-26 13:57:13 +0000 |
---|---|---|
committer | John Levon <john.levon@joyent.com> | 2020-05-26 13:57:13 +0000 |
commit | 5b2acc0949194447bba6e45a0fa44d0b5f42f208 (patch) | |
tree | 7ea9eb87bc68fee386dd39035ce715e87a0e673c /usr/src/uts/common/io/mac | |
parent | 8ca018083101bf1cb175869679bc123187fb1bab (diff) | |
parent | 2a1277d3064386cd5c4e372301007aa330bf1d5e (diff) | |
download | illumos-joyent-gcc9.tar.gz |
mergegcc9
Diffstat (limited to 'usr/src/uts/common/io/mac')
-rw-r--r-- | usr/src/uts/common/io/mac/mac.c | 29 | ||||
-rw-r--r-- | usr/src/uts/common/io/mac/mac_client.c | 27 | ||||
-rw-r--r-- | usr/src/uts/common/io/mac/mac_provider.c | 17 | ||||
-rw-r--r-- | usr/src/uts/common/io/mac/mac_sched.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/io/mac/mac_util.c | 2 |
5 files changed, 70 insertions, 11 deletions
diff --git a/usr/src/uts/common/io/mac/mac.c b/usr/src/uts/common/io/mac/mac.c index d698862d81..4ce359f87b 100644 --- a/usr/src/uts/common/io/mac/mac.c +++ b/usr/src/uts/common/io/mac/mac.c @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2020 Joyent, Inc. * Copyright 2015 Garrett D'Amore <garrett@damore.org> + * Copyright 2020 RackTop Systems, Inc. */ /* @@ -3341,6 +3342,10 @@ mac_prop_check_size(mac_prop_id_t id, uint_t valsize, boolean_t is_range) case MAC_PROP_FLOWCTRL: minsize = sizeof (link_flowctrl_t); break; + case MAC_PROP_ADV_FEC_CAP: + case MAC_PROP_EN_FEC_CAP: + minsize = sizeof (link_fec_t); + break; case MAC_PROP_ADV_5000FDX_CAP: case MAC_PROP_EN_5000FDX_CAP: case MAC_PROP_ADV_2500FDX_CAP: @@ -3529,6 +3534,28 @@ mac_set_prop(mac_handle_t mh, mac_prop_id_t id, char *name, void *val, break; } + case MAC_PROP_ADV_FEC_CAP: + case MAC_PROP_EN_FEC_CAP: { + link_fec_t fec; + + ASSERT(valsize >= sizeof (link_fec_t)); + + /* + * fec cannot be zero, and auto must be set exclusively. + */ + bcopy(val, &fec, sizeof (link_fec_t)); + if (fec == 0) + return (EINVAL); + if ((fec & LINK_FEC_AUTO) != 0 && (fec & ~LINK_FEC_AUTO) != 0) + return (EINVAL); + + if (mip->mi_callbacks->mc_callbacks & MC_SETPROP) { + err = mip->mi_callbacks->mc_setprop(mip->mi_driver, + name, id, valsize, val); + } + break; + } + default: /* For other driver properties, call driver's callback */ if (mip->mi_callbacks->mc_callbacks & MC_SETPROP) { @@ -4741,7 +4768,7 @@ mac_bridge_tx(mac_impl_t *mip, mac_ring_handle_t rh, mblk_t *mp) * The bridge may place this mblk on a provider's Tx * path, a mac's Rx path, or both. Since we don't have * enough information at this point, we can't be sure - * that the desination(s) are capable of handling the + * that the destination(s) are capable of handling the * hardware offloads requested by the mblk. We emulate * them here as it is the safest choice. In the * future, if bridge performance becomes a priority, diff --git a/usr/src/uts/common/io/mac/mac_client.c b/usr/src/uts/common/io/mac/mac_client.c index dcfb4803d6..b166e7987a 100644 --- a/usr/src/uts/common/io/mac/mac_client.c +++ b/usr/src/uts/common/io/mac/mac_client.c @@ -4243,7 +4243,7 @@ mac_promisc_dispatch(mac_impl_t *mip, mblk_t *mp_chain, mpip->mpi_type == MAC_CLIENT_PROMISC_ALL || is_mcast) { mac_promisc_dispatch_one(mpip, mp, is_sender, - local); + local); } } } @@ -4274,7 +4274,7 @@ mac_promisc_client_dispatch(mac_client_impl_t *mcip, mblk_t *mp_chain) if (mpip->mpi_type == MAC_CLIENT_PROMISC_FILTERED && !is_mcast) { mac_promisc_dispatch_one(mpip, mp, B_FALSE, - B_FALSE); + B_FALSE); } } } @@ -4352,12 +4352,27 @@ i_mac_capab_get(mac_handle_t mh, mac_capab_t cap, void *cap_data) { mac_impl_t *mip = (mac_impl_t *)mh; - if (mip->mi_bridge_link != NULL && cap == MAC_CAPAB_NO_ZCOPY) + if (mip->mi_bridge_link != NULL && cap == MAC_CAPAB_NO_ZCOPY) { return (B_TRUE); - else if (mip->mi_callbacks->mc_callbacks & MC_GETCAPAB) - return (mip->mi_getcapab(mip->mi_driver, cap, cap_data)); - else + } else if (mip->mi_callbacks->mc_callbacks & MC_GETCAPAB) { + boolean_t res; + + res = mip->mi_getcapab(mip->mi_driver, cap, cap_data); + /* + * Until we have suppport for TSOv6 emulation in the MAC + * loopback path, do not allow the TSOv6 capability to be + * advertised to consumers. + */ + if (res && cap == MAC_CAPAB_LSO) { + mac_capab_lso_t *cap_lso = cap_data; + + cap_lso->lso_flags &= ~LSO_TX_BASIC_TCP_IPV6; + cap_lso->lso_basic_tcp_ipv6.lso_max = 0; + } + return (res); + } else { return (B_FALSE); + } } /* diff --git a/usr/src/uts/common/io/mac/mac_provider.c b/usr/src/uts/common/io/mac/mac_provider.c index 7f193f68eb..bcca602589 100644 --- a/usr/src/uts/common/io/mac/mac_provider.c +++ b/usr/src/uts/common/io/mac/mac_provider.c @@ -23,6 +23,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2019 Joyent, Inc. * Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved. + * Copyright 2020 RackTop Systems, Inc. */ #include <sys/types.h> @@ -1530,6 +1531,22 @@ mac_prop_info_set_default_link_flowctrl(mac_prop_info_handle_t ph, } void +mac_prop_info_set_default_fec(mac_prop_info_handle_t ph, link_fec_t val) +{ + mac_prop_info_state_t *pr = (mac_prop_info_state_t *)ph; + + /* nothing to do if the caller doesn't want the default value */ + if (pr->pr_default == NULL) + return; + + ASSERT(pr->pr_default_size >= sizeof (link_fec_t)); + + bcopy(&val, pr->pr_default, sizeof (val)); + + pr->pr_flags |= MAC_PROP_INFO_DEFAULT; +} + +void mac_prop_info_set_range_uint32(mac_prop_info_handle_t ph, uint32_t min, uint32_t max) { diff --git a/usr/src/uts/common/io/mac/mac_sched.c b/usr/src/uts/common/io/mac/mac_sched.c index 94ec8add16..8f983e50e4 100644 --- a/usr/src/uts/common/io/mac/mac_sched.c +++ b/usr/src/uts/common/io/mac/mac_sched.c @@ -4443,9 +4443,9 @@ mac_tx_send(mac_client_handle_t mch, mac_ring_handle_t ring, mblk_t *mp_chain, mac_hw_emul(&mp, NULL, NULL, MAC_ALL_EMULS); if (mp != NULL) { (dst_flow_ent->fe_cb_fn)( - dst_flow_ent->fe_cb_arg1, - dst_flow_ent->fe_cb_arg2, - mp, do_switch); + dst_flow_ent->fe_cb_arg1, + dst_flow_ent->fe_cb_arg2, + mp, do_switch); } } diff --git a/usr/src/uts/common/io/mac/mac_util.c b/usr/src/uts/common/io/mac/mac_util.c index 6e33fb7f56..03da3a3504 100644 --- a/usr/src/uts/common/io/mac/mac_util.c +++ b/usr/src/uts/common/io/mac/mac_util.c @@ -258,7 +258,7 @@ bail: static boolean_t mac_sw_cksum_ipv6(mblk_t *mp, uint32_t ip_hdr_offset, const char **err) { - ip6_t* ip6h = (ip6_t *)(mp->b_rptr + ip_hdr_offset); + ip6_t *ip6h = (ip6_t *)(mp->b_rptr + ip_hdr_offset); const uint8_t proto = ip6h->ip6_nxt; const uint16_t *iphs = (uint16_t *)ip6h; /* ULP offset from start of L2. */ |