| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Huawei HiNIC PCI Express Linux driver |
|---|
| 3 | 4 | * Copyright(c) 2017 Huawei Technologies Co., Ltd |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 7 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|---|
| 12 | | - * for more details. |
|---|
| 13 | | - * |
|---|
| 14 | 5 | */ |
|---|
| 15 | 6 | |
|---|
| 16 | 7 | #ifndef HINIC_HW_IO_H |
|---|
| .. | .. |
|---|
| 29 | 20 | |
|---|
| 30 | 21 | #define HINIC_DB_PAGE_SIZE SZ_4K |
|---|
| 31 | 22 | #define HINIC_DB_SIZE SZ_4M |
|---|
| 23 | +#define HINIC_HW_WQ_PAGE_SIZE SZ_4K |
|---|
| 24 | +#define HINIC_DEFAULT_WQ_PAGE_SIZE SZ_256K |
|---|
| 32 | 25 | |
|---|
| 33 | 26 | #define HINIC_DB_MAX_AREAS (HINIC_DB_SIZE / HINIC_DB_PAGE_SIZE) |
|---|
| 34 | 27 | |
|---|
| .. | .. |
|---|
| 54 | 47 | struct semaphore idx_lock; |
|---|
| 55 | 48 | }; |
|---|
| 56 | 49 | |
|---|
| 50 | +struct hinic_nic_cfg { |
|---|
| 51 | + /* lock for getting nic cfg */ |
|---|
| 52 | + struct mutex cfg_mutex; |
|---|
| 53 | + bool pause_set; |
|---|
| 54 | + u32 auto_neg; |
|---|
| 55 | + u32 rx_pause; |
|---|
| 56 | + u32 tx_pause; |
|---|
| 57 | +}; |
|---|
| 58 | + |
|---|
| 57 | 59 | struct hinic_func_to_io { |
|---|
| 58 | 60 | struct hinic_hwif *hwif; |
|---|
| 59 | | - |
|---|
| 61 | + struct hinic_hwdev *hwdev; |
|---|
| 62 | + u16 global_qpn; |
|---|
| 60 | 63 | struct hinic_ceqs ceqs; |
|---|
| 61 | 64 | |
|---|
| 62 | 65 | struct hinic_wqs wqs; |
|---|
| .. | .. |
|---|
| 66 | 69 | |
|---|
| 67 | 70 | struct hinic_qp *qps; |
|---|
| 68 | 71 | u16 max_qps; |
|---|
| 72 | + |
|---|
| 73 | + u16 sq_depth; |
|---|
| 74 | + u16 rq_depth; |
|---|
| 69 | 75 | |
|---|
| 70 | 76 | void __iomem **sq_db; |
|---|
| 71 | 77 | void __iomem *db_base; |
|---|
| .. | .. |
|---|
| 78 | 84 | void __iomem *cmdq_db_area[HINIC_MAX_CMDQ_TYPES]; |
|---|
| 79 | 85 | |
|---|
| 80 | 86 | struct hinic_cmdqs cmdqs; |
|---|
| 87 | + |
|---|
| 88 | + u16 max_vfs; |
|---|
| 89 | + struct vf_data_storage *vf_infos; |
|---|
| 90 | + u8 link_status; |
|---|
| 91 | + struct hinic_nic_cfg nic_cfg; |
|---|
| 81 | 92 | }; |
|---|
| 82 | 93 | |
|---|
| 94 | +struct hinic_wq_page_size { |
|---|
| 95 | + u8 status; |
|---|
| 96 | + u8 version; |
|---|
| 97 | + u8 rsvd0[6]; |
|---|
| 98 | + |
|---|
| 99 | + u16 func_idx; |
|---|
| 100 | + u8 ppf_idx; |
|---|
| 101 | + u8 page_size; |
|---|
| 102 | + |
|---|
| 103 | + u32 rsvd1; |
|---|
| 104 | +}; |
|---|
| 105 | + |
|---|
| 106 | +int hinic_set_wq_page_size(struct hinic_hwdev *hwdev, u16 func_idx, |
|---|
| 107 | + u32 page_size); |
|---|
| 108 | + |
|---|
| 83 | 109 | int hinic_io_create_qps(struct hinic_func_to_io *func_to_io, |
|---|
| 84 | 110 | u16 base_qpn, int num_qps, |
|---|
| 85 | 111 | struct msix_entry *sq_msix_entries, |
|---|