| [609243f4] | 1 | /*
 | 
|---|
 | 2 |  * Copyright (c) 2011 Radim Vansa
 | 
|---|
 | 3 |  * All rights reserved.
 | 
|---|
 | 4 |  *
 | 
|---|
 | 5 |  * Redistribution and use in source and binary forms, with or without
 | 
|---|
 | 6 |  * modification, are permitted provided that the following conditions
 | 
|---|
 | 7 |  * are met:
 | 
|---|
 | 8 |  *
 | 
|---|
 | 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.
 | 
|---|
 | 16 |  *
 | 
|---|
 | 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.
 | 
|---|
 | 27 |  */
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 | /** @addtogroup libdrv
 | 
|---|
 | 30 |  * @{
 | 
|---|
 | 31 |  */
 | 
|---|
 | 32 | /** @file
 | 
|---|
 | 33 |  * @brief DDF NIC interface definition
 | 
|---|
 | 34 |  */
 | 
|---|
 | 35 | 
 | 
|---|
 | 36 | #ifndef LIBDRV_OPS_NIC_H_
 | 
|---|
 | 37 | #define LIBDRV_OPS_NIC_H_
 | 
|---|
 | 38 | 
 | 
|---|
 | 39 | #include <ipc/services.h>
 | 
|---|
| [cf9cb36] | 40 | #include <nic/nic.h>
 | 
|---|
| [609243f4] | 41 | #include <sys/time.h>
 | 
|---|
 | 42 | 
 | 
|---|
 | 43 | #include "../ddf/driver.h"
 | 
|---|
 | 44 | 
 | 
|---|
 | 45 | typedef struct nic_iface {
 | 
|---|
 | 46 |         /** Mandatory methods */
 | 
|---|
| [6d8455d] | 47 |         int (*send_frame)(ddf_fun_t *, void *, size_t);
 | 
|---|
| [9cd8165] | 48 |         int (*callback_create)(ddf_fun_t *);
 | 
|---|
| [609243f4] | 49 |         int (*get_state)(ddf_fun_t *, nic_device_state_t *);
 | 
|---|
 | 50 |         int (*set_state)(ddf_fun_t *, nic_device_state_t);
 | 
|---|
 | 51 |         int (*get_address)(ddf_fun_t *, nic_address_t *);
 | 
|---|
 | 52 |         
 | 
|---|
 | 53 |         /** Optional methods */
 | 
|---|
 | 54 |         int (*set_address)(ddf_fun_t *, const nic_address_t *);
 | 
|---|
 | 55 |         int (*get_stats)(ddf_fun_t *, nic_device_stats_t *);
 | 
|---|
 | 56 |         int (*get_device_info)(ddf_fun_t *, nic_device_info_t *);
 | 
|---|
 | 57 |         int (*get_cable_state)(ddf_fun_t *, nic_cable_state_t *);
 | 
|---|
 | 58 |         
 | 
|---|
 | 59 |         int (*get_operation_mode)(ddf_fun_t *, int *, nic_channel_mode_t *,
 | 
|---|
 | 60 |             nic_role_t *);
 | 
|---|
 | 61 |         int (*set_operation_mode)(ddf_fun_t *, int, nic_channel_mode_t,
 | 
|---|
 | 62 |             nic_role_t);
 | 
|---|
 | 63 |         int (*autoneg_enable)(ddf_fun_t *, uint32_t);
 | 
|---|
 | 64 |         int (*autoneg_disable)(ddf_fun_t *);
 | 
|---|
 | 65 |         int (*autoneg_probe)(ddf_fun_t *, uint32_t *, uint32_t *,
 | 
|---|
 | 66 |             nic_result_t *, nic_result_t *);
 | 
|---|
 | 67 |         int (*autoneg_restart)(ddf_fun_t *);
 | 
|---|
 | 68 |         int (*get_pause)(ddf_fun_t *, nic_result_t *, nic_result_t *,
 | 
|---|
 | 69 |                 uint16_t *);
 | 
|---|
 | 70 |         int (*set_pause)(ddf_fun_t *, int, int, uint16_t);
 | 
|---|
 | 71 |         
 | 
|---|
 | 72 |         int (*unicast_get_mode)(ddf_fun_t *, nic_unicast_mode_t *, size_t,
 | 
|---|
 | 73 |             nic_address_t *, size_t *);
 | 
|---|
 | 74 |         int (*unicast_set_mode)(ddf_fun_t *, nic_unicast_mode_t,
 | 
|---|
 | 75 |             const nic_address_t *, size_t);
 | 
|---|
 | 76 |         int (*multicast_get_mode)(ddf_fun_t *, nic_multicast_mode_t *, size_t,
 | 
|---|
 | 77 |             nic_address_t *, size_t *);
 | 
|---|
 | 78 |         int (*multicast_set_mode)(ddf_fun_t *, nic_multicast_mode_t,
 | 
|---|
 | 79 |             const nic_address_t *, size_t);
 | 
|---|
 | 80 |         int (*broadcast_get_mode)(ddf_fun_t *, nic_broadcast_mode_t *);
 | 
|---|
 | 81 |         int (*broadcast_set_mode)(ddf_fun_t *, nic_broadcast_mode_t);
 | 
|---|
 | 82 |         int (*defective_get_mode)(ddf_fun_t *, uint32_t *);
 | 
|---|
 | 83 |         int (*defective_set_mode)(ddf_fun_t *, uint32_t);
 | 
|---|
 | 84 |         int (*blocked_sources_get)(ddf_fun_t *, size_t, nic_address_t *,
 | 
|---|
 | 85 |             size_t *);
 | 
|---|
 | 86 |         int (*blocked_sources_set)(ddf_fun_t *, const nic_address_t *, size_t);
 | 
|---|
 | 87 |         
 | 
|---|
 | 88 |         int (*vlan_get_mask)(ddf_fun_t *, nic_vlan_mask_t *);
 | 
|---|
 | 89 |         int (*vlan_set_mask)(ddf_fun_t *, const nic_vlan_mask_t *);
 | 
|---|
| [fd6bd6d] | 90 |         int (*vlan_set_tag)(ddf_fun_t *, uint16_t, bool, bool);
 | 
|---|
| [609243f4] | 91 |         
 | 
|---|
 | 92 |         int (*wol_virtue_add)(ddf_fun_t *, nic_wv_type_t, const void *,
 | 
|---|
 | 93 |             size_t, nic_wv_id_t *);
 | 
|---|
 | 94 |         int (*wol_virtue_remove)(ddf_fun_t *, nic_wv_id_t);
 | 
|---|
 | 95 |         int (*wol_virtue_probe)(ddf_fun_t *, nic_wv_id_t, nic_wv_type_t *,
 | 
|---|
 | 96 |             size_t, void *, size_t *);
 | 
|---|
 | 97 |         int (*wol_virtue_list)(ddf_fun_t *, nic_wv_type_t, size_t,
 | 
|---|
 | 98 |             nic_wv_id_t *, size_t *);
 | 
|---|
 | 99 |         int (*wol_virtue_get_caps)(ddf_fun_t *, nic_wv_type_t, int *);
 | 
|---|
 | 100 |         int (*wol_load_info)(ddf_fun_t *, nic_wv_type_t *, size_t,
 | 
|---|
 | 101 |             uint8_t *, size_t *);
 | 
|---|
 | 102 |         
 | 
|---|
 | 103 |         int (*offload_probe)(ddf_fun_t *, uint32_t *, uint32_t *);
 | 
|---|
 | 104 |         int (*offload_set)(ddf_fun_t *, uint32_t, uint32_t);
 | 
|---|
 | 105 |         
 | 
|---|
 | 106 |         int (*poll_get_mode)(ddf_fun_t *, nic_poll_mode_t *,
 | 
|---|
 | 107 |             struct timeval *);
 | 
|---|
 | 108 |         int (*poll_set_mode)(ddf_fun_t *, nic_poll_mode_t,
 | 
|---|
 | 109 |             const struct timeval *);
 | 
|---|
 | 110 |         int (*poll_now)(ddf_fun_t *);
 | 
|---|
 | 111 | } nic_iface_t;
 | 
|---|
 | 112 | 
 | 
|---|
 | 113 | #endif
 | 
|---|
 | 114 | 
 | 
|---|
 | 115 | /**
 | 
|---|
 | 116 |  * @}
 | 
|---|
 | 117 |  */
 | 
|---|