/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 (c) 2012, Oracle and/or its affiliates. All rights reserved.
*/
#ifndef _SYS_ECP_H
#define _SYS_ECP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <sys/ethernet.h>
#include <lldp.h>
#define ECP_VDP 0x0001
#define ECP_MAX_PDULEN 1500
#define ECP_VERSION 0x1
#define ECP_VER_MASK 0xF
#define ECP_OP_MASK 0x3
#define ECP_SUBTYPE_MASK 0x3FF
#define ECP_VER_SHIFT 12
#define ECP_OP_SHIFT 10
#define ECP_SUBTYPE_SHIFT 0
#define ECP_MAX_TRIES 3
#define ECP_ACK_TIME_OUT 164 /* timeout in msec */
#define ECP_RTE_EXPONENT 20
enum ecp_op_type {
ECP_REQ = 0,
ECP_ACK
};
/* ECP Statistcs */
typedef struct ecp_stat_s {
uint64_t es_ipkts;
uint64_t es_ierrors;
uint64_t es_opkts;
uint64_t es_oerrors;
uint64_t es_rexmits;
uint64_t es_timeouts;
} ecp_stat_t;
typedef struct ecp_timers_s {
int et_r; /* Maximum retries */
int et_rte; /* Exponent for computing Retransmission interval */
} ecp_timers_t;
/* ECP config info */
typedef struct ecp_config_s {
ushort_t ecpc_req_seq;
ushort_t ecpc_ack_seq;
ushort_t ecpc_last_ack_seq;
int ecpc_max_tx_attempts;
} ecp_config_t;
typedef void (*ecp_ulp_cb_t)(void *, ushort_t, ushort_t, char *, int);
#define ECP_STDERR_LOG 1
#define ECP_SYS_LOG 2
extern void * ecp_init(struct ether_addr *, struct ether_addr *,
uint16_t, int, int, ecp_ulp_cb_t, void *, int, int *);
extern void ecp_fini(void *);
extern int ecp_offset(void);
extern boolean_t ecp_send(void *, char *, int);
extern void ecp_stats(void *, ecp_stat_t *);
extern void ecp_timers(ecp_timers_t *);
extern void ecp_get_config(void *, ecp_config_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ECP_H */