diff options
| author | Ryan Zezeski <rpz@joyent.com> | 2018-09-21 08:48:14 -0600 |
|---|---|---|
| committer | Ryan Zezeski <rpz@joyent.com> | 2018-10-18 22:58:07 -0600 |
| commit | 104c53876a87e773ef729efa9419a70fe24933cb (patch) | |
| tree | 1f86b5c4cb5568dc09331c680935969592c58644 /usr/src/uts/common/sys | |
| parent | c6d34d2b1dfd2a8be003867d868e26d325f8584f (diff) | |
| download | illumos-joyent-104c53876a87e773ef729efa9419a70fe24933cb.tar.gz | |
OS-2340 vnics should support LSO
OS-6778 MAC loopback traffic should avoid cksum work
OS-6794 want LSO support in viona
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Reviewed by: Jorge Schrauwen <jorge@blackdot.be>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/uts/common/sys')
| -rw-r--r-- | usr/src/uts/common/sys/mac.h | 32 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/mac_client.h | 2 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/mac_client_impl.h | 3 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/mac_impl.h | 17 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/pattr.h | 20 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/vnic_impl.h | 3 |
6 files changed, 70 insertions, 7 deletions
diff --git a/usr/src/uts/common/sys/mac.h b/usr/src/uts/common/sys/mac.h index a1ee3e3c70..6af2e0bccb 100644 --- a/usr/src/uts/common/sys/mac.h +++ b/usr/src/uts/common/sys/mac.h @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2017, Joyent, Inc. + * Copyright 2018 Joyent, Inc. * Copyright (c) 2015 Garrett D'Amore <garrett@damore.org> */ @@ -623,6 +623,36 @@ typedef struct mactype_register_s { } mactype_register_t; /* + * Flags to describe the hardware emulation desired from a client when + * calling mac_hw_emul(). + * + * MAC_HWCKSUM_EMUL + * + * If an mblk is marked with HCK_* flags, then calculate those + * checksums and update the checksum flags. + * + * MAC_IPCKSUM_EMUL + * + * Like MAC_HWCKSUM_EMUL, except only calculate the IPv4 header + * checksum. We still update both the IPv4 and ULP checksum + * flags. + * + * MAC_LSO_EMUL + * + * If an mblk is marked with HW_LSO, then segment the LSO mblk + * into a new chain of mblks which reference the original data + * block. This flag DOES NOT imply MAC_HWCKSUM_EMUL. If the + * caller needs both then it must set both. + */ +typedef enum mac_emul { + MAC_HWCKSUM_EMUL = (1 << 0), + MAC_IPCKSUM_EMUL = (1 << 1), + MAC_LSO_EMUL = (1 << 2) +} mac_emul_t; + +#define MAC_HWCKSUM_EMULS (MAC_HWCKSUM_EMUL | MAC_IPCKSUM_EMUL) + +/* * Driver interface functions. */ extern int mac_open_by_linkid(datalink_id_t, diff --git a/usr/src/uts/common/sys/mac_client.h b/usr/src/uts/common/sys/mac_client.h index b6040ad679..3290db92e6 100644 --- a/usr/src/uts/common/sys/mac_client.h +++ b/usr/src/uts/common/sys/mac_client.h @@ -200,6 +200,8 @@ extern int mac_set_mtu(mac_handle_t, uint_t, uint_t *); extern void mac_client_set_rings(mac_client_handle_t, int, int); +extern void mac_hw_emul(mblk_t **, mblk_t **, uint_t *, mac_emul_t); + #endif /* _KERNEL */ #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/mac_client_impl.h b/usr/src/uts/common/sys/mac_client_impl.h index d64b895304..21e8620121 100644 --- a/usr/src/uts/common/sys/mac_client_impl.h +++ b/usr/src/uts/common/sys/mac_client_impl.h @@ -411,8 +411,7 @@ extern int mac_tx_percpu_cnt; extern void mac_promisc_client_dispatch(mac_client_impl_t *, mblk_t *); extern void mac_client_init(void); extern void mac_client_fini(void); -extern void mac_promisc_dispatch(mac_impl_t *, mblk_t *, - mac_client_impl_t *, boolean_t); +extern void mac_promisc_dispatch(mac_impl_t *, mblk_t *, mac_client_impl_t *); extern int mac_validate_props(mac_impl_t *, mac_resource_props_t *); diff --git a/usr/src/uts/common/sys/mac_impl.h b/usr/src/uts/common/sys/mac_impl.h index 17aebffc38..593322b990 100644 --- a/usr/src/uts/common/sys/mac_impl.h +++ b/usr/src/uts/common/sys/mac_impl.h @@ -345,7 +345,7 @@ struct mac_group_s { if ((src_mcip)->mci_state_flags & MCIS_SHARE_BOUND) \ rhandle = (mip)->mi_default_tx_ring; \ if (mip->mi_promisc_list != NULL) \ - mac_promisc_dispatch(mip, mp, src_mcip, B_TRUE); \ + mac_promisc_dispatch(mip, mp, src_mcip); \ /* \ * Grab the proper transmit pointer and handle. Special \ * optimization: we can test mi_bridge_link itself atomically, \ @@ -743,12 +743,23 @@ typedef struct mac_client_impl_s mac_client_impl_t; extern void mac_init(void); extern int mac_fini(void); +/* + * MAC packet/chain drop functions to aggregate all dropped-packet + * debugging to a single surface. + */ +/*PRINTFLIKE2*/ +extern void mac_drop_pkt(mblk_t *, const char *, ...) + __KPRINTFLIKE(2); + +/*PRINTFLIKE2*/ +extern void mac_drop_chain(mblk_t *, const char *, ...) + __KPRINTFLIKE(2); + extern void mac_ndd_ioctl(mac_impl_t *, queue_t *, mblk_t *); extern boolean_t mac_ip_hdr_length_v6(ip6_t *, uint8_t *, uint16_t *, uint8_t *, ip6_frag_t **); extern mblk_t *mac_copymsgchain_cksum(mblk_t *); -extern mblk_t *mac_fix_cksum(mblk_t *); extern void mac_packet_print(mac_handle_t, mblk_t *); extern void mac_rx_deliver(void *, mac_resource_handle_t, mblk_t *, mac_header_info_t *); @@ -853,7 +864,7 @@ extern void mac_flow_set_name(flow_entry_t *, const char *); extern mblk_t *mac_add_vlan_tag(mblk_t *, uint_t, uint16_t); extern mblk_t *mac_add_vlan_tag_chain(mblk_t *, uint_t, uint16_t); extern mblk_t *mac_strip_vlan_tag_chain(mblk_t *); -extern void mac_pkt_drop(void *, mac_resource_handle_t, mblk_t *, boolean_t); +extern void mac_rx_def(void *, mac_resource_handle_t, mblk_t *, boolean_t); extern mblk_t *mac_rx_flow(mac_handle_t, mac_resource_handle_t, mblk_t *); extern void i_mac_share_alloc(mac_client_impl_t *); diff --git a/usr/src/uts/common/sys/pattr.h b/usr/src/uts/common/sys/pattr.h index 1269aeca10..587a51f0aa 100644 --- a/usr/src/uts/common/sys/pattr.h +++ b/usr/src/uts/common/sys/pattr.h @@ -21,6 +21,7 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2018 Joyent, Inc. */ #ifndef _SYS_PATTR_H @@ -106,6 +107,25 @@ typedef struct pattr_hcksum_s { #define HW_LSO_FLAGS HW_LSO /* All LSO flags, currently only one */ /* + * The packet originates from a MAC on the same machine as the + * receiving MAC. There are two ways this can happen. + * + * 1. MAC loopback: When a packet is destined for a MAC client on the + * same MAC as the sender. This datapath is taken in + * max_tx_send(). + * + * 2. Bridge Fwd: When a packet is destined for a MAC client on the + * same bridge as the sender. This datapath is taken in + * bridge_forward(). + * + * Presented with this flag, a receiver can then decide whether or not + * it needs to emulate some or all of the HW offloads that the NIC + * would have performed otherwise -- or whether it should accept the + * packet as-is. + */ +#define HW_LOCAL_MAC 0x100 + +/* * Structure used for zerocopy attribute. */ typedef struct pattr_zcopy_s { diff --git a/usr/src/uts/common/sys/vnic_impl.h b/usr/src/uts/common/sys/vnic_impl.h index 1a91158da6..4c8d49c621 100644 --- a/usr/src/uts/common/sys/vnic_impl.h +++ b/usr/src/uts/common/sys/vnic_impl.h @@ -21,7 +21,7 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright 2015 Joyent, Inc. + * Copyright 2018 Joyent, Inc. */ #ifndef _SYS_VNIC_IMPL_H @@ -64,6 +64,7 @@ typedef struct vnic_s { mac_notify_handle_t vn_mnh; uint32_t vn_hcksum_txflags; + mac_capab_lso_t vn_cap_lso; uint32_t vn_mtu; link_state_t vn_ls; } vnic_t; |
