|
Packit |
eace71 |
/*
|
|
Packit |
eace71 |
* Copyright (c) 2009-2011, Broadcom Corporation
|
|
Packit |
eace71 |
* Copyright (c) 2014, QLogic Corporation
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* Written by: Benjamin Li (benli@broadcom.com)
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* All rights reserved.
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* Redistribution and use in source and binary forms, with or without
|
|
Packit |
eace71 |
* modification, are permitted provided that the following conditions
|
|
Packit |
eace71 |
* are met:
|
|
Packit |
eace71 |
* 1. Redistributions of source code must retain the above copyright
|
|
Packit |
eace71 |
* notice, this list of conditions and the following disclaimer.
|
|
Packit |
eace71 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
Packit |
eace71 |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit |
eace71 |
* documentation and/or other materials provided with the distribution.
|
|
Packit |
eace71 |
* 3. All advertising materials mentioning features or use of this software
|
|
Packit |
eace71 |
* must display the following acknowledgement:
|
|
Packit |
eace71 |
* This product includes software developed by Adam Dunkels.
|
|
Packit |
eace71 |
* 4. The name of the author may not be used to endorse or promote
|
|
Packit |
eace71 |
* products derived from this software without specific prior
|
|
Packit |
eace71 |
* written permission.
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
Packit |
eace71 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
Packit |
eace71 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
eace71 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
Packit |
eace71 |
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
eace71 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
Packit |
eace71 |
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
Packit |
eace71 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
Packit |
eace71 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
Packit |
eace71 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
Packit |
eace71 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
* nic_util.h - NIC utility functions
|
|
Packit |
eace71 |
*
|
|
Packit |
eace71 |
*/
|
|
Packit |
eace71 |
#ifndef __NIC_UTILS_H__
|
|
Packit |
eace71 |
#define __NIC_UTILS_H__
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
#include "nic.h"
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
/******************************************************************************
|
|
Packit |
eace71 |
* Function Prototype
|
|
Packit |
eace71 |
******************************************************************************/
|
|
Packit |
eace71 |
int manually_trigger_uio_event(nic_t *nic, int uio_minor);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int nic_discover_iscsi_hosts();
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int enable_mutlicast(nic_t *nic);
|
|
Packit |
eace71 |
int disable_mutlicast(nic_t *nic);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int from_netdev_name_find_nic(char *interface_name, nic_t **nic);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int from_host_no_find_associated_eth_device(int host_no, nic_t **nic);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int from_phys_name_find_assoicated_uio_device(nic_t *nic);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int nic_queue_tx_packet(nic_t *nic,
|
|
Packit |
eace71 |
nic_interface_t *nic_iface, packet_t *pkt);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
packet_t *nic_dequeue_tx_packet(nic_t *nic);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
void nic_fill_ethernet_header(nic_interface_t *nic_iface,
|
|
Packit |
eace71 |
void *data,
|
|
Packit |
eace71 |
void *src_addr, void *dest_addr,
|
|
Packit |
eace71 |
int *pkt_size, void **start_addr,
|
|
Packit |
eace71 |
uint16_t ether_type);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
struct nic_interface *nic_find_nic_iface(nic_t *nic, uint16_t protocol,
|
|
Packit |
eace71 |
uint16_t vlan_id, int iface_num,
|
|
Packit |
eace71 |
int request_type);
|
|
Packit |
eace71 |
void set_nic_iface(nic_t *nic, nic_interface_t *nic_iface);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
void persist_all_nic_iface(nic_t *nic);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int add_vlan_interfaces(nic_t *nic);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int nic_verify_uio_sysfs_name(nic_t *nic);
|
|
Packit |
eace71 |
void cnic_get_sysfs_pci_resource_path(nic_t *nic, int resc_no,
|
|
Packit |
eace71 |
char *sys_path, size_t size);
|
|
Packit |
eace71 |
void nic_close_all();
|
|
Packit |
eace71 |
void nic_remove_all();
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int detemine_initial_uio_events(nic_t *nic, uint32_t *num_of_events);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
uint32_t calculate_default_netmask(uint32_t ip_addr);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
void prepare_nic_thread(nic_t *nic);
|
|
Packit |
eace71 |
void prepare_library(nic_t *nic);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int nic_enable(nic_t *nic);
|
|
Packit |
eace71 |
void nic_disable(nic_t *nic, int going_down);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
void dump_packet_to_log(struct nic_interface *iface,
|
|
Packit |
eace71 |
uint8_t *buf, uint16_t buf_len);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int determine_file_size_read(const char *filepath);
|
|
Packit |
eace71 |
int capture_file(char **raw, uint32_t *raw_size, const char *path);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
int get_iscsi_transport_handle(nic_t *nic, uint64_t *handle);
|
|
Packit |
eace71 |
|
|
Packit |
eace71 |
#endif /* __NIC_UTILS_H__ */
|