Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 1 | /* |
Vasanthy Kolluri | 29046f9 | 2010-06-24 10:52:26 +0000 | [diff] [blame] | 2 | * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved. |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 3 | * Copyright 2007 Nuova Systems, Inc. All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you may redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; version 2 of the License. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 10 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 11 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 12 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 13 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 14 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 15 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 16 | * SOFTWARE. |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | #ifndef _VNIC_DEV_H_ |
| 21 | #define _VNIC_DEV_H_ |
| 22 | |
| 23 | #include "vnic_resource.h" |
| 24 | #include "vnic_devcmd.h" |
| 25 | |
| 26 | #ifndef VNIC_PADDR_TARGET |
| 27 | #define VNIC_PADDR_TARGET 0x0000000000000000ULL |
| 28 | #endif |
| 29 | |
David S. Miller | 55ed31e | 2008-10-09 22:13:53 -0700 | [diff] [blame] | 30 | #ifndef readq |
| 31 | static inline u64 readq(void __iomem *reg) |
| 32 | { |
| 33 | return (((u64)readl(reg + 0x4UL) << 32) | |
| 34 | (u64)readl(reg)); |
| 35 | } |
| 36 | |
| 37 | static inline void writeq(u64 val, void __iomem *reg) |
| 38 | { |
| 39 | writel(val & 0xffffffff, reg); |
| 40 | writel(val >> 32, reg + 0x4UL); |
| 41 | } |
| 42 | #endif |
| 43 | |
Vasanthy Kolluri | a7a79de | 2010-06-24 10:50:56 +0000 | [diff] [blame] | 44 | #undef pr_fmt |
| 45 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 46 | |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 47 | enum vnic_dev_intr_mode { |
| 48 | VNIC_DEV_INTR_MODE_UNKNOWN, |
| 49 | VNIC_DEV_INTR_MODE_INTX, |
| 50 | VNIC_DEV_INTR_MODE_MSI, |
| 51 | VNIC_DEV_INTR_MODE_MSIX, |
| 52 | }; |
| 53 | |
| 54 | struct vnic_dev_bar { |
| 55 | void __iomem *vaddr; |
| 56 | dma_addr_t bus_addr; |
| 57 | unsigned long len; |
| 58 | }; |
| 59 | |
| 60 | struct vnic_dev_ring { |
| 61 | void *descs; |
| 62 | size_t size; |
| 63 | dma_addr_t base_addr; |
| 64 | size_t base_align; |
| 65 | void *descs_unaligned; |
| 66 | size_t size_unaligned; |
| 67 | dma_addr_t base_addr_unaligned; |
| 68 | unsigned int desc_size; |
| 69 | unsigned int desc_count; |
| 70 | unsigned int desc_avail; |
| 71 | }; |
| 72 | |
| 73 | struct vnic_dev; |
| 74 | struct vnic_stats; |
| 75 | |
| 76 | void *vnic_dev_priv(struct vnic_dev *vdev); |
| 77 | unsigned int vnic_dev_get_res_count(struct vnic_dev *vdev, |
| 78 | enum vnic_res_type type); |
| 79 | void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type, |
| 80 | unsigned int index); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 81 | void vnic_dev_clear_desc_ring(struct vnic_dev_ring *ring); |
| 82 | int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, |
| 83 | unsigned int desc_count, unsigned int desc_size); |
| 84 | void vnic_dev_free_desc_ring(struct vnic_dev *vdev, |
| 85 | struct vnic_dev_ring *ring); |
| 86 | int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, |
| 87 | u64 *a0, u64 *a1, int wait); |
Roopa Prabhu | 889d13f | 2011-09-22 03:44:38 +0000 | [diff] [blame] | 88 | void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, u16 index); |
| 89 | void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 90 | int vnic_dev_fw_info(struct vnic_dev *vdev, |
| 91 | struct vnic_devcmd_fw_info **fw_info); |
| 92 | int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, |
| 93 | void *value); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 94 | int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats); |
| 95 | int vnic_dev_hang_notify(struct vnic_dev *vdev); |
Vasanthy Kolluri | 383ab92 | 2010-06-24 10:50:12 +0000 | [diff] [blame] | 96 | int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 97 | int broadcast, int promisc, int allmulti); |
Alexander Duyck | f009618 | 2014-05-28 18:44:52 -0700 | [diff] [blame] | 98 | int vnic_dev_add_addr(struct vnic_dev *vdev, const u8 *addr); |
| 99 | int vnic_dev_del_addr(struct vnic_dev *vdev, const u8 *addr); |
Roopa Prabhu | b13423e | 2012-02-20 00:11:48 +0000 | [diff] [blame] | 100 | int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 101 | int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr); |
Vasanthy Kolluri | 383ab92 | 2010-06-24 10:50:12 +0000 | [diff] [blame] | 102 | int vnic_dev_notify_unset(struct vnic_dev *vdev); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 103 | int vnic_dev_link_status(struct vnic_dev *vdev); |
| 104 | u32 vnic_dev_port_speed(struct vnic_dev *vdev); |
| 105 | u32 vnic_dev_msg_lvl(struct vnic_dev *vdev); |
| 106 | u32 vnic_dev_mtu(struct vnic_dev *vdev); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 107 | int vnic_dev_close(struct vnic_dev *vdev); |
Vasanthy Kolluri | 2db77e0 | 2010-10-20 10:17:09 +0000 | [diff] [blame] | 108 | int vnic_dev_enable_wait(struct vnic_dev *vdev); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 109 | int vnic_dev_disable(struct vnic_dev *vdev); |
| 110 | int vnic_dev_open(struct vnic_dev *vdev, int arg); |
| 111 | int vnic_dev_open_done(struct vnic_dev *vdev, int *done); |
| 112 | int vnic_dev_init(struct vnic_dev *vdev, int arg); |
Scott Feldman | f8bd909 | 2010-05-17 22:50:19 -0700 | [diff] [blame] | 113 | int vnic_dev_deinit(struct vnic_dev *vdev); |
Vasanthy Kolluri | ea7ea65 | 2011-06-17 07:56:48 +0000 | [diff] [blame] | 114 | void vnic_dev_intr_coal_timer_info_default(struct vnic_dev *vdev); |
| 115 | int vnic_dev_intr_coal_timer_info(struct vnic_dev *vdev); |
Vasanthy Kolluri | 99ef563 | 2010-06-24 10:50:00 +0000 | [diff] [blame] | 116 | int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg); |
| 117 | int vnic_dev_hang_reset_done(struct vnic_dev *vdev, int *done); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 118 | void vnic_dev_set_intr_mode(struct vnic_dev *vdev, |
| 119 | enum vnic_dev_intr_mode intr_mode); |
| 120 | enum vnic_dev_intr_mode vnic_dev_get_intr_mode(struct vnic_dev *vdev); |
Vasanthy Kolluri | ea7ea65 | 2011-06-17 07:56:48 +0000 | [diff] [blame] | 121 | u32 vnic_dev_intr_coal_timer_usec_to_hw(struct vnic_dev *vdev, u32 usec); |
| 122 | u32 vnic_dev_intr_coal_timer_hw_to_usec(struct vnic_dev *vdev, u32 hw_cycles); |
| 123 | u32 vnic_dev_get_intr_coal_timer_max(struct vnic_dev *vdev); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 124 | void vnic_dev_unregister(struct vnic_dev *vdev); |
Vasanthy Kolluri | f8cac14 | 2010-06-24 10:49:51 +0000 | [diff] [blame] | 125 | int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev, |
| 126 | u8 ig_vlan_rewrite_mode); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 127 | struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev, |
Scott Feldman | 27e6c7d | 2009-09-03 17:01:53 +0000 | [diff] [blame] | 128 | void *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar, |
| 129 | unsigned int num_bars); |
govindarajulu.v | 4a50ddf | 2013-09-04 11:17:17 +0530 | [diff] [blame] | 130 | struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev); |
Roopa Prabhu | 9085fd0 | 2011-03-29 20:35:51 +0000 | [diff] [blame] | 131 | int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len); |
| 132 | int vnic_dev_enable2(struct vnic_dev *vdev, int active); |
| 133 | int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status); |
| 134 | int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status); |
Roopa Prabhu | d6c81bc | 2012-02-20 00:11:53 +0000 | [diff] [blame] | 135 | int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr); |
Govindarajulu Varadarajan | 6311852 | 2014-06-23 16:08:00 +0530 | [diff] [blame] | 136 | int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry, |
| 137 | struct filter *data); |
Scott Feldman | 01f2e4e | 2008-09-15 09:17:11 -0700 | [diff] [blame] | 138 | |
| 139 | #endif /* _VNIC_DEV_H_ */ |