dld.h (afdda45f) dld.h (da14cebe)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 24 unchanged lines hidden (view full) ---

33 * that is shared betwen user and kernel space. The dld driver thus
34 * assumes that the structures have identical layout and size when
35 * compiled in either IPL32 or LP64.
36 */
37
38#include <sys/types.h>
39#include <sys/stream.h>
40#include <sys/dld_ioc.h>
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 24 unchanged lines hidden (view full) ---

33 * that is shared betwen user and kernel space. The dld driver thus
34 * assumes that the structures have identical layout and size when
35 * compiled in either IPL32 or LP64.
36 */
37
38#include <sys/types.h>
39#include <sys/stream.h>
40#include <sys/dld_ioc.h>
41#include <sys/mac_flow.h>
41#include <sys/conf.h>
42#include <sys/sad.h>
43#include <net/if.h>
44#include <sys/ddi.h>
45#include <sys/sunddi.h>
46#include <sys/mac.h>
47
48#ifdef __cplusplus

--- 30 unchanged lines hidden (view full) ---

79 */
80#define DLD_PROP_NO_SOFTRING "no-softring"
81
82/*
83 * The name of the driver.
84 */
85#define DLD_DRIVER_NAME "dld"
86
42#include <sys/conf.h>
43#include <sys/sad.h>
44#include <net/if.h>
45#include <sys/ddi.h>
46#include <sys/sunddi.h>
47#include <sys/mac.h>
48
49#ifdef __cplusplus

--- 30 unchanged lines hidden (view full) ---

80 */
81#define DLD_PROP_NO_SOFTRING "no-softring"
82
83/*
84 * The name of the driver.
85 */
86#define DLD_DRIVER_NAME "dld"
87
88#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
89#pragma pack(4)
90#endif
91
87/*
88 * IOCTL codes and data structures.
89 */
90#define DLDIOC_ATTR DLDIOC(0x03)
91
92typedef struct dld_ioc_attr {
92/*
93 * IOCTL codes and data structures.
94 */
95#define DLDIOC_ATTR DLDIOC(0x03)
96
97typedef struct dld_ioc_attr {
93 datalink_id_t dia_linkid;
94 uint_t dia_max_sdu;
98 datalink_id_t dia_linkid;
99 uint_t dia_max_sdu;
95} dld_ioc_attr_t;
96
97#define DLDIOC_VLAN_ATTR DLDIOC(0x04)
98typedef struct dld_ioc_vlan_attr {
99 datalink_id_t div_vlanid;
100 uint16_t div_vid;
101 datalink_id_t div_linkid;
102 boolean_t div_force;
100} dld_ioc_attr_t;
101
102#define DLDIOC_VLAN_ATTR DLDIOC(0x04)
103typedef struct dld_ioc_vlan_attr {
104 datalink_id_t div_vlanid;
105 uint16_t div_vid;
106 datalink_id_t div_linkid;
107 boolean_t div_force;
103 boolean_t div_implicit;
104} dld_ioc_vlan_attr_t;
105
106#define DLDIOC_PHYS_ATTR DLDIOC(0x05)
107#define DLPI_LINKNAME_MAX 32
108
109typedef struct dld_ioc_phys_attr {
110 datalink_id_t dip_linkid;
111 /*

--- 86 unchanged lines hidden (view full) ---

198 *
199 * #define DLDIOC_SETZID DLDIOC(0x12)
200 * #define DLDIOC_GETZID DLDIOC(0x13)
201 */
202
203typedef struct dld_ioc_zid {
204 zoneid_t diz_zid;
205 char diz_link[MAXLINKNAMELEN];
108} dld_ioc_vlan_attr_t;
109
110#define DLDIOC_PHYS_ATTR DLDIOC(0x05)
111#define DLPI_LINKNAME_MAX 32
112
113typedef struct dld_ioc_phys_attr {
114 datalink_id_t dip_linkid;
115 /*

--- 86 unchanged lines hidden (view full) ---

202 *
203 * #define DLDIOC_SETZID DLDIOC(0x12)
204 * #define DLDIOC_GETZID DLDIOC(0x13)
205 */
206
207typedef struct dld_ioc_zid {
208 zoneid_t diz_zid;
209 char diz_link[MAXLINKNAMELEN];
206 boolean_t diz_is_ppa_hack;
207} dld_ioc_zid_t;
208
210} dld_ioc_zid_t;
211
209#define DLDIOC_GETZID DLDIOC(0x13)
210typedef struct dld_ioc_getzid {
211 datalink_id_t dig_linkid;
212 zoneid_t dig_zid;
213} dld_ioc_getzid_t;
214
215/*
216 * data-link autopush configuration.
217 */
218struct dlautopush {
219 uint_t dap_anchor;
220 uint_t dap_npush;
221 char dap_aplist[MAXAPUSH][FMNAMESZ+1];
222};
223
212/*
213 * data-link autopush configuration.
214 */
215struct dlautopush {
216 uint_t dap_anchor;
217 uint_t dap_npush;
218 char dap_aplist[MAXAPUSH][FMNAMESZ+1];
219};
220
224#define DLDIOC_SETMACPROP DLDIOC(0x14)
225#define DLDIOC_GETMACPROP DLDIOC(0x15)
221#define DLDIOC_MACADDRGET DLDIOC(0x15)
222typedef struct dld_ioc_macaddrget {
223 datalink_id_t dig_linkid;
224 uint_t dig_count;
225 uint_t dig_size;
226} dld_ioc_macaddrget_t;
227
228/* possible flags for dmi_flags below */
229#define DLDIOCMACADDR_USED 0x1 /* address slot used */
230
231typedef struct dld_macaddrinfo {
232 uint_t dmi_slot;
233 uint_t dmi_flags;
234 uint_t dmi_addrlen;
235 uchar_t dmi_addr[MAXMACADDRLEN];
236 char dmi_client_name[MAXNAMELEN];
237 datalink_id_t dma_client_linkid;
238} dld_macaddrinfo_t;
239
240/*
241 * IOCTL codes and data structures for flowadm.
242 */
243#define DLDIOC_ADDFLOW DLDIOC(0x16)
244typedef struct dld_ioc_addflow {
245 datalink_id_t af_linkid;
246 flow_desc_t af_flow_desc;
247 mac_resource_props_t af_resource_props;
248 char af_name[MAXNAMELEN];
249} dld_ioc_addflow_t;
250
251#define DLDIOC_REMOVEFLOW DLDIOC(0x17)
252typedef struct dld_ioc_removeflow {
253 char rf_name[MAXNAMELEN];
254} dld_ioc_removeflow_t;
255
256#define DLDIOC_MODIFYFLOW DLDIOC(0x18)
257typedef struct dld_ioc_modifyflow {
258 char mf_name[MAXNAMELEN];
259 mac_resource_props_t mf_resource_props;
260} dld_ioc_modifyflow_t;
261
262#define DLDIOC_WALKFLOW DLDIOC(0x19)
263typedef struct dld_ioc_walkflow {
264 datalink_id_t wf_linkid;
265 char wf_name[MAXNAMELEN];
266 uint32_t wf_nflows;
267 uint_t wf_len;
268} dld_ioc_walkflow_t;
269
270typedef struct dld_flowinfo {
271 datalink_id_t fi_linkid;
272 flow_desc_t fi_flow_desc;
273 mac_resource_props_t fi_resource_props;
274 char fi_flowname[MAXNAMELEN];
275 uint32_t fi_pad;
276} dld_flowinfo_t;
277
278#define DLDIOC_USAGELOG DLDIOC(0x1a)
279typedef struct dld_ioc_usagelog {
280 mac_logtype_t ul_type;
281 boolean_t ul_onoff;
282 uint_t ul_interval;
283} dld_ioc_usagelog_t;
284
285#define DLDIOC_SETMACPROP DLDIOC(0x1b)
286#define DLDIOC_GETMACPROP DLDIOC(0x1c)
226#define MAC_PROP_VERSION 1
227
228typedef struct dld_ioc_macprop_s {
229 int pr_version;
230 uint_t pr_flags;
231 datalink_id_t pr_linkid;
232 mac_prop_id_t pr_num;
233 uint_t pr_perm_flags;
234 char pr_name[MAXLINKPROPNAME];
235 uint_t pr_valsize; /* sizeof pr_val */
236 char pr_val[1];
237} dld_ioc_macprop_t;
238
287#define MAC_PROP_VERSION 1
288
289typedef struct dld_ioc_macprop_s {
290 int pr_version;
291 uint_t pr_flags;
292 datalink_id_t pr_linkid;
293 mac_prop_id_t pr_num;
294 uint_t pr_perm_flags;
295 char pr_name[MAXLINKPROPNAME];
296 uint_t pr_valsize; /* sizeof pr_val */
297 char pr_val[1];
298} dld_ioc_macprop_t;
299
300#define DLDIOC_GETHWGRP DLDIOC(0x1d)
301
302typedef struct dld_ioc_hwgrpget {
303 datalink_id_t dih_linkid;
304 uint_t dih_n_groups; /* number of groups included in ioc */
305 uint_t dih_size;
306} dld_ioc_hwgrpget_t;
307
308#define MAXCLIENTNAMELEN 1024
309typedef struct dld_hwgrpinfo {
310 char dhi_link_name[MAXLINKNAMELEN];
311 uint_t dhi_grp_num;
312 uint_t dhi_grp_type;
313 uint_t dhi_n_rings;
314 uint_t dhi_n_clnts;
315 /* XXXX later we should use dhi_n_clnts * MAXNAMELEN for dhi_clnts */
316 char dhi_clnts[MAXCLIENTNAMELEN];
317} dld_hwgrpinfo_t;
318
319#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
320#pragma pack()
321#endif
322
239#ifdef _KERNEL
323#ifdef _KERNEL
324
325#define DLD_CAPAB_DIRECT 0x00000001
326#define DLD_CAPAB_POLL 0x00000002
327#define DLD_CAPAB_PERIM 0x00000003
328#define DLD_CAPAB_LSO 0x00000004
329
330#define DLD_ENABLE 0x00000001
331#define DLD_DISABLE 0x00000002
332#define DLD_QUERY 0x00000003
333
334/*
335 * GLDv3 entry point for negotiating capabilities.
336 * This is exposed to IP after negotiation of DL_CAPAB_DLD.
337 *
338 * This function takes the following arguments:
339 * handle: used for identifying the interface to operate on (provided by dld).
340 * type: capability type.
341 * arg: points to a capability-specific structure.
342 * flags: used for indicating whether to enable or disable a capability.
343 *
344 * With this function, capability negotiation is reduced from a multi-step
345 * process to just one single function call.
346 * e.g. the following code would pass 'x' from IP to dld and obtain
347 * arg.output_arg from dld:
348 *
349 * arg.input_arg = x;
350 * rc = (*dld_capab)(handle, DLD_CAPAB_XXX, &arg, DLD_ENABLE);
351 * ill->info1 = arg.output_arg;
352 */
353typedef int (*dld_capab_func_t)(void *, uint_t, void *, uint_t);
354
355/*
356 * Direct Tx/Rx capability.
357 */
358typedef struct dld_capab_direct_s {
359 /*
360 * Rx entry point and handle, owned by IP.
361 */
362 uintptr_t di_rx_cf;
363 void *di_rx_ch;
364
365 /*
366 * Tx entry points and handle, owned by DLD.
367 */
368 /* Entry point for transmitting packets */
369 uintptr_t di_tx_df;
370 void *di_tx_dh;
371
372 /* flow control notification callback */
373 uintptr_t di_tx_cb_df; /* callback registration/de-registration */
374 void *di_tx_cb_dh;
375} dld_capab_direct_t;
376
377/*
378 * Polling/softring capability.
379 */
380#define POLL_SOFTRING 0x00000001
381typedef struct dld_capab_poll_s {
382 uintptr_t poll_ring_add_cf;
383 uintptr_t poll_ring_remove_cf;
384 uintptr_t poll_ring_quiesce_cf;
385 uintptr_t poll_ring_restart_cf;
386 uintptr_t poll_ring_bind_cf;
387 void *poll_ring_ch;
388 uintptr_t poll_mac_accept_df;
389 void *poll_mac_dh;
390} dld_capab_poll_t;
391
392/*
393 * LSO capability
394 */
395/*
396 * Currently supported flags for LSO.
397 */
398#define DLD_LSO_TX_BASIC_TCP_IPV4 0x01 /* TCP LSO capability */
399
400typedef struct dld_capab_lso_s {
401 uint_t lso_flags; /* capability flags */
402 uint_t lso_max; /* maximum payload */
403} dld_capab_lso_t;
404
240int dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
241int dld_open(queue_t *, dev_t *, int, int, cred_t *);
242int dld_close(queue_t *);
243void dld_wput(queue_t *, mblk_t *);
244void dld_wsrv(queue_t *);
245void dld_init_ops(struct dev_ops *, const char *);
246void dld_fini_ops(struct dev_ops *);
247int dld_autopush(dev_t *, struct dlautopush *);
405int dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
406int dld_open(queue_t *, dev_t *, int, int, cred_t *);
407int dld_close(queue_t *);
408void dld_wput(queue_t *, mblk_t *);
409void dld_wsrv(queue_t *);
410void dld_init_ops(struct dev_ops *, const char *);
411void dld_fini_ops(struct dev_ops *);
412int dld_autopush(dev_t *, struct dlautopush *);
413
414int dld_add_flow(datalink_id_t, char *, flow_desc_t *,
415 mac_resource_props_t *);
416int dld_remove_flow(char *);
417int dld_modify_flow(char *, mac_resource_props_t *);
418int dld_walk_flow(dld_ioc_walkflow_t *, intptr_t);
419
248#endif
249
250#ifdef __cplusplus
251}
252#endif
253
254#endif /* _SYS_DLD_H */
420#endif
421
422#ifdef __cplusplus
423}
424#endif
425
426#endif /* _SYS_DLD_H */