Changes in uspace/lib/nic/include/nic.h [77ad86c:00d7e1b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/include/nic.h
r77ad86c r00d7e1b 42 42 #include <ddf/driver.h> 43 43 #include <device/hw_res_parsed.h> 44 #include <net/packet.h> 44 45 #include <ops/nic.h> 45 46 #define DEVICE_CATEGORY_NIC "nic"47 46 48 47 struct nic; … … 62 61 63 62 /** 64 * Simple structure for sending lists of frames.63 * Simple structure for sending the allocated frames (packets) in a list. 65 64 */ 66 65 typedef struct { 67 66 link_t link; 68 void *data; 69 size_t size; 67 packet_t *packet; 70 68 } nic_frame_t; 71 69 … … 73 71 74 72 /** 75 * Handler for writing framedata to the NIC device.76 * The function is responsible for releasing the frame.73 * Handler for writing packet data to the NIC device. 74 * The function is responsible for releasing the packet. 77 75 * It does not return anything, if some error is detected the function just 78 76 * silently fails (logging on debug level is suggested). 79 77 * 80 78 * @param nic_data 81 * @param data Pointer to frame data 82 * @param size Size of frame data in bytes 83 */ 84 typedef void (*send_frame_handler)(nic_t *, void *, size_t); 85 79 * @param packet Pointer to the packet to be sent 80 */ 81 typedef void (*write_packet_handler)(nic_t *, packet_t *); 86 82 /** 87 83 * The handler for transitions between driver states. … … 95 91 */ 96 92 typedef int (*state_change_handler)(nic_t *); 97 98 93 /** 99 94 * Handler for unicast filtering mode change. … … 108 103 */ 109 104 typedef int (*unicast_mode_change_handler)(nic_t *, 110 nic_unicast_mode_t, const nic_address_t *, size_t); 111 105 nic_unicast_mode_t, const nic_address_t *, size_t); 112 106 /** 113 107 * Handler for multicast filtering mode change. … … 122 116 */ 123 117 typedef int (*multicast_mode_change_handler)(nic_t *, 124 nic_multicast_mode_t, const nic_address_t *, size_t); 125 118 nic_multicast_mode_t, const nic_address_t *, size_t); 126 119 /** 127 120 * Handler for broadcast filtering mode change. … … 134 127 */ 135 128 typedef int (*broadcast_mode_change_handler)(nic_t *, nic_broadcast_mode_t); 136 137 129 /** 138 130 * Handler for blocked sources list change. … … 143 135 */ 144 136 typedef void (*blocked_sources_change_handler)(nic_t *, 145 const nic_address_t *, size_t); 146 137 const nic_address_t *, size_t); 147 138 /** 148 139 * Handler for VLAN filtering mask change. … … 151 142 */ 152 143 typedef void (*vlan_mask_change_handler)(nic_t *, const nic_vlan_mask_t *); 153 154 144 /** 155 145 * Handler called when a WOL virtue is added. … … 167 157 * @return ENOTSUP If this filter cannot work on this NIC (e.g. the NIC 168 158 * cannot run in promiscuous node or the limit of WOL 169 * frames' specifications was reached).159 * packets' specifications was reached). 170 160 * @return ELIMIT If this filter must implemented in HW but currently the 171 161 * limit of these HW filters was reached. 172 162 */ 173 163 typedef int (*wol_virtue_add_handler)(nic_t *, const nic_wol_virtue_t *); 174 175 164 /** 176 165 * Handler called when a WOL virtue is removed. … … 182 171 */ 183 172 typedef void (*wol_virtue_remove_handler)(nic_t *, const nic_wol_virtue_t *); 184 185 173 /** 186 174 * Handler for poll mode change. … … 195 183 */ 196 184 typedef int (*poll_mode_change_handler)(nic_t *, 197 nic_poll_mode_t, const struct timeval *); 198 185 nic_poll_mode_t, const struct timeval *); 199 186 /** 200 187 * Event handler called when the NIC should poll its buffers for a new frame … … 212 199 extern int nic_driver_init(const char *); 213 200 extern void nic_driver_implement(driver_ops_t *, ddf_dev_ops_t *, 214 201 nic_iface_t *); 215 202 216 203 /* Functions called in add_device */ 217 204 extern int nic_connect_to_services(nic_t *); 205 extern int nic_register_as_ddf_fun(nic_t *, ddf_dev_ops_t *); 218 206 extern int nic_get_resources(nic_t *, hw_res_list_parsed_t *); 219 207 extern void nic_set_specific(nic_t *, void *); 220 extern void nic_set_ send_frame_handler(nic_t *, send_frame_handler);208 extern void nic_set_write_packet_handler(nic_t *, write_packet_handler); 221 209 extern void nic_set_state_change_handlers(nic_t *, 222 210 state_change_handler, state_change_handler, state_change_handler); 223 211 extern void nic_set_filtering_change_handlers(nic_t *, 224 225 226 212 unicast_mode_change_handler, multicast_mode_change_handler, 213 broadcast_mode_change_handler, blocked_sources_change_handler, 214 vlan_mask_change_handler); 227 215 extern void nic_set_wol_virtue_change_handlers(nic_t *, 228 216 wol_virtue_add_handler, wol_virtue_remove_handler); 229 217 extern void nic_set_poll_handlers(nic_t *, 230 poll_mode_change_handler, poll_request_handler); 218 poll_mode_change_handler, poll_request_handler); 219 220 /* Functions called in device_added */ 221 extern int nic_ready(nic_t *); 231 222 232 223 /* General driver functions */ 233 224 extern ddf_dev_t *nic_get_ddf_dev(nic_t *); 234 225 extern ddf_fun_t *nic_get_ddf_fun(nic_t *); 235 extern void nic_set_ddf_fun(nic_t *, ddf_fun_t *);236 226 extern nic_t *nic_get_from_ddf_dev(ddf_dev_t *); 237 227 extern nic_t *nic_get_from_ddf_fun(ddf_fun_t *); … … 242 232 extern int nic_report_poll_mode(nic_t *, nic_poll_mode_t, struct timeval *); 243 233 extern void nic_query_address(nic_t *, nic_address_t *); 234 extern void nic_received_packet(nic_t *, packet_t *); 235 extern void nic_received_noneth_packet(nic_t *, packet_t *); 244 236 extern void nic_received_frame(nic_t *, nic_frame_t *); 245 237 extern void nic_received_frame_list(nic_t *, nic_frame_list_t *); … … 255 247 extern void nic_report_collisions(nic_t *, unsigned); 256 248 257 /* Frame / frame list allocation and deallocation */ 249 /* Packet / frame / frame list allocation and deallocation */ 250 extern packet_t *nic_alloc_packet(nic_t *, size_t); 251 extern void nic_release_packet(nic_t *, packet_t *); 258 252 extern nic_frame_t *nic_alloc_frame(nic_t *, size_t); 259 253 extern nic_frame_list_t *nic_alloc_frame_list(void); … … 264 258 extern void nic_report_hw_filtering(nic_t *, int, int, int); 265 259 extern void nic_query_unicast(const nic_t *, 266 260 nic_unicast_mode_t *, size_t, nic_address_t *, size_t *); 267 261 extern void nic_query_multicast(const nic_t *, 268 262 nic_multicast_mode_t *, size_t, nic_address_t *, size_t *); 269 263 extern void nic_query_broadcast(const nic_t *, nic_broadcast_mode_t *); 270 264 extern void nic_query_blocked_sources(const nic_t *, 271 265 size_t, nic_address_t *, size_t *); 272 266 extern int nic_query_vlan_mask(const nic_t *, nic_vlan_mask_t *); 273 267 extern int nic_query_wol_max_caps(const nic_t *, nic_wv_type_t); … … 280 274 extern void nic_sw_period_stop(nic_t *); 281 275 276 /* Packet DMA lock */ 277 extern void * nic_dma_lock_packet(packet_t * packet); 278 extern void nic_dma_unlock_packet(packet_t * packet); 279 282 280 #endif // __NIC_H__ 283 281
Note:
See TracChangeset
for help on using the changeset viewer.