2008-09-15 16:17:11 +00:00
|
|
|
/*
|
2010-06-24 10:52:26 +00:00
|
|
|
* Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
|
2008-09-15 16:17:11 +00:00
|
|
|
* Copyright 2007 Nuova Systems, Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you may redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _VNIC_DEV_H_
|
|
|
|
#define _VNIC_DEV_H_
|
|
|
|
|
|
|
|
#include "vnic_resource.h"
|
|
|
|
#include "vnic_devcmd.h"
|
|
|
|
|
|
|
|
#ifndef VNIC_PADDR_TARGET
|
|
|
|
#define VNIC_PADDR_TARGET 0x0000000000000000ULL
|
|
|
|
#endif
|
|
|
|
|
2008-10-10 05:13:53 +00:00
|
|
|
#ifndef readq
|
|
|
|
static inline u64 readq(void __iomem *reg)
|
|
|
|
{
|
|
|
|
return (((u64)readl(reg + 0x4UL) << 32) |
|
|
|
|
(u64)readl(reg));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void writeq(u64 val, void __iomem *reg)
|
|
|
|
{
|
|
|
|
writel(val & 0xffffffff, reg);
|
|
|
|
writel(val >> 32, reg + 0x4UL);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-06-24 10:50:56 +00:00
|
|
|
#undef pr_fmt
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
2008-09-15 16:17:11 +00:00
|
|
|
enum vnic_dev_intr_mode {
|
|
|
|
VNIC_DEV_INTR_MODE_UNKNOWN,
|
|
|
|
VNIC_DEV_INTR_MODE_INTX,
|
|
|
|
VNIC_DEV_INTR_MODE_MSI,
|
|
|
|
VNIC_DEV_INTR_MODE_MSIX,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vnic_dev_bar {
|
|
|
|
void __iomem *vaddr;
|
|
|
|
dma_addr_t bus_addr;
|
|
|
|
unsigned long len;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vnic_dev_ring {
|
|
|
|
void *descs;
|
|
|
|
size_t size;
|
|
|
|
dma_addr_t base_addr;
|
|
|
|
size_t base_align;
|
|
|
|
void *descs_unaligned;
|
|
|
|
size_t size_unaligned;
|
|
|
|
dma_addr_t base_addr_unaligned;
|
|
|
|
unsigned int desc_size;
|
|
|
|
unsigned int desc_count;
|
|
|
|
unsigned int desc_avail;
|
|
|
|
};
|
|
|
|
|
2015-08-15 20:14:51 +00:00
|
|
|
enum vnic_proxy_type {
|
|
|
|
PROXY_NONE,
|
|
|
|
PROXY_BY_BDF,
|
|
|
|
PROXY_BY_INDEX,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vnic_res {
|
|
|
|
void __iomem *vaddr;
|
|
|
|
dma_addr_t bus_addr;
|
|
|
|
unsigned int count;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vnic_intr_coal_timer_info {
|
|
|
|
u32 mul;
|
|
|
|
u32 div;
|
|
|
|
u32 max_usec;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vnic_dev {
|
|
|
|
void *priv;
|
|
|
|
struct pci_dev *pdev;
|
|
|
|
struct vnic_res res[RES_TYPE_MAX];
|
|
|
|
enum vnic_dev_intr_mode intr_mode;
|
|
|
|
struct vnic_devcmd __iomem *devcmd;
|
|
|
|
struct vnic_devcmd_notify *notify;
|
|
|
|
struct vnic_devcmd_notify notify_copy;
|
|
|
|
dma_addr_t notify_pa;
|
|
|
|
u32 notify_sz;
|
|
|
|
dma_addr_t linkstatus_pa;
|
|
|
|
struct vnic_stats *stats;
|
|
|
|
dma_addr_t stats_pa;
|
|
|
|
struct vnic_devcmd_fw_info *fw_info;
|
|
|
|
dma_addr_t fw_info_pa;
|
|
|
|
enum vnic_proxy_type proxy;
|
|
|
|
u32 proxy_index;
|
|
|
|
u64 args[VNIC_DEVCMD_NARGS];
|
|
|
|
struct vnic_intr_coal_timer_info intr_coal_timer_info;
|
2015-08-15 20:14:53 +00:00
|
|
|
struct devcmd2_controller *devcmd2;
|
2015-08-15 20:14:54 +00:00
|
|
|
int (*devcmd_rtn)(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
|
|
|
|
int wait);
|
2015-08-15 20:14:51 +00:00
|
|
|
};
|
|
|
|
|
2008-09-15 16:17:11 +00:00
|
|
|
struct vnic_stats;
|
|
|
|
|
|
|
|
void *vnic_dev_priv(struct vnic_dev *vdev);
|
|
|
|
unsigned int vnic_dev_get_res_count(struct vnic_dev *vdev,
|
|
|
|
enum vnic_res_type type);
|
|
|
|
void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type,
|
|
|
|
unsigned int index);
|
|
|
|
void vnic_dev_clear_desc_ring(struct vnic_dev_ring *ring);
|
|
|
|
int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring,
|
|
|
|
unsigned int desc_count, unsigned int desc_size);
|
|
|
|
void vnic_dev_free_desc_ring(struct vnic_dev *vdev,
|
|
|
|
struct vnic_dev_ring *ring);
|
|
|
|
int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
|
|
|
|
u64 *a0, u64 *a1, int wait);
|
2011-09-22 03:44:38 +00:00
|
|
|
void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, u16 index);
|
|
|
|
void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev);
|
2008-09-15 16:17:11 +00:00
|
|
|
int vnic_dev_fw_info(struct vnic_dev *vdev,
|
|
|
|
struct vnic_devcmd_fw_info **fw_info);
|
|
|
|
int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size,
|
|
|
|
void *value);
|
|
|
|
int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats);
|
|
|
|
int vnic_dev_hang_notify(struct vnic_dev *vdev);
|
2010-06-24 10:50:12 +00:00
|
|
|
int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
|
2008-09-15 16:17:11 +00:00
|
|
|
int broadcast, int promisc, int allmulti);
|
2014-05-29 01:44:52 +00:00
|
|
|
int vnic_dev_add_addr(struct vnic_dev *vdev, const u8 *addr);
|
|
|
|
int vnic_dev_del_addr(struct vnic_dev *vdev, const u8 *addr);
|
2012-02-20 00:11:48 +00:00
|
|
|
int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr);
|
2008-09-15 16:17:11 +00:00
|
|
|
int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr);
|
2010-06-24 10:50:12 +00:00
|
|
|
int vnic_dev_notify_unset(struct vnic_dev *vdev);
|
2008-09-15 16:17:11 +00:00
|
|
|
int vnic_dev_link_status(struct vnic_dev *vdev);
|
|
|
|
u32 vnic_dev_port_speed(struct vnic_dev *vdev);
|
|
|
|
u32 vnic_dev_msg_lvl(struct vnic_dev *vdev);
|
|
|
|
u32 vnic_dev_mtu(struct vnic_dev *vdev);
|
|
|
|
int vnic_dev_close(struct vnic_dev *vdev);
|
2010-10-20 10:17:09 +00:00
|
|
|
int vnic_dev_enable_wait(struct vnic_dev *vdev);
|
2008-09-15 16:17:11 +00:00
|
|
|
int vnic_dev_disable(struct vnic_dev *vdev);
|
|
|
|
int vnic_dev_open(struct vnic_dev *vdev, int arg);
|
|
|
|
int vnic_dev_open_done(struct vnic_dev *vdev, int *done);
|
|
|
|
int vnic_dev_init(struct vnic_dev *vdev, int arg);
|
2010-05-18 05:50:19 +00:00
|
|
|
int vnic_dev_deinit(struct vnic_dev *vdev);
|
2011-06-17 07:56:48 +00:00
|
|
|
void vnic_dev_intr_coal_timer_info_default(struct vnic_dev *vdev);
|
|
|
|
int vnic_dev_intr_coal_timer_info(struct vnic_dev *vdev);
|
2010-06-24 10:50:00 +00:00
|
|
|
int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg);
|
2015-10-01 08:48:47 +00:00
|
|
|
int vnic_dev_soft_reset(struct vnic_dev *vdev, int arg);
|
2010-06-24 10:50:00 +00:00
|
|
|
int vnic_dev_hang_reset_done(struct vnic_dev *vdev, int *done);
|
2015-10-01 08:48:47 +00:00
|
|
|
int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done);
|
2008-09-15 16:17:11 +00:00
|
|
|
void vnic_dev_set_intr_mode(struct vnic_dev *vdev,
|
|
|
|
enum vnic_dev_intr_mode intr_mode);
|
|
|
|
enum vnic_dev_intr_mode vnic_dev_get_intr_mode(struct vnic_dev *vdev);
|
2011-06-17 07:56:48 +00:00
|
|
|
u32 vnic_dev_intr_coal_timer_usec_to_hw(struct vnic_dev *vdev, u32 usec);
|
|
|
|
u32 vnic_dev_intr_coal_timer_hw_to_usec(struct vnic_dev *vdev, u32 hw_cycles);
|
|
|
|
u32 vnic_dev_get_intr_coal_timer_max(struct vnic_dev *vdev);
|
2008-09-15 16:17:11 +00:00
|
|
|
void vnic_dev_unregister(struct vnic_dev *vdev);
|
2010-06-24 10:49:51 +00:00
|
|
|
int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev,
|
|
|
|
u8 ig_vlan_rewrite_mode);
|
2008-09-15 16:17:11 +00:00
|
|
|
struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
|
2009-09-03 17:01:53 +00:00
|
|
|
void *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar,
|
|
|
|
unsigned int num_bars);
|
2013-09-04 05:47:17 +00:00
|
|
|
struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev);
|
2011-03-29 20:35:51 +00:00
|
|
|
int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len);
|
|
|
|
int vnic_dev_enable2(struct vnic_dev *vdev, int active);
|
|
|
|
int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status);
|
|
|
|
int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status);
|
2012-02-20 00:11:53 +00:00
|
|
|
int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr);
|
2014-06-23 10:38:00 +00:00
|
|
|
int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry,
|
|
|
|
struct filter *data);
|
2015-08-15 20:14:54 +00:00
|
|
|
int vnic_devcmd_init(struct vnic_dev *vdev);
|
2017-02-09 00:43:07 +00:00
|
|
|
int vnic_dev_overlay_offload_ctrl(struct vnic_dev *vdev, u8 overlay, u8 config);
|
|
|
|
int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay,
|
|
|
|
u16 vxlan_udp_port_number);
|
|
|
|
int vnic_dev_get_supported_feature_ver(struct vnic_dev *vdev, u8 feature,
|
2018-03-01 19:07:20 +00:00
|
|
|
u64 *supported_versions, u64 *a1);
|
2018-06-05 17:14:57 +00:00
|
|
|
int vnic_dev_capable_rss_hash_type(struct vnic_dev *vdev, u8 *rss_hash_type);
|
2008-09-15 16:17:11 +00:00
|
|
|
|
|
|
|
#endif /* _VNIC_DEV_H_ */
|