1a6a5580cSJeff Kirsher /* 2a6a5580cSJeff Kirsher * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved. 3a6a5580cSJeff Kirsher * Copyright 2007 Nuova Systems, Inc. All rights reserved. 4a6a5580cSJeff Kirsher * 5a6a5580cSJeff Kirsher * This program is free software; you may redistribute it and/or modify 6a6a5580cSJeff Kirsher * it under the terms of the GNU General Public License as published by 7a6a5580cSJeff Kirsher * the Free Software Foundation; version 2 of the License. 8a6a5580cSJeff Kirsher * 9a6a5580cSJeff Kirsher * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 10a6a5580cSJeff Kirsher * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 11a6a5580cSJeff Kirsher * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 12a6a5580cSJeff Kirsher * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 13a6a5580cSJeff Kirsher * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 14a6a5580cSJeff Kirsher * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 15a6a5580cSJeff Kirsher * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 16a6a5580cSJeff Kirsher * SOFTWARE. 17a6a5580cSJeff Kirsher * 18a6a5580cSJeff Kirsher */ 19a6a5580cSJeff Kirsher 20a6a5580cSJeff Kirsher #ifndef _ENIC_H_ 21a6a5580cSJeff Kirsher #define _ENIC_H_ 22a6a5580cSJeff Kirsher 23a6a5580cSJeff Kirsher #include "vnic_enet.h" 24a6a5580cSJeff Kirsher #include "vnic_dev.h" 25a6a5580cSJeff Kirsher #include "vnic_wq.h" 26a6a5580cSJeff Kirsher #include "vnic_rq.h" 27a6a5580cSJeff Kirsher #include "vnic_cq.h" 28a6a5580cSJeff Kirsher #include "vnic_intr.h" 29a6a5580cSJeff Kirsher #include "vnic_stats.h" 30a6a5580cSJeff Kirsher #include "vnic_nic.h" 31a6a5580cSJeff Kirsher #include "vnic_rss.h" 32a6a5580cSJeff Kirsher 33a6a5580cSJeff Kirsher #define DRV_NAME "enic" 34a6a5580cSJeff Kirsher #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" 35a6a5580cSJeff Kirsher #define DRV_VERSION "2.1.1.24" 36a6a5580cSJeff Kirsher #define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc" 37a6a5580cSJeff Kirsher 38a6a5580cSJeff Kirsher #define ENIC_BARS_MAX 6 39a6a5580cSJeff Kirsher 40a6a5580cSJeff Kirsher #define ENIC_WQ_MAX 1 41a6a5580cSJeff Kirsher #define ENIC_RQ_MAX 1 42a6a5580cSJeff Kirsher #define ENIC_CQ_MAX (ENIC_WQ_MAX + ENIC_RQ_MAX) 43a6a5580cSJeff Kirsher #define ENIC_INTR_MAX (ENIC_CQ_MAX + 2) 44a6a5580cSJeff Kirsher 45a6a5580cSJeff Kirsher struct enic_msix_entry { 46a6a5580cSJeff Kirsher int requested; 47a6a5580cSJeff Kirsher char devname[IFNAMSIZ]; 48a6a5580cSJeff Kirsher irqreturn_t (*isr)(int, void *); 49a6a5580cSJeff Kirsher void *devid; 50a6a5580cSJeff Kirsher }; 51a6a5580cSJeff Kirsher 52a6a5580cSJeff Kirsher #define ENIC_PORT_REQUEST_APPLIED (1 << 0) 53a6a5580cSJeff Kirsher #define ENIC_SET_REQUEST (1 << 1) 54a6a5580cSJeff Kirsher #define ENIC_SET_NAME (1 << 2) 55a6a5580cSJeff Kirsher #define ENIC_SET_INSTANCE (1 << 3) 56a6a5580cSJeff Kirsher #define ENIC_SET_HOST (1 << 4) 57a6a5580cSJeff Kirsher 58a6a5580cSJeff Kirsher struct enic_port_profile { 59a6a5580cSJeff Kirsher u32 set; 60a6a5580cSJeff Kirsher u8 request; 61a6a5580cSJeff Kirsher char name[PORT_PROFILE_MAX]; 62a6a5580cSJeff Kirsher u8 instance_uuid[PORT_UUID_MAX]; 63a6a5580cSJeff Kirsher u8 host_uuid[PORT_UUID_MAX]; 64a6a5580cSJeff Kirsher u8 vf_mac[ETH_ALEN]; 65a6a5580cSJeff Kirsher u8 mac_addr[ETH_ALEN]; 66a6a5580cSJeff Kirsher }; 67a6a5580cSJeff Kirsher 68a6a5580cSJeff Kirsher /* Per-instance private data structure */ 69a6a5580cSJeff Kirsher struct enic { 70a6a5580cSJeff Kirsher struct net_device *netdev; 71a6a5580cSJeff Kirsher struct pci_dev *pdev; 72a6a5580cSJeff Kirsher struct vnic_enet_config config; 73a6a5580cSJeff Kirsher struct vnic_dev_bar bar[ENIC_BARS_MAX]; 74a6a5580cSJeff Kirsher struct vnic_dev *vdev; 75a6a5580cSJeff Kirsher struct timer_list notify_timer; 76a6a5580cSJeff Kirsher struct work_struct reset; 77a6a5580cSJeff Kirsher struct work_struct change_mtu_work; 78a6a5580cSJeff Kirsher struct msix_entry msix_entry[ENIC_INTR_MAX]; 79a6a5580cSJeff Kirsher struct enic_msix_entry msix[ENIC_INTR_MAX]; 80a6a5580cSJeff Kirsher u32 msg_enable; 81a6a5580cSJeff Kirsher spinlock_t devcmd_lock; 82a6a5580cSJeff Kirsher u8 mac_addr[ETH_ALEN]; 83a6a5580cSJeff Kirsher u8 mc_addr[ENIC_MULTICAST_PERFECT_FILTERS][ETH_ALEN]; 84a6a5580cSJeff Kirsher u8 uc_addr[ENIC_UNICAST_PERFECT_FILTERS][ETH_ALEN]; 85a6a5580cSJeff Kirsher unsigned int flags; 86a6a5580cSJeff Kirsher unsigned int mc_count; 87a6a5580cSJeff Kirsher unsigned int uc_count; 88a6a5580cSJeff Kirsher u32 port_mtu; 89a6a5580cSJeff Kirsher u32 rx_coalesce_usecs; 90a6a5580cSJeff Kirsher u32 tx_coalesce_usecs; 91a6a5580cSJeff Kirsher struct enic_port_profile pp; 92a6a5580cSJeff Kirsher 93a6a5580cSJeff Kirsher /* work queue cache line section */ 94a6a5580cSJeff Kirsher ____cacheline_aligned struct vnic_wq wq[ENIC_WQ_MAX]; 95a6a5580cSJeff Kirsher spinlock_t wq_lock[ENIC_WQ_MAX]; 96a6a5580cSJeff Kirsher unsigned int wq_count; 97a6a5580cSJeff Kirsher u16 loop_enable; 98a6a5580cSJeff Kirsher u16 loop_tag; 99a6a5580cSJeff Kirsher 100a6a5580cSJeff Kirsher /* receive queue cache line section */ 101a6a5580cSJeff Kirsher ____cacheline_aligned struct vnic_rq rq[ENIC_RQ_MAX]; 102a6a5580cSJeff Kirsher unsigned int rq_count; 103a6a5580cSJeff Kirsher u64 rq_truncated_pkts; 104a6a5580cSJeff Kirsher u64 rq_bad_fcs; 105a6a5580cSJeff Kirsher struct napi_struct napi[ENIC_RQ_MAX]; 106a6a5580cSJeff Kirsher 107a6a5580cSJeff Kirsher /* interrupt resource cache line section */ 108a6a5580cSJeff Kirsher ____cacheline_aligned struct vnic_intr intr[ENIC_INTR_MAX]; 109a6a5580cSJeff Kirsher unsigned int intr_count; 110a6a5580cSJeff Kirsher u32 __iomem *legacy_pba; /* memory-mapped */ 111a6a5580cSJeff Kirsher 112a6a5580cSJeff Kirsher /* completion queue cache line section */ 113a6a5580cSJeff Kirsher ____cacheline_aligned struct vnic_cq cq[ENIC_CQ_MAX]; 114a6a5580cSJeff Kirsher unsigned int cq_count; 115a6a5580cSJeff Kirsher }; 116a6a5580cSJeff Kirsher 117a6a5580cSJeff Kirsher static inline struct device *enic_get_dev(struct enic *enic) 118a6a5580cSJeff Kirsher { 119a6a5580cSJeff Kirsher return &(enic->pdev->dev); 120a6a5580cSJeff Kirsher } 121a6a5580cSJeff Kirsher 122a6a5580cSJeff Kirsher void enic_reset_addr_lists(struct enic *enic); 123a6a5580cSJeff Kirsher 124a6a5580cSJeff Kirsher #endif /* _ENIC_H_ */ 125