dld_proto.c revision 6b6515e229cf9a7ed588f9e8614175a4540d1ae2
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * CDDL HEADER START
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * The contents of this file are subject to the terms of the
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Common Development and Distribution License (the "License").
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * You may not use this file except in compliance with the License.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * See the License for the specific language governing permissions
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * and limitations under the License.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * When distributing Covered Code, include this CDDL HEADER in each
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * If applicable, add the following below this CDDL HEADER, with the
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * fields enclosed by brackets "[]" replaced with your own identifying
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * information: Portions Copyright [yyyy] [name of copyright owner]
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * CDDL HEADER END
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Use is subject to license terms.
25cf1a301a396c38e8adf52c15f537b80d2483f7jl#pragma ident "%Z%%M% %I% %E% SMI"
25cf1a301a396c38e8adf52c15f537b80d2483f7jl * Data-Link Driver
25cf1a301a396c38e8adf52c15f537b80d2483f7jltypedef boolean_t proto_reqfunc_t(dld_str_t *, union DL_primitives *, mblk_t *);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic proto_reqfunc_t proto_info_req, proto_attach_req, proto_detach_req,
25cf1a301a396c38e8adf52c15f537b80d2483f7jl proto_bind_req, proto_unbind_req, proto_promiscon_req, proto_promiscoff_req,
25cf1a301a396c38e8adf52c15f537b80d2483f7jl proto_enabmulti_req, proto_disabmulti_req, proto_physaddr_req,
25cf1a301a396c38e8adf52c15f537b80d2483f7jl proto_setphysaddr_req, proto_udqos_req, proto_req, proto_capability_req,
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic boolean_t proto_poll_enable(dld_str_t *, dl_capab_dls_t *);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic boolean_t proto_capability_advertise(dld_str_t *, mblk_t *);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic task_func_t proto_process_unbind_req, proto_process_detach_req;
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic boolean_t proto_soft_ring_enable(dld_str_t *, dl_capab_dls_t *);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic boolean_t proto_capability_advertise(dld_str_t *, mblk_t *);
25cf1a301a396c38e8adf52c15f537b80d2483f7jlstatic void proto_change_soft_ring_fanout(dld_str_t *, int);
switch (prim) {
case DL_INFO_REQ:
case DL_BIND_REQ:
case DL_UNBIND_REQ:
case DL_UNITDATA_REQ:
case DL_UDQOS_REQ:
case DL_ATTACH_REQ:
case DL_DETACH_REQ:
case DL_ENABMULTI_REQ:
case DL_DISABMULTI_REQ:
case DL_PROMISCON_REQ:
case DL_PROMISCOFF_REQ:
case DL_PHYS_ADDR_REQ:
case DL_SET_PHYS_ADDR_REQ:
case DL_NOTIFY_REQ:
case DL_CAPABILITY_REQ:
case DL_PASSIVE_REQ:
#define NEG(x) -(x)
typedef struct dl_info_ack_wrapper {
static boolean_t
return (B_FALSE);
goto done;
done:
return (B_TRUE);
static boolean_t
int err = 0;
goto failed;
goto failed;
if (err != 0) {
switch (err) {
case ENOENT:
err = 0;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
goto failed;
goto failed;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
int err = 0;
goto failed;
goto failed;
goto failed;
goto failed;
goto failed;
if (err != 0) {
switch (err) {
case EINVAL:
err = 0;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
goto failed;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
int err = 0;
goto failed;
goto failed;
case DL_PROMISC_SAP:
case DL_PROMISC_MULTI:
case DL_PROMISC_PHYS:
goto failed;
goto failed;
if (err != 0) {
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
int err = 0;
goto failed;
goto failed;
case DL_PROMISC_SAP:
goto failed;
case DL_PROMISC_MULTI:
goto failed;
case DL_PROMISC_PHYS:
goto failed;
goto failed;
if (err != 0) {
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
int err = 0;
goto failed;
goto failed;
goto failed;
if (err != 0) {
switch (err) {
case EINVAL:
err = 0;
case ENOSPC:
err = 0;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
int err = 0;
goto failed;
goto failed;
if (err != 0) {
switch (err) {
case EINVAL:
err = 0;
case ENOENT:
err = 0;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
char *addr;
goto failed;
goto failed;
goto failed;
return (B_FALSE);
return (B_TRUE);
return (B_FALSE);
static boolean_t
int err = 0;
goto failed;
goto failed;
goto failed;
if (err != 0) {
switch (err) {
case EINVAL:
err = 0;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
goto failed;
goto failed;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
claimstr(q);
releasestr(q);
return (ret);
static boolean_t
goto failed;
goto failed;
goto failed;
goto failed;
case DL_CAPAB_HCKSUM: {
case DL_CAPAB_POLL: {
goto failed;
case POLL_DISABLE:
case POLL_ENABLE:
case DL_CAPAB_SOFT_RING: {
sizeof (dl_capab_dls_t));
goto failed;
case SOFT_RING_DISABLE:
case SOFT_RING_ENABLE:
sizeof (dl_capab_dls_t));
sizeof (dl_capab_dls_t));
sizeof (dl_capab_dls_t));
return (B_TRUE);
return (B_FALSE);
static boolean_t
goto failed;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
goto failed;
goto failed;
goto failed;
goto failed;
size = 0;
goto baddata;
goto baddata;
goto failed;
&flags);
return (B_TRUE);
return (B_FALSE);
return (B_FALSE);
static boolean_t
goto failed;
goto failed;
return (B_TRUE);
return (B_FALSE);
static boolean_t
return (B_FALSE);
static boolean_t
return (B_FALSE);
return (B_TRUE);
static boolean_t
return (B_FALSE);
return (B_FALSE);
return (B_TRUE);
static boolean_t
subsize = 0;
if (poll_cap) {
sizeof (dl_capab_dls_t);
sizeof (dl_capab_hcksum_t);
sizeof (dl_capab_zerocopy_t);
return (B_FALSE);
if (poll_cap) {
if (!poll_cap) {
int poll_capab_size;
sizeof (dl_capab_dls_t);
if (cksum != 0) {
return (B_TRUE);