net/qede/base: use default MTU from shared memory
[dpdk.git] / drivers / net / qede / qede_if.h
1 /*
2  * Copyright (c) 2016 QLogic Corporation.
3  * All rights reserved.
4  * www.qlogic.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8
9 #ifndef _QEDE_IF_H
10 #define _QEDE_IF_H
11
12 #include "qede_ethdev.h"
13
14 /* forward */
15 struct ecore_dev;
16 struct qed_sb_info;
17 struct qed_pf_params;
18 enum ecore_int_mode;
19
20 struct qed_dev_info {
21         uint8_t num_hwfns;
22         uint8_t hw_mac[ETHER_ADDR_LEN];
23         bool is_mf_default;
24
25         /* FW version */
26         uint16_t fw_major;
27         uint16_t fw_minor;
28         uint16_t fw_rev;
29         uint16_t fw_eng;
30
31         /* MFW version */
32         uint32_t mfw_rev;
33
34         uint32_t flash_size;
35         uint8_t mf_mode;
36         bool tx_switching;
37         u16 mtu;
38         /* To be added... */
39 };
40
41 enum qed_sb_type {
42         QED_SB_TYPE_L2_QUEUE,
43         QED_SB_TYPE_STORAGE,
44         QED_SB_TYPE_CNQ,
45 };
46
47 enum qed_protocol {
48         QED_PROTOCOL_ETH,
49 };
50
51 struct qed_link_params {
52         bool link_up;
53
54 #define QED_LINK_OVERRIDE_SPEED_AUTONEG         (1 << 0)
55 #define QED_LINK_OVERRIDE_SPEED_ADV_SPEEDS      (1 << 1)
56 #define QED_LINK_OVERRIDE_SPEED_FORCED_SPEED    (1 << 2)
57 #define QED_LINK_OVERRIDE_PAUSE_CONFIG          (1 << 3)
58         uint32_t override_flags;
59         bool autoneg;
60         uint32_t adv_speeds;
61         uint32_t forced_speed;
62 #define QED_LINK_PAUSE_AUTONEG_ENABLE           (1 << 0)
63 #define QED_LINK_PAUSE_RX_ENABLE                (1 << 1)
64 #define QED_LINK_PAUSE_TX_ENABLE                (1 << 2)
65         uint32_t pause_config;
66 };
67
68 struct qed_link_output {
69         bool link_up;
70         uint32_t supported_caps;        /* In SUPPORTED defs */
71         uint32_t advertised_caps;       /* In ADVERTISED defs */
72         uint32_t lp_caps;       /* In ADVERTISED defs */
73         uint32_t speed;         /* In Mb/s */
74         uint32_t adv_speed;     /* Speed mask */
75         uint8_t duplex;         /* In DUPLEX defs */
76         uint8_t port;           /* In PORT defs */
77         bool autoneg;
78         uint32_t pause_config;
79 };
80
81 struct qed_slowpath_params {
82         uint32_t int_mode;
83         uint8_t drv_major;
84         uint8_t drv_minor;
85         uint8_t drv_rev;
86         uint8_t drv_eng;
87         uint8_t name[NAME_SIZE];
88 };
89
90 #define ILT_PAGE_SIZE_TCFC 0x8000       /* 32KB */
91
92 struct qed_common_cb_ops {
93         void (*link_update)(void *dev, struct qed_link_output *link);
94 };
95
96 struct qed_selftest_ops {
97 /**
98  * @brief registers - Perform register tests
99  *
100  * @param edev
101  *
102  * @return 0 on success, error otherwise.
103  */
104         int (*registers)(struct ecore_dev *edev);
105 };
106
107 struct qed_common_ops {
108         int (*probe)(struct ecore_dev *edev,
109                      struct rte_pci_device *pci_dev,
110                      enum qed_protocol protocol,
111                      uint32_t dp_module, uint8_t dp_level, bool is_vf);
112         void (*set_id)(struct ecore_dev *edev,
113                 char name[], const char ver_str[]);
114         enum _ecore_status_t
115                 (*chain_alloc)(struct ecore_dev *edev,
116                                enum ecore_chain_use_mode
117                                intended_use,
118                                enum ecore_chain_mode mode,
119                                enum ecore_chain_cnt_type cnt_type,
120                                uint32_t num_elems,
121                                osal_size_t elem_size,
122                                struct ecore_chain *p_chain,
123                                struct ecore_chain_ext_pbl *ext_pbl);
124
125         void (*chain_free)(struct ecore_dev *edev,
126                            struct ecore_chain *p_chain);
127
128         void (*get_link)(struct ecore_dev *edev,
129                          struct qed_link_output *if_link);
130         int (*set_link)(struct ecore_dev *edev,
131                         struct qed_link_params *params);
132
133         int (*drain)(struct ecore_dev *edev);
134
135         void (*remove)(struct ecore_dev *edev);
136
137         int (*slowpath_stop)(struct ecore_dev *edev);
138
139         void (*update_pf_params)(struct ecore_dev *edev,
140                                  struct ecore_pf_params *params);
141
142         int (*slowpath_start)(struct ecore_dev *edev,
143                               struct qed_slowpath_params *params);
144
145         int (*set_fp_int)(struct ecore_dev *edev, uint16_t cnt);
146
147         uint32_t (*sb_init)(struct ecore_dev *edev,
148                             struct ecore_sb_info *sb_info,
149                             void *sb_virt_addr,
150                             dma_addr_t sb_phy_addr,
151                             uint16_t sb_id, enum qed_sb_type type);
152
153         bool (*can_link_change)(struct ecore_dev *edev);
154
155         void (*update_msglvl)(struct ecore_dev *edev,
156                               uint32_t dp_module, uint8_t dp_level);
157
158         int (*send_drv_state)(struct ecore_dev *edev, bool active);
159 };
160
161 #endif /* _QEDE_IF_H */