/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/softmac_impl.h>
typedef struct softmac_capab_ops {
static int softmac_fill_hcksum_ack(void *, t_uscalar_t);
static int softmac_fill_zcopy_ack(void *, t_uscalar_t);
static int softmac_fill_mdt_ack(void *, dl_capab_mdt_t *);
static int softmac_adv_hcksum_ack(void *, t_uscalar_t);
static int softmac_adv_zcopy_ack(void *, t_uscalar_t);
static int softmac_adv_mdt_ack(void *, dl_capab_mdt_t *);
static int softmac_enable_hcksum_ack(void *, t_uscalar_t);
static int softmac_enable_mdt_ack(void *, dl_capab_mdt_t *);
softmac_capab_ops_t *, void *);
softmac_capab_ops_t *, void *);
softmac_capab_ops_t *, void *);
softmac_capab_ops_t *, void *);
softmac_capab_ops_t *, void *);
{
};
{
};
{
NULL,
};
int
{
int err = 0;
goto exit;
err = -1;
goto exit;
}
exit:
return (err);
}
static int
{
int err;
return (ENOMEM);
return (err);
switch (dl_prim->dl_primitive) {
case DL_CAPABILITY_ACK:
printf("dl_capability: DL_CAPABILITY_ACK "
"protocol err\n");
break;
}
return (0);
case DL_ERROR_ACK:
printf("dl_capability: DL_ERROR_ACK protocol err\n");
break;
}
printf("dl_capability: DL_ERROR_ACK rtnd prim %u\n",
break;
}
return (0);
default:
printf("dl_capability: bad ACK header %u\n",
break;
}
return (-1);
}
static int
{
/*
* There are two types of acks we process here:
* 1. acks in reply to a (first form) generic capability req
* (no ENABLE flag set)
* 2. acks in reply to a ENABLE capability req.
* (ENABLE flag set)
* Only the first type should be expected here.
*/
if (flags & HCKSUM_ENABLE) {
"HCKSUM_ENABLE flag in hardware checksum capability");
}
return (0);
}
static int
{
return (0);
}
static int
{
/*
* There are two types of acks we process here:
* 1. acks in reply to a (first form) generic capability req
* (ENABLE flag might be set by some drivers)
* 2. acks in reply to a ENABLE capability req.
* (ENABLE flag set)
*/
return (0);
}
int
{
int err;
return (0);
/*
* Send DL_CAPABILITY_REQ to get capability advertisement.
*/
return (err);
/*
* Send DL_CAPABILITY_REQ to enable specific capabilities.
*/
return (err);
return (0);
}
static int
{
int err;
if (enable) {
/* No need to enable DL_CAPAB_ZEROCOPY */
size += sizeof (dl_capability_sub_t) +
sizeof (dl_capab_hcksum_t);
/*
* The MDT capability was not enabled for the
* first time, enable it now.
*/
size += sizeof (dl_capability_sub_t) +
sizeof (dl_capab_mdt_t);
}
}
if (size == 0)
return (0);
}
/*
* Create DL_CAPABILITY_REQ message and send it down
*/
return (ENOMEM);
if (!enable)
goto output;
size = sizeof (dl_capability_sub_t) +
sizeof (dl_capab_hcksum_t);
}
size = sizeof (dl_capability_sub_t) +
sizeof (dl_capab_mdt_t);
subcapb = (dl_capability_sub_t *)
}
}
if (err == 0) {
if (enable) {
} else {
}
}
return (err);
}
static int
{
/*
* There are two types of acks we process here:
* 1. acks in reply to a (first form) generic capability req
* (no ENABLE flag set)
* 2. acks in reply to a ENABLE capability req.
* (ENABLE flag set)
* Only the first type should be expected here.
*/
if (flags & HCKSUM_ENABLE) {
"HCKSUM_ENABLE flag in hardware checksum capability");
return (-1);
/*
* The acknowledgement should be the same as we got when
* the softmac is created.
*/
return (-1);
}
return (-1);
}
}
return (0);
}
static int
{
/*
* The acknowledgement should be the same as we got when
* the softmac is created.
*/
return (-1);
}
return (0);
}
static int
{
/*
* The acknowledgement should be the same as we got when
* the softmac is created.
*/
return (-1);
}
return (-1);
}
/*
* We need the mdt_flags field to know whether an additional
* DL_CAPAB_MDT_ENABLE is necessary.
*/
return (0);
}
static int
{
/*
* There are two types of acks we process here:
* 1. acks in reply to a (first form) generic capability req
* (no ENABLE flag set)
* 2. acks in reply to a ENABLE capability req.
* (ENABLE flag set)
* Only the second type should be expected here.
*/
if (flags & HCKSUM_ENABLE) {
" hardware capability flag value 0x%x", flags);
return (-1);
}
} else {
"hardware checksum flag HCKSUM_ENABLE is not set");
return (-1);
}
return (0);
}
static int
{
/*
* There are two types of acks we process here:
* 1. acks in reply to a (first form) generic capability req
* (no ENABLE flag set)
* 2. acks in reply to a ENABLE capability req.
* (ENABLE flag set)
* Only the second type should be expected here.
*/
mdt->mdt_hdr_head) ||
mdt->mdt_hdr_tail) ||
mdt->mdt_max_pld) ||
mdt->mdt_span_limit)) {
"unexpected MDT capability value");
return (-1);
}
} else {
"MDT flag DL_CAPAB_MDT_ENABLE is not set");
return (-1);
}
return (0);
}
static int
{
int err = 0;
if (cap->dl_sub_length == 0)
goto exit;
/* Is dl_sub_length correct? */
goto exit;
}
- sizeof (*sub));
case DL_CAPAB_ID_WRAPPER:
break;
default:
break;
}
}
exit:
return (err);
}
static int
{
"sub-capability too long");
return (err);
}
"encapsulated capab type %d too long",
return (err);
}
return (err);
}
/* Process the encapsulated sub-capability */
}
static int
{
int err = 0;
"malformed sub-capability too long");
return (EINVAL);
}
case DL_CAPAB_HCKSUM:
break;
case DL_CAPAB_ZEROCOPY:
break;
case DL_CAPAB_MDT:
break;
default:
}
return (err);
}
static int
{
int err = 0;
return (err);
"hardware checksum capability flags 0x%x", flags);
return (EINVAL);
}
if (op->sc_hcksum_ack)
else {
"checksum acknowledgement");
return (EINVAL);
}
}
static int
{
int err = 0;
return (err);
if (!(flags & DL_CAPAB_VMSAFE_MEM)) {
"flags 0x%x", flags);
return (EINVAL);
}
if (op->sc_zcopy_ack)
else {
"acknowledgement");
return (EINVAL);
}
}
static int
{
int err;
return (err);
if (op->sc_mdt_ack)
else {
"acknowledgement");
return (EINVAL);
}
}
static int
{
"unsupported hardware checksum capability (version %d, "
return (-1);
}
"module detected; hardware checksum capability discarded");
return (-1);
}
return (0);
}
static int
{
"capability (version %d, expected %d)",
return (-1);
}
"module detected; zcopy checksum capability discarded");
return (-1);
}
return (0);
}
static int
{
"capability (version %d, expected %d)",
return (-1);
}
"module detected; MDT capability discarded");
return (-1);
}
return (0);
}