Get rid of sys/time.h
[helenos.git] / uspace / lib / drv / include / ops / nic.h
blobb65ed5c63de7af938c6ce2e0eef75446bc329c26
1 /*
2 * Copyright (c) 2011 Radim Vansa
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 /** @addtogroup libdrv
30 * @{
32 /** @file
33 * @brief DDF NIC interface definition
36 #ifndef LIBDRV_OPS_NIC_H_
37 #define LIBDRV_OPS_NIC_H_
39 #include <ipc/services.h>
40 #include <nic/nic.h>
41 #include <time.h>
42 #include "../ddf/driver.h"
44 typedef struct nic_iface {
45 /** Mandatory methods */
46 errno_t (*send_frame)(ddf_fun_t *, void *, size_t);
47 errno_t (*callback_create)(ddf_fun_t *);
48 errno_t (*get_state)(ddf_fun_t *, nic_device_state_t *);
49 errno_t (*set_state)(ddf_fun_t *, nic_device_state_t);
50 errno_t (*get_address)(ddf_fun_t *, nic_address_t *);
52 /** Optional methods */
53 errno_t (*set_address)(ddf_fun_t *, const nic_address_t *);
54 errno_t (*get_stats)(ddf_fun_t *, nic_device_stats_t *);
55 errno_t (*get_device_info)(ddf_fun_t *, nic_device_info_t *);
56 errno_t (*get_cable_state)(ddf_fun_t *, nic_cable_state_t *);
58 errno_t (*get_operation_mode)(ddf_fun_t *, int *, nic_channel_mode_t *,
59 nic_role_t *);
60 errno_t (*set_operation_mode)(ddf_fun_t *, int, nic_channel_mode_t,
61 nic_role_t);
62 errno_t (*autoneg_enable)(ddf_fun_t *, uint32_t);
63 errno_t (*autoneg_disable)(ddf_fun_t *);
64 errno_t (*autoneg_probe)(ddf_fun_t *, uint32_t *, uint32_t *,
65 nic_result_t *, nic_result_t *);
66 errno_t (*autoneg_restart)(ddf_fun_t *);
67 errno_t (*get_pause)(ddf_fun_t *, nic_result_t *, nic_result_t *,
68 uint16_t *);
69 errno_t (*set_pause)(ddf_fun_t *, int, int, uint16_t);
71 errno_t (*unicast_get_mode)(ddf_fun_t *, nic_unicast_mode_t *, size_t,
72 nic_address_t *, size_t *);
73 errno_t (*unicast_set_mode)(ddf_fun_t *, nic_unicast_mode_t,
74 const nic_address_t *, size_t);
75 errno_t (*multicast_get_mode)(ddf_fun_t *, nic_multicast_mode_t *, size_t,
76 nic_address_t *, size_t *);
77 errno_t (*multicast_set_mode)(ddf_fun_t *, nic_multicast_mode_t,
78 const nic_address_t *, size_t);
79 errno_t (*broadcast_get_mode)(ddf_fun_t *, nic_broadcast_mode_t *);
80 errno_t (*broadcast_set_mode)(ddf_fun_t *, nic_broadcast_mode_t);
81 errno_t (*defective_get_mode)(ddf_fun_t *, uint32_t *);
82 errno_t (*defective_set_mode)(ddf_fun_t *, uint32_t);
83 errno_t (*blocked_sources_get)(ddf_fun_t *, size_t, nic_address_t *,
84 size_t *);
85 errno_t (*blocked_sources_set)(ddf_fun_t *, const nic_address_t *, size_t);
87 errno_t (*vlan_get_mask)(ddf_fun_t *, nic_vlan_mask_t *);
88 errno_t (*vlan_set_mask)(ddf_fun_t *, const nic_vlan_mask_t *);
89 errno_t (*vlan_set_tag)(ddf_fun_t *, uint16_t, bool, bool);
91 errno_t (*wol_virtue_add)(ddf_fun_t *, nic_wv_type_t, const void *,
92 size_t, nic_wv_id_t *);
93 errno_t (*wol_virtue_remove)(ddf_fun_t *, nic_wv_id_t);
94 errno_t (*wol_virtue_probe)(ddf_fun_t *, nic_wv_id_t, nic_wv_type_t *,
95 size_t, void *, size_t *);
96 errno_t (*wol_virtue_list)(ddf_fun_t *, nic_wv_type_t, size_t,
97 nic_wv_id_t *, size_t *);
98 errno_t (*wol_virtue_get_caps)(ddf_fun_t *, nic_wv_type_t, int *);
99 errno_t (*wol_load_info)(ddf_fun_t *, nic_wv_type_t *, size_t,
100 uint8_t *, size_t *);
102 errno_t (*offload_probe)(ddf_fun_t *, uint32_t *, uint32_t *);
103 errno_t (*offload_set)(ddf_fun_t *, uint32_t, uint32_t);
105 errno_t (*poll_get_mode)(ddf_fun_t *, nic_poll_mode_t *,
106 struct timespec *);
107 errno_t (*poll_set_mode)(ddf_fun_t *, nic_poll_mode_t,
108 const struct timespec *);
109 errno_t (*poll_now)(ddf_fun_t *);
110 } nic_iface_t;
112 #endif
115 * @}