MAC_HCKSUM_GET(9F) | Kernel Functions for Drivers | MAC_HCKSUM_GET(9F) |
mac_hcksum_get
,
mac_hcksum_set
— get and set
checksum information on message blocks
#include
<sys/mac_provider.h>
void
mac_hcksum_get
(const mblk_t *mp,
uint32_t *start, uint32_t
*stuff, uint32_t *end, uint32_t
*value, uint32_t *flags);
void
mac_hcksum_set
(mblk_t *mp,
uint32_t start, uint32_t stuff,
uint32_t end, uint32_t value,
uint32_t flags);
illumos DDI specific
The
mac_hcksum_get
()
and mac_hcksum_set
() functions are provided to
device drivers to get and set checksum related information. When a device
driver indicates that it supports the MAC_CAPAB_HCKSUM
capability as part of its
mc_getcapab(9E) entry point,
then it is responsible for calling these functions appropriately during the
transmit and receive paths.
While both functions operate on an mblk_t, this function should only be called on the first mblk_t that begins a given individual frame in a chain. In other words, it only works on entries where it is the first of many possible entries linked together by the b_cont member. The first mblk_t received from any mac(9E) API or pointed to by a b_next pointer should be used.
When a device driver is receiving data, it is its responsibility
to set
checksum information when it has indicated that it supports the
MAC_CAPAB_HCKSUM capability. Device drivers will call the
mac_hcksum_set
()
function to indicate what checksum information has occurred.
The proper values to set depend on the flags passed in. The following flags are supported when receiving data, note that they may have different meanings from when transmitting data. The driver should set the flags argument to the bitwise inclusive OR of the following values:
The HCK_PARTIALCKSUM, HCK_FULLCKSUM, and HCK_FULLCKSUM_OK flags are all mutually exclusive. A device driver should only set one of the three flags.
If one of the arguments is not required based on the specified value of flags, then the device driver should set any remaining arguments to 0.
When a device driver is transmitting data and it has advertised
that it supports the MAC_CAPAB_HCKSUM capability, then it
must call the
mac_hcksum_get
()
function to determine what hardware checksumming options are required to be
performed by the hardware. While the device driver may need the other
fields, it must check the flags argument to determine
what it is being requested to do. The following values may be set in
flags:
The flags that the device driver will get will depend on what the device driver has advertised that it supports in response to the mc_getcapab(9E) query for the MAC_CAPAB_HCKSUM capability.
The HCK_PARTIALCKSUM and HCK_FULLCKSUM flags are mutually exclusive.
The mac_hcksum_get
() and
mac_hcksum_set
() functions may be called from any
context.
March 15, 2018 | OmniOS |