ixlv.h revision 270631
10SN/A/****************************************************************************** 2157SN/A 30SN/A Copyright (c) 2013-2014, Intel Corporation 40SN/A All rights reserved. 50SN/A 60SN/A Redistribution and use in source and binary forms, with or without 7157SN/A modification, are permitted provided that the following conditions are met: 80SN/A 9157SN/A 1. Redistributions of source code must retain the above copyright notice, 100SN/A this list of conditions and the following disclaimer. 110SN/A 120SN/A 2. Redistributions in binary form must reproduce the above copyright 130SN/A notice, this list of conditions and the following disclaimer in the 140SN/A documentation and/or other materials provided with the distribution. 150SN/A 160SN/A 3. Neither the name of the Intel Corporation nor the names of its 170SN/A contributors may be used to endorse or promote products derived from 180SN/A this software without specific prior written permission. 190SN/A 200SN/A THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21157SN/A AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22157SN/A IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23157SN/A ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 240SN/A LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 250SN/A CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 260SN/A SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 270SN/A INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 280SN/A CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 290SN/A ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 300SN/A POSSIBILITY OF SUCH DAMAGE. 310SN/A 320SN/A******************************************************************************/ 330SN/A/*$FreeBSD: stable/10/sys/dev/ixl/ixlv.h 270631 2014-08-25 22:04:29Z jfv $*/ 340SN/A 350SN/A 360SN/A#ifndef _IXLV_H_ 370SN/A#define _IXLV_H_ 380SN/A 390SN/A#define IXLV_AQ_MAX_ERR 100 400SN/A#define IXLV_MAX_FILTERS 128 410SN/A#define IXLV_MAX_QUEUES 16 420SN/A#define IXLV_AQ_TIMEOUT (1 * hz) 430SN/A#define IXLV_CALLOUT_TIMO (hz / 50) // 20 msec 440SN/A 450SN/A#define IXLV_FLAG_AQ_ENABLE_QUEUES (u32)(1) 460SN/A#define IXLV_FLAG_AQ_DISABLE_QUEUES (u32)(1 << 1) 470SN/A#define IXLV_FLAG_AQ_ADD_MAC_FILTER (u32)(1 << 2) 480SN/A#define IXLV_FLAG_AQ_ADD_VLAN_FILTER (u32)(1 << 3) 490SN/A#define IXLV_FLAG_AQ_DEL_MAC_FILTER (u32)(1 << 4) 500SN/A#define IXLV_FLAG_AQ_DEL_VLAN_FILTER (u32)(1 << 5) 510SN/A#define IXLV_FLAG_AQ_CONFIGURE_QUEUES (u32)(1 << 6) 520SN/A#define IXLV_FLAG_AQ_MAP_VECTORS (u32)(1 << 7) 530SN/A#define IXLV_FLAG_AQ_HANDLE_RESET (u32)(1 << 8) 540SN/A#define IXLV_FLAG_AQ_CONFIGURE_PROMISC (u32)(1 << 9) 550SN/A#define IXLV_FLAG_AQ_GET_STATS (u32)(1 << 10) 560SN/A 570SN/A/* printf %b arg */ 580SN/A#define IXLV_FLAGS \ 590SN/A "\20\1ENABLE_QUEUES\2DISABLE_QUEUES\3ADD_MAC_FILTER" \ 600SN/A "\4ADD_VLAN_FILTER\5DEL_MAC_FILTER\6DEL_VLAN_FILTER" \ 610SN/A "\7CONFIGURE_QUEUES\10MAP_VECTORS\11HANDLE_RESET" \ 620SN/A "\12CONFIGURE_PROMISC\13GET_STATS" 630SN/A 640SN/A/* Driver state */ 650SN/Aenum ixlv_state_t { 660SN/A IXLV_START, 670SN/A IXLV_FAILED, 680SN/A IXLV_RESET_REQUIRED, 690SN/A IXLV_RESET_PENDING, 700SN/A IXLV_VERSION_CHECK, 710SN/A IXLV_GET_RESOURCES, 720SN/A IXLV_INIT_READY, 730SN/A IXLV_INIT_START, 740SN/A IXLV_INIT_CONFIG, 750SN/A IXLV_INIT_MAPPING, 760SN/A IXLV_INIT_ENABLE, 770SN/A IXLV_INIT_COMPLETE, 780SN/A IXLV_RUNNING, 790SN/A}; 800SN/A 810SN/Astruct ixlv_mac_filter { 820SN/A SLIST_ENTRY(ixlv_mac_filter) next; 830SN/A u8 macaddr[ETHER_ADDR_LEN]; 840SN/A u16 flags; 850SN/A}; 860SN/ASLIST_HEAD(mac_list, ixlv_mac_filter); 870SN/A 880SN/Astruct ixlv_vlan_filter { 890SN/A SLIST_ENTRY(ixlv_vlan_filter) next; 900SN/A u16 vlan; 910SN/A u16 flags; 920SN/A}; 930SN/ASLIST_HEAD(vlan_list, ixlv_vlan_filter); 940SN/A 950SN/A/* Software controller structure */ 960SN/Astruct ixlv_sc { 970SN/A struct i40e_hw hw; 980SN/A struct i40e_osdep osdep; 990SN/A struct device *dev; 1000SN/A 1010SN/A struct resource *pci_mem; 1020SN/A struct resource *msix_mem; 1030SN/A 1040SN/A enum ixlv_state_t init_state; 1050SN/A 1060SN/A /* 1070SN/A * Interrupt resources 1080SN/A */ 1090SN/A void *tag; 1100SN/A struct resource *res; /* For the AQ */ 1110SN/A 1120SN/A struct ifmedia media; 1130SN/A struct callout timer; 1140SN/A struct callout aq_task; 1150SN/A int msix; 1160SN/A int if_flags; 1170SN/A 1180SN/A struct mtx mtx; 1190SN/A struct mtx aq_task_mtx; 1200SN/A 1210SN/A u32 qbase; 1220SN/A u32 admvec; 1230SN/A struct timeout_task timeout; 1240SN/A struct task aq_irq; 1250SN/A struct task aq_sched; 1260SN/A struct taskqueue *tq; 1270SN/A 1280SN/A struct ixl_vsi vsi; 1290SN/A 1300SN/A /* Mac Filter List */ 1310SN/A struct mac_list *mac_filters; 1320SN/A 1330SN/A /* Vlan Filter List */ 1340SN/A struct vlan_list *vlan_filters; 1350SN/A 1360SN/A /* Promiscuous mode */ 1370SN/A u32 promiscuous_flags; 1380SN/A 1390SN/A /* Admin queue task flags */ 1400SN/A u32 aq_wait_count; 1410SN/A u32 aq_required; 1420SN/A u32 aq_pending; 1430SN/A 1440SN/A /* Virtual comm channel */ 1450SN/A enum i40e_virtchnl_ops current_op; 1460SN/A struct i40e_virtchnl_vf_resource *vf_res; 1470SN/A struct i40e_virtchnl_vsi_resource *vsi_res; 1480SN/A 1490SN/A /* Misc stats maintained by the driver */ 1500SN/A u64 watchdog_events; 1510SN/A u64 admin_irq; 1520SN/A 1530SN/A /* Signaling channels */ 1540SN/A u8 init_done; 1550SN/A u8 config_queues_done; 1560SN/A u8 map_vectors_done; 1570SN/A u8 enable_queues_done; 1580SN/A u8 disable_queues_done; 1590SN/A u8 add_ether_done; 1600SN/A u8 del_ether_done; 1610SN/A}; 1620SN/A 1630SN/A/* 1640SN/A** This checks for a zero mac addr, something that will be likely 1650SN/A** unless the Admin on the Host has created one. 1660SN/A*/ 1670SN/Astatic inline bool 1680SN/Aixlv_check_ether_addr(u8 *addr) 1690SN/A{ 1700SN/A bool status = TRUE; 1710SN/A 1720SN/A if ((addr[0] == 0 && addr[1]== 0 && addr[2] == 0 && 1730SN/A addr[3] == 0 && addr[4]== 0 && addr[5] == 0)) 1740SN/A status = FALSE; 1750SN/A return (status); 1760SN/A} 1770SN/A 1780SN/A/* 1790SN/A** VF Common function prototypes 1800SN/A*/ 1810SN/Aint ixlv_send_api_ver(struct ixlv_sc *); 1820SN/Aint ixlv_verify_api_ver(struct ixlv_sc *); 1830SN/Aint ixlv_send_vf_config_msg(struct ixlv_sc *); 1840SN/Aint ixlv_get_vf_config(struct ixlv_sc *); 1850SN/Avoid ixlv_init(void *); 1860SN/Aint ixlv_reinit_locked(struct ixlv_sc *); 1870SN/Avoid ixlv_configure_queues(struct ixlv_sc *); 1880SN/Avoid ixlv_enable_queues(struct ixlv_sc *); 1890SN/Avoid ixlv_disable_queues(struct ixlv_sc *); 1900SN/Avoid ixlv_map_queues(struct ixlv_sc *); 1910SN/Avoid ixlv_enable_intr(struct ixl_vsi *); 1920SN/Avoid ixlv_disable_intr(struct ixl_vsi *); 1930SN/Avoid ixlv_add_ether_filters(struct ixlv_sc *); 1940SN/Avoid ixlv_del_ether_filters(struct ixlv_sc *); 1950SN/Avoid ixlv_request_stats(struct ixlv_sc *); 1960SN/Avoid ixlv_request_reset(struct ixlv_sc *); 1970SN/Avoid ixlv_vc_completion(struct ixlv_sc *, 1980SN/A enum i40e_virtchnl_ops, i40e_status, u8 *, u16); 1990SN/Avoid ixlv_add_ether_filter(struct ixlv_sc *); 2000SN/Avoid ixlv_add_vlans(struct ixlv_sc *); 2010SN/Avoid ixlv_del_vlans(struct ixlv_sc *); 2020SN/Avoid ixlv_update_stats_counters(struct ixlv_sc *, 2030SN/A struct i40e_eth_stats *); 2040SN/A 2050SN/A#endif /* _IXLV_H_ */ 2060SN/A