2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _SYS_ECP_H
2N/A#define _SYS_ECP_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/types.h>
2N/A#include <sys/ethernet.h>
2N/A#include <lldp.h>
2N/A
2N/A#define ECP_VDP 0x0001
2N/A
2N/A#define ECP_MAX_PDULEN 1500
2N/A
2N/A#define ECP_VERSION 0x1
2N/A
2N/A#define ECP_VER_MASK 0xF
2N/A#define ECP_OP_MASK 0x3
2N/A#define ECP_SUBTYPE_MASK 0x3FF
2N/A
2N/A#define ECP_VER_SHIFT 12
2N/A#define ECP_OP_SHIFT 10
2N/A#define ECP_SUBTYPE_SHIFT 0
2N/A
2N/A#define ECP_MAX_TRIES 3
2N/A#define ECP_ACK_TIME_OUT 164 /* timeout in msec */
2N/A#define ECP_RTE_EXPONENT 20
2N/A
2N/Aenum ecp_op_type {
2N/A ECP_REQ = 0,
2N/A ECP_ACK
2N/A};
2N/A
2N/A/* ECP Statistcs */
2N/Atypedef struct ecp_stat_s {
2N/A uint64_t es_ipkts;
2N/A uint64_t es_ierrors;
2N/A uint64_t es_opkts;
2N/A uint64_t es_oerrors;
2N/A uint64_t es_rexmits;
2N/A uint64_t es_timeouts;
2N/A} ecp_stat_t;
2N/A
2N/Atypedef struct ecp_timers_s {
2N/A int et_r; /* Maximum retries */
2N/A int et_rte; /* Exponent for computing Retransmission interval */
2N/A} ecp_timers_t;
2N/A
2N/A/* ECP config info */
2N/Atypedef struct ecp_config_s {
2N/A ushort_t ecpc_req_seq;
2N/A ushort_t ecpc_ack_seq;
2N/A ushort_t ecpc_last_ack_seq;
2N/A int ecpc_max_tx_attempts;
2N/A} ecp_config_t;
2N/A
2N/Atypedef void (*ecp_ulp_cb_t)(void *, ushort_t, ushort_t, char *, int);
2N/A
2N/A#define ECP_STDERR_LOG 1
2N/A#define ECP_SYS_LOG 2
2N/A
2N/Aextern void * ecp_init(struct ether_addr *, struct ether_addr *,
2N/A uint16_t, int, int, ecp_ulp_cb_t, void *, int, int *);
2N/Aextern void ecp_fini(void *);
2N/Aextern int ecp_offset(void);
2N/Aextern boolean_t ecp_send(void *, char *, int);
2N/Aextern void ecp_stats(void *, ecp_stat_t *);
2N/Aextern void ecp_timers(ecp_timers_t *);
2N/Aextern void ecp_get_config(void *, ecp_config_t *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _SYS_ECP_H */