qed_vf.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
  1. /* QLogic qed NIC Driver
  2. * Copyright (c) 2015-2017 QLogic Corporation
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and /or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef _QED_VF_H
  33. #define _QED_VF_H
  34. #include "qed_l2.h"
  35. #include "qed_mcp.h"
  36. #define T_ETH_INDIRECTION_TABLE_SIZE 128
  37. #define T_ETH_RSS_KEY_SIZE 10
  38. struct vf_pf_resc_request {
  39. u8 num_rxqs;
  40. u8 num_txqs;
  41. u8 num_sbs;
  42. u8 num_mac_filters;
  43. u8 num_vlan_filters;
  44. u8 num_mc_filters;
  45. u8 num_cids;
  46. u8 padding;
  47. };
  48. struct hw_sb_info {
  49. u16 hw_sb_id;
  50. u8 sb_qid;
  51. u8 padding[5];
  52. };
  53. #define TLV_BUFFER_SIZE 1024
  54. enum {
  55. PFVF_STATUS_WAITING,
  56. PFVF_STATUS_SUCCESS,
  57. PFVF_STATUS_FAILURE,
  58. PFVF_STATUS_NOT_SUPPORTED,
  59. PFVF_STATUS_NO_RESOURCE,
  60. PFVF_STATUS_FORCED,
  61. PFVF_STATUS_MALICIOUS,
  62. };
  63. /* vf pf channel tlvs */
  64. /* general tlv header (used for both vf->pf request and pf->vf response) */
  65. struct channel_tlv {
  66. u16 type;
  67. u16 length;
  68. };
  69. /* header of first vf->pf tlv carries the offset used to calculate reponse
  70. * buffer address
  71. */
  72. struct vfpf_first_tlv {
  73. struct channel_tlv tl;
  74. u32 padding;
  75. u64 reply_address;
  76. };
  77. /* header of pf->vf tlvs, carries the status of handling the request */
  78. struct pfvf_tlv {
  79. struct channel_tlv tl;
  80. u8 status;
  81. u8 padding[3];
  82. };
  83. /* response tlv used for most tlvs */
  84. struct pfvf_def_resp_tlv {
  85. struct pfvf_tlv hdr;
  86. };
  87. /* used to terminate and pad a tlv list */
  88. struct channel_list_end_tlv {
  89. struct channel_tlv tl;
  90. u8 padding[4];
  91. };
  92. #define VFPF_ACQUIRE_OS_LINUX (0)
  93. #define VFPF_ACQUIRE_OS_WINDOWS (1)
  94. #define VFPF_ACQUIRE_OS_ESX (2)
  95. #define VFPF_ACQUIRE_OS_SOLARIS (3)
  96. #define VFPF_ACQUIRE_OS_LINUX_USERSPACE (4)
  97. struct vfpf_acquire_tlv {
  98. struct vfpf_first_tlv first_tlv;
  99. struct vf_pf_vfdev_info {
  100. #define VFPF_ACQUIRE_CAP_PRE_FP_HSI (1 << 0) /* VF pre-FP hsi version */
  101. #define VFPF_ACQUIRE_CAP_100G (1 << 1) /* VF can support 100g */
  102. /* A requirement for supporting multi-Tx queues on a single queue-zone,
  103. * VF would pass qids as additional information whenever passing queue
  104. * references.
  105. */
  106. #define VFPF_ACQUIRE_CAP_QUEUE_QIDS BIT(2)
  107. /* The VF is using the physical bar. While this is mostly internal
  108. * to the VF, might affect the number of CIDs supported assuming
  109. * QUEUE_QIDS is set.
  110. */
  111. #define VFPF_ACQUIRE_CAP_PHYSICAL_BAR BIT(3)
  112. u64 capabilities;
  113. u8 fw_major;
  114. u8 fw_minor;
  115. u8 fw_revision;
  116. u8 fw_engineering;
  117. u32 driver_version;
  118. u16 opaque_fid; /* ME register value */
  119. u8 os_type; /* VFPF_ACQUIRE_OS_* value */
  120. u8 eth_fp_hsi_major;
  121. u8 eth_fp_hsi_minor;
  122. u8 padding[3];
  123. } vfdev_info;
  124. struct vf_pf_resc_request resc_request;
  125. u64 bulletin_addr;
  126. u32 bulletin_size;
  127. u32 padding;
  128. };
  129. /* receive side scaling tlv */
  130. struct vfpf_vport_update_rss_tlv {
  131. struct channel_tlv tl;
  132. u8 update_rss_flags;
  133. #define VFPF_UPDATE_RSS_CONFIG_FLAG BIT(0)
  134. #define VFPF_UPDATE_RSS_CAPS_FLAG BIT(1)
  135. #define VFPF_UPDATE_RSS_IND_TABLE_FLAG BIT(2)
  136. #define VFPF_UPDATE_RSS_KEY_FLAG BIT(3)
  137. u8 rss_enable;
  138. u8 rss_caps;
  139. u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
  140. u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
  141. u32 rss_key[T_ETH_RSS_KEY_SIZE];
  142. };
  143. struct pfvf_storm_stats {
  144. u32 address;
  145. u32 len;
  146. };
  147. struct pfvf_stats_info {
  148. struct pfvf_storm_stats mstats;
  149. struct pfvf_storm_stats pstats;
  150. struct pfvf_storm_stats tstats;
  151. struct pfvf_storm_stats ustats;
  152. };
  153. struct pfvf_acquire_resp_tlv {
  154. struct pfvf_tlv hdr;
  155. struct pf_vf_pfdev_info {
  156. u32 chip_num;
  157. u32 mfw_ver;
  158. u16 fw_major;
  159. u16 fw_minor;
  160. u16 fw_rev;
  161. u16 fw_eng;
  162. u64 capabilities;
  163. #define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED BIT(0)
  164. #define PFVF_ACQUIRE_CAP_100G BIT(1) /* If set, 100g PF */
  165. /* There are old PF versions where the PF might mistakenly override the sanity
  166. * mechanism [version-based] and allow a VF that can't be supported to pass
  167. * the acquisition phase.
  168. * To overcome this, PFs now indicate that they're past that point and the new
  169. * VFs would fail probe on the older PFs that fail to do so.
  170. */
  171. #define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE BIT(2)
  172. /* PF expects queues to be received with additional qids */
  173. #define PFVF_ACQUIRE_CAP_QUEUE_QIDS BIT(3)
  174. u16 db_size;
  175. u8 indices_per_sb;
  176. u8 os_type;
  177. /* These should match the PF's qed_dev values */
  178. u16 chip_rev;
  179. u8 dev_type;
  180. /* Doorbell bar size configured in HW: log(size) or 0 */
  181. u8 bar_size;
  182. struct pfvf_stats_info stats_info;
  183. u8 port_mac[ETH_ALEN];
  184. /* It's possible PF had to configure an older fastpath HSI
  185. * [in case VF is newer than PF]. This is communicated back
  186. * to the VF. It can also be used in case of error due to
  187. * non-matching versions to shed light in VF about failure.
  188. */
  189. u8 major_fp_hsi;
  190. u8 minor_fp_hsi;
  191. } pfdev_info;
  192. struct pf_vf_resc {
  193. #define PFVF_MAX_QUEUES_PER_VF 16
  194. #define PFVF_MAX_SBS_PER_VF 16
  195. struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
  196. u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
  197. u8 cid[PFVF_MAX_QUEUES_PER_VF];
  198. u8 num_rxqs;
  199. u8 num_txqs;
  200. u8 num_sbs;
  201. u8 num_mac_filters;
  202. u8 num_vlan_filters;
  203. u8 num_mc_filters;
  204. u8 num_cids;
  205. u8 padding;
  206. } resc;
  207. u32 bulletin_size;
  208. u32 padding;
  209. };
  210. struct pfvf_start_queue_resp_tlv {
  211. struct pfvf_tlv hdr;
  212. u32 offset; /* offset to consumer/producer of queue */
  213. u8 padding[4];
  214. };
  215. /* Extended queue information - additional index for reference inside qzone.
  216. * If commmunicated between VF/PF, each TLV relating to queues should be
  217. * extended by one such [or have a future base TLV that already contains info].
  218. */
  219. struct vfpf_qid_tlv {
  220. struct channel_tlv tl;
  221. u8 qid;
  222. u8 padding[3];
  223. };
  224. /* Setup Queue */
  225. struct vfpf_start_rxq_tlv {
  226. struct vfpf_first_tlv first_tlv;
  227. /* physical addresses */
  228. u64 rxq_addr;
  229. u64 deprecated_sge_addr;
  230. u64 cqe_pbl_addr;
  231. u16 cqe_pbl_size;
  232. u16 hw_sb;
  233. u16 rx_qid;
  234. u16 hc_rate; /* desired interrupts per sec. */
  235. u16 bd_max_bytes;
  236. u16 stat_id;
  237. u8 sb_index;
  238. u8 padding[3];
  239. };
  240. struct vfpf_start_txq_tlv {
  241. struct vfpf_first_tlv first_tlv;
  242. /* physical addresses */
  243. u64 pbl_addr;
  244. u16 pbl_size;
  245. u16 stat_id;
  246. u16 tx_qid;
  247. u16 hw_sb;
  248. u32 flags; /* VFPF_QUEUE_FLG_X flags */
  249. u16 hc_rate; /* desired interrupts per sec. */
  250. u8 sb_index;
  251. u8 padding[3];
  252. };
  253. /* Stop RX Queue */
  254. struct vfpf_stop_rxqs_tlv {
  255. struct vfpf_first_tlv first_tlv;
  256. u16 rx_qid;
  257. /* this field is deprecated and should *always* be set to '1' */
  258. u8 num_rxqs;
  259. u8 cqe_completion;
  260. u8 padding[4];
  261. };
  262. /* Stop TX Queues */
  263. struct vfpf_stop_txqs_tlv {
  264. struct vfpf_first_tlv first_tlv;
  265. u16 tx_qid;
  266. /* this field is deprecated and should *always* be set to '1' */
  267. u8 num_txqs;
  268. u8 padding[5];
  269. };
  270. struct vfpf_update_rxq_tlv {
  271. struct vfpf_first_tlv first_tlv;
  272. u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
  273. u16 rx_qid;
  274. u8 num_rxqs;
  275. u8 flags;
  276. #define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG BIT(0)
  277. #define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG BIT(1)
  278. #define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG BIT(2)
  279. u8 padding[4];
  280. };
  281. /* Set Queue Filters */
  282. struct vfpf_q_mac_vlan_filter {
  283. u32 flags;
  284. #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
  285. #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
  286. #define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
  287. u8 mac[ETH_ALEN];
  288. u16 vlan_tag;
  289. u8 padding[4];
  290. };
  291. /* Start a vport */
  292. struct vfpf_vport_start_tlv {
  293. struct vfpf_first_tlv first_tlv;
  294. u64 sb_addr[PFVF_MAX_SBS_PER_VF];
  295. u32 tpa_mode;
  296. u16 dep1;
  297. u16 mtu;
  298. u8 vport_id;
  299. u8 inner_vlan_removal;
  300. u8 only_untagged;
  301. u8 max_buffers_per_cqe;
  302. u8 padding[4];
  303. };
  304. /* Extended tlvs - need to add rss, mcast, accept mode tlvs */
  305. struct vfpf_vport_update_activate_tlv {
  306. struct channel_tlv tl;
  307. u8 update_rx;
  308. u8 update_tx;
  309. u8 active_rx;
  310. u8 active_tx;
  311. };
  312. struct vfpf_vport_update_tx_switch_tlv {
  313. struct channel_tlv tl;
  314. u8 tx_switching;
  315. u8 padding[3];
  316. };
  317. struct vfpf_vport_update_vlan_strip_tlv {
  318. struct channel_tlv tl;
  319. u8 remove_vlan;
  320. u8 padding[3];
  321. };
  322. struct vfpf_vport_update_mcast_bin_tlv {
  323. struct channel_tlv tl;
  324. u8 padding[4];
  325. u64 bins[8];
  326. };
  327. struct vfpf_vport_update_accept_param_tlv {
  328. struct channel_tlv tl;
  329. u8 update_rx_mode;
  330. u8 update_tx_mode;
  331. u8 rx_accept_filter;
  332. u8 tx_accept_filter;
  333. };
  334. struct vfpf_vport_update_accept_any_vlan_tlv {
  335. struct channel_tlv tl;
  336. u8 update_accept_any_vlan_flg;
  337. u8 accept_any_vlan;
  338. u8 padding[2];
  339. };
  340. struct vfpf_vport_update_sge_tpa_tlv {
  341. struct channel_tlv tl;
  342. u16 sge_tpa_flags;
  343. #define VFPF_TPA_IPV4_EN_FLAG BIT(0)
  344. #define VFPF_TPA_IPV6_EN_FLAG BIT(1)
  345. #define VFPF_TPA_PKT_SPLIT_FLAG BIT(2)
  346. #define VFPF_TPA_HDR_DATA_SPLIT_FLAG BIT(3)
  347. #define VFPF_TPA_GRO_CONSIST_FLAG BIT(4)
  348. u8 update_sge_tpa_flags;
  349. #define VFPF_UPDATE_SGE_DEPRECATED_FLAG BIT(0)
  350. #define VFPF_UPDATE_TPA_EN_FLAG BIT(1)
  351. #define VFPF_UPDATE_TPA_PARAM_FLAG BIT(2)
  352. u8 max_buffers_per_cqe;
  353. u16 deprecated_sge_buff_size;
  354. u16 tpa_max_size;
  355. u16 tpa_min_size_to_start;
  356. u16 tpa_min_size_to_cont;
  357. u8 tpa_max_aggs_num;
  358. u8 padding[7];
  359. };
  360. /* Primary tlv as a header for various extended tlvs for
  361. * various functionalities in vport update ramrod.
  362. */
  363. struct vfpf_vport_update_tlv {
  364. struct vfpf_first_tlv first_tlv;
  365. };
  366. struct vfpf_ucast_filter_tlv {
  367. struct vfpf_first_tlv first_tlv;
  368. u8 opcode;
  369. u8 type;
  370. u8 mac[ETH_ALEN];
  371. u16 vlan;
  372. u16 padding[3];
  373. };
  374. /* tunnel update param tlv */
  375. struct vfpf_update_tunn_param_tlv {
  376. struct vfpf_first_tlv first_tlv;
  377. u8 tun_mode_update_mask;
  378. u8 tunn_mode;
  379. u8 update_tun_cls;
  380. u8 vxlan_clss;
  381. u8 l2gre_clss;
  382. u8 ipgre_clss;
  383. u8 l2geneve_clss;
  384. u8 ipgeneve_clss;
  385. u8 update_geneve_port;
  386. u8 update_vxlan_port;
  387. u16 geneve_port;
  388. u16 vxlan_port;
  389. u8 padding[2];
  390. };
  391. struct pfvf_update_tunn_param_tlv {
  392. struct pfvf_tlv hdr;
  393. u16 tunn_feature_mask;
  394. u8 vxlan_mode;
  395. u8 l2geneve_mode;
  396. u8 ipgeneve_mode;
  397. u8 l2gre_mode;
  398. u8 ipgre_mode;
  399. u8 vxlan_clss;
  400. u8 l2gre_clss;
  401. u8 ipgre_clss;
  402. u8 l2geneve_clss;
  403. u8 ipgeneve_clss;
  404. u16 vxlan_udp_port;
  405. u16 geneve_udp_port;
  406. };
  407. struct tlv_buffer_size {
  408. u8 tlv_buffer[TLV_BUFFER_SIZE];
  409. };
  410. struct vfpf_update_coalesce {
  411. struct vfpf_first_tlv first_tlv;
  412. u16 rx_coal;
  413. u16 tx_coal;
  414. u16 qid;
  415. u8 padding[2];
  416. };
  417. struct vfpf_read_coal_req_tlv {
  418. struct vfpf_first_tlv first_tlv;
  419. u16 qid;
  420. u8 is_rx;
  421. u8 padding[5];
  422. };
  423. struct pfvf_read_coal_resp_tlv {
  424. struct pfvf_tlv hdr;
  425. u16 coal;
  426. u8 padding[6];
  427. };
  428. struct vfpf_bulletin_update_mac_tlv {
  429. struct vfpf_first_tlv first_tlv;
  430. u8 mac[ETH_ALEN];
  431. u8 padding[2];
  432. };
  433. union vfpf_tlvs {
  434. struct vfpf_first_tlv first_tlv;
  435. struct vfpf_acquire_tlv acquire;
  436. struct vfpf_start_rxq_tlv start_rxq;
  437. struct vfpf_start_txq_tlv start_txq;
  438. struct vfpf_stop_rxqs_tlv stop_rxqs;
  439. struct vfpf_stop_txqs_tlv stop_txqs;
  440. struct vfpf_update_rxq_tlv update_rxq;
  441. struct vfpf_vport_start_tlv start_vport;
  442. struct vfpf_vport_update_tlv vport_update;
  443. struct vfpf_ucast_filter_tlv ucast_filter;
  444. struct vfpf_update_tunn_param_tlv tunn_param_update;
  445. struct vfpf_update_coalesce update_coalesce;
  446. struct vfpf_read_coal_req_tlv read_coal_req;
  447. struct vfpf_bulletin_update_mac_tlv bulletin_update_mac;
  448. struct tlv_buffer_size tlv_buf_size;
  449. };
  450. union pfvf_tlvs {
  451. struct pfvf_def_resp_tlv default_resp;
  452. struct pfvf_acquire_resp_tlv acquire_resp;
  453. struct tlv_buffer_size tlv_buf_size;
  454. struct pfvf_start_queue_resp_tlv queue_start;
  455. struct pfvf_update_tunn_param_tlv tunn_param_resp;
  456. struct pfvf_read_coal_resp_tlv read_coal_resp;
  457. };
  458. enum qed_bulletin_bit {
  459. /* Alert the VF that a forced MAC was set by the PF */
  460. MAC_ADDR_FORCED = 0,
  461. /* Alert the VF that a forced VLAN was set by the PF */
  462. VLAN_ADDR_FORCED = 2,
  463. /* Indicate that `default_only_untagged' contains actual data */
  464. VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
  465. VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
  466. /* Alert the VF that suggested mac was sent by the PF.
  467. * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set.
  468. */
  469. VFPF_BULLETIN_MAC_ADDR = 5
  470. };
  471. struct qed_bulletin_content {
  472. /* crc of structure to ensure is not in mid-update */
  473. u32 crc;
  474. u32 version;
  475. /* bitmap indicating which fields hold valid values */
  476. u64 valid_bitmap;
  477. /* used for MAC_ADDR or MAC_ADDR_FORCED */
  478. u8 mac[ETH_ALEN];
  479. /* If valid, 1 => only untagged Rx if no vlan is configured */
  480. u8 default_only_untagged;
  481. u8 padding;
  482. /* The following is a 'copy' of qed_mcp_link_state,
  483. * qed_mcp_link_params and qed_mcp_link_capabilities. Since it's
  484. * possible the structs will increase further along the road we cannot
  485. * have it here; Instead we need to have all of its fields.
  486. */
  487. u8 req_autoneg;
  488. u8 req_autoneg_pause;
  489. u8 req_forced_rx;
  490. u8 req_forced_tx;
  491. u8 padding2[4];
  492. u32 req_adv_speed;
  493. u32 req_forced_speed;
  494. u32 req_loopback;
  495. u32 padding3;
  496. u8 link_up;
  497. u8 full_duplex;
  498. u8 autoneg;
  499. u8 autoneg_complete;
  500. u8 parallel_detection;
  501. u8 pfc_enabled;
  502. u8 partner_tx_flow_ctrl_en;
  503. u8 partner_rx_flow_ctrl_en;
  504. u8 partner_adv_pause;
  505. u8 sfp_tx_fault;
  506. u16 vxlan_udp_port;
  507. u16 geneve_udp_port;
  508. u8 padding4[2];
  509. u32 speed;
  510. u32 partner_adv_speed;
  511. u32 capability_speed;
  512. /* Forced vlan */
  513. u16 pvid;
  514. u16 padding5;
  515. };
  516. struct qed_bulletin {
  517. dma_addr_t phys;
  518. struct qed_bulletin_content *p_virt;
  519. u32 size;
  520. };
  521. enum {
  522. CHANNEL_TLV_NONE, /* ends tlv sequence */
  523. CHANNEL_TLV_ACQUIRE,
  524. CHANNEL_TLV_VPORT_START,
  525. CHANNEL_TLV_VPORT_UPDATE,
  526. CHANNEL_TLV_VPORT_TEARDOWN,
  527. CHANNEL_TLV_START_RXQ,
  528. CHANNEL_TLV_START_TXQ,
  529. CHANNEL_TLV_STOP_RXQS,
  530. CHANNEL_TLV_STOP_TXQS,
  531. CHANNEL_TLV_UPDATE_RXQ,
  532. CHANNEL_TLV_INT_CLEANUP,
  533. CHANNEL_TLV_CLOSE,
  534. CHANNEL_TLV_RELEASE,
  535. CHANNEL_TLV_LIST_END,
  536. CHANNEL_TLV_UCAST_FILTER,
  537. CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
  538. CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
  539. CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
  540. CHANNEL_TLV_VPORT_UPDATE_MCAST,
  541. CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
  542. CHANNEL_TLV_VPORT_UPDATE_RSS,
  543. CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
  544. CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
  545. CHANNEL_TLV_UPDATE_TUNN_PARAM,
  546. CHANNEL_TLV_COALESCE_UPDATE,
  547. CHANNEL_TLV_QID,
  548. CHANNEL_TLV_COALESCE_READ,
  549. CHANNEL_TLV_BULLETIN_UPDATE_MAC,
  550. CHANNEL_TLV_MAX,
  551. /* Required for iterating over vport-update tlvs.
  552. * Will break in case non-sequential vport-update tlvs.
  553. */
  554. CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
  555. };
  556. /* Default number of CIDs [total of both Rx and Tx] to be requested
  557. * by default, and maximum possible number.
  558. */
  559. #define QED_ETH_VF_DEFAULT_NUM_CIDS (32)
  560. #define QED_ETH_VF_MAX_NUM_CIDS (250)
  561. /* This data is held in the qed_hwfn structure for VFs only. */
  562. struct qed_vf_iov {
  563. union vfpf_tlvs *vf2pf_request;
  564. dma_addr_t vf2pf_request_phys;
  565. union pfvf_tlvs *pf2vf_reply;
  566. dma_addr_t pf2vf_reply_phys;
  567. /* Should be taken whenever the mailbox buffers are accessed */
  568. struct mutex mutex;
  569. u8 *offset;
  570. /* Bulletin Board */
  571. struct qed_bulletin bulletin;
  572. struct qed_bulletin_content bulletin_shadow;
  573. /* we set aside a copy of the acquire response */
  574. struct pfvf_acquire_resp_tlv acquire_resp;
  575. /* In case PF originates prior to the fp-hsi version comparison,
  576. * this has to be propagated as it affects the fastpath.
  577. */
  578. bool b_pre_fp_hsi;
  579. /* Current day VFs are passing the SBs physical address on vport
  580. * start, and as they lack an IGU mapping they need to store the
  581. * addresses of previously registered SBs.
  582. * Even if we were to change configuration flow, due to backward
  583. * compatibility [with older PFs] we'd still need to store these.
  584. */
  585. struct qed_sb_info *sbs_info[PFVF_MAX_SBS_PER_VF];
  586. /* Determines whether VF utilizes doorbells via limited register
  587. * bar or via the doorbell bar.
  588. */
  589. bool b_doorbell_bar;
  590. };
  591. /**
  592. * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
  593. * Coalesce value '0' will omit the configuration.
  594. *
  595. * @param p_hwfn
  596. * @param rx_coal - coalesce value in micro second for rx queue
  597. * @param tx_coal - coalesce value in micro second for tx queue
  598. * @param p_cid - queue cid
  599. *
  600. **/
  601. int qed_vf_pf_set_coalesce(struct qed_hwfn *p_hwfn,
  602. u16 rx_coal,
  603. u16 tx_coal, struct qed_queue_cid *p_cid);
  604. /**
  605. * @brief VF - Get coalesce per VF's relative queue.
  606. *
  607. * @param p_hwfn
  608. * @param p_coal - coalesce value in micro second for VF queues.
  609. * @param p_cid - queue cid
  610. *
  611. **/
  612. int qed_vf_pf_get_coalesce(struct qed_hwfn *p_hwfn,
  613. u16 *p_coal, struct qed_queue_cid *p_cid);
  614. #ifdef CONFIG_QED_SRIOV
  615. /**
  616. * @brief Read the VF bulletin and act on it if needed
  617. *
  618. * @param p_hwfn
  619. * @param p_change - qed fills 1 iff bulletin board has changed, 0 otherwise.
  620. *
  621. * @return enum _qed_status
  622. */
  623. int qed_vf_read_bulletin(struct qed_hwfn *p_hwfn, u8 *p_change);
  624. /**
  625. * @brief Get link paramters for VF from qed
  626. *
  627. * @param p_hwfn
  628. * @param params - the link params structure to be filled for the VF
  629. */
  630. void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
  631. struct qed_mcp_link_params *params);
  632. /**
  633. * @brief Get link state for VF from qed
  634. *
  635. * @param p_hwfn
  636. * @param link - the link state structure to be filled for the VF
  637. */
  638. void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
  639. struct qed_mcp_link_state *link);
  640. /**
  641. * @brief Get link capabilities for VF from qed
  642. *
  643. * @param p_hwfn
  644. * @param p_link_caps - the link capabilities structure to be filled for the VF
  645. */
  646. void qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
  647. struct qed_mcp_link_capabilities *p_link_caps);
  648. /**
  649. * @brief Get number of Rx queues allocated for VF by qed
  650. *
  651. * @param p_hwfn
  652. * @param num_rxqs - allocated RX queues
  653. */
  654. void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs);
  655. /**
  656. * @brief Get number of Rx queues allocated for VF by qed
  657. *
  658. * @param p_hwfn
  659. * @param num_txqs - allocated RX queues
  660. */
  661. void qed_vf_get_num_txqs(struct qed_hwfn *p_hwfn, u8 *num_txqs);
  662. /**
  663. * @brief Get number of available connections [both Rx and Tx] for VF
  664. *
  665. * @param p_hwfn
  666. * @param num_cids - allocated number of connections
  667. */
  668. void qed_vf_get_num_cids(struct qed_hwfn *p_hwfn, u8 *num_cids);
  669. /**
  670. * @brief Get port mac address for VF
  671. *
  672. * @param p_hwfn
  673. * @param port_mac - destination location for port mac
  674. */
  675. void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac);
  676. /**
  677. * @brief Get number of VLAN filters allocated for VF by qed
  678. *
  679. * @param p_hwfn
  680. * @param num_rxqs - allocated VLAN filters
  681. */
  682. void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
  683. u8 *num_vlan_filters);
  684. /**
  685. * @brief Get number of MAC filters allocated for VF by qed
  686. *
  687. * @param p_hwfn
  688. * @param num_rxqs - allocated MAC filters
  689. */
  690. void qed_vf_get_num_mac_filters(struct qed_hwfn *p_hwfn, u8 *num_mac_filters);
  691. /**
  692. * @brief Check if VF can set a MAC address
  693. *
  694. * @param p_hwfn
  695. * @param mac
  696. *
  697. * @return bool
  698. */
  699. bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac);
  700. /**
  701. * @brief Set firmware version information in dev_info from VFs acquire response tlv
  702. *
  703. * @param p_hwfn
  704. * @param fw_major
  705. * @param fw_minor
  706. * @param fw_rev
  707. * @param fw_eng
  708. */
  709. void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
  710. u16 *fw_major, u16 *fw_minor,
  711. u16 *fw_rev, u16 *fw_eng);
  712. /**
  713. * @brief hw preparation for VF
  714. * sends ACQUIRE message
  715. *
  716. * @param p_hwfn
  717. *
  718. * @return int
  719. */
  720. int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn);
  721. /**
  722. * @brief VF - start the RX Queue by sending a message to the PF
  723. * @param p_hwfn
  724. * @param p_cid - Only relative fields are relevant
  725. * @param bd_max_bytes - maximum number of bytes per bd
  726. * @param bd_chain_phys_addr - physical address of bd chain
  727. * @param cqe_pbl_addr - physical address of pbl
  728. * @param cqe_pbl_size - pbl size
  729. * @param pp_prod - pointer to the producer to be
  730. * used in fastpath
  731. *
  732. * @return int
  733. */
  734. int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
  735. struct qed_queue_cid *p_cid,
  736. u16 bd_max_bytes,
  737. dma_addr_t bd_chain_phys_addr,
  738. dma_addr_t cqe_pbl_addr,
  739. u16 cqe_pbl_size, void __iomem **pp_prod);
  740. /**
  741. * @brief VF - start the TX queue by sending a message to the
  742. * PF.
  743. *
  744. * @param p_hwfn
  745. * @param tx_queue_id - zero based within the VF
  746. * @param sb - status block for this queue
  747. * @param sb_index - index within the status block
  748. * @param bd_chain_phys_addr - physical address of tx chain
  749. * @param pp_doorbell - pointer to address to which to
  750. * write the doorbell too..
  751. *
  752. * @return int
  753. */
  754. int
  755. qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
  756. struct qed_queue_cid *p_cid,
  757. dma_addr_t pbl_addr,
  758. u16 pbl_size, void __iomem **pp_doorbell);
  759. /**
  760. * @brief VF - stop the RX queue by sending a message to the PF
  761. *
  762. * @param p_hwfn
  763. * @param p_cid
  764. * @param cqe_completion
  765. *
  766. * @return int
  767. */
  768. int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
  769. struct qed_queue_cid *p_cid, bool cqe_completion);
  770. /**
  771. * @brief VF - stop the TX queue by sending a message to the PF
  772. *
  773. * @param p_hwfn
  774. * @param tx_qid
  775. *
  776. * @return int
  777. */
  778. int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, struct qed_queue_cid *p_cid);
  779. /**
  780. * @brief VF - send a vport update command
  781. *
  782. * @param p_hwfn
  783. * @param params
  784. *
  785. * @return int
  786. */
  787. int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
  788. struct qed_sp_vport_update_params *p_params);
  789. /**
  790. *
  791. * @brief VF - send a close message to PF
  792. *
  793. * @param p_hwfn
  794. *
  795. * @return enum _qed_status
  796. */
  797. int qed_vf_pf_reset(struct qed_hwfn *p_hwfn);
  798. /**
  799. * @brief VF - free vf`s memories
  800. *
  801. * @param p_hwfn
  802. *
  803. * @return enum _qed_status
  804. */
  805. int qed_vf_pf_release(struct qed_hwfn *p_hwfn);
  806. /**
  807. * @brief qed_vf_get_igu_sb_id - Get the IGU SB ID for a given
  808. * sb_id. For VFs igu sbs don't have to be contiguous
  809. *
  810. * @param p_hwfn
  811. * @param sb_id
  812. *
  813. * @return INLINE u16
  814. */
  815. u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
  816. /**
  817. * @brief Stores [or removes] a configured sb_info.
  818. *
  819. * @param p_hwfn
  820. * @param sb_id - zero-based SB index [for fastpath]
  821. * @param sb_info - may be NULL [during removal].
  822. */
  823. void qed_vf_set_sb_info(struct qed_hwfn *p_hwfn,
  824. u16 sb_id, struct qed_sb_info *p_sb);
  825. /**
  826. * @brief qed_vf_pf_vport_start - perform vport start for VF.
  827. *
  828. * @param p_hwfn
  829. * @param vport_id
  830. * @param mtu
  831. * @param inner_vlan_removal
  832. * @param tpa_mode
  833. * @param max_buffers_per_cqe,
  834. * @param only_untagged - default behavior regarding vlan acceptance
  835. *
  836. * @return enum _qed_status
  837. */
  838. int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
  839. u8 vport_id,
  840. u16 mtu,
  841. u8 inner_vlan_removal,
  842. enum qed_tpa_mode tpa_mode,
  843. u8 max_buffers_per_cqe, u8 only_untagged);
  844. /**
  845. * @brief qed_vf_pf_vport_stop - stop the VF's vport
  846. *
  847. * @param p_hwfn
  848. *
  849. * @return enum _qed_status
  850. */
  851. int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn);
  852. int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
  853. struct qed_filter_ucast *p_param);
  854. void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
  855. struct qed_filter_mcast *p_filter_cmd);
  856. /**
  857. * @brief qed_vf_pf_int_cleanup - clean the SB of the VF
  858. *
  859. * @param p_hwfn
  860. *
  861. * @return enum _qed_status
  862. */
  863. int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn);
  864. /**
  865. * @brief - return the link params in a given bulletin board
  866. *
  867. * @param p_hwfn
  868. * @param p_params - pointer to a struct to fill with link params
  869. * @param p_bulletin
  870. */
  871. void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
  872. struct qed_mcp_link_params *p_params,
  873. struct qed_bulletin_content *p_bulletin);
  874. /**
  875. * @brief - return the link state in a given bulletin board
  876. *
  877. * @param p_hwfn
  878. * @param p_link - pointer to a struct to fill with link state
  879. * @param p_bulletin
  880. */
  881. void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
  882. struct qed_mcp_link_state *p_link,
  883. struct qed_bulletin_content *p_bulletin);
  884. /**
  885. * @brief - return the link capabilities in a given bulletin board
  886. *
  887. * @param p_hwfn
  888. * @param p_link - pointer to a struct to fill with link capabilities
  889. * @param p_bulletin
  890. */
  891. void __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
  892. struct qed_mcp_link_capabilities *p_link_caps,
  893. struct qed_bulletin_content *p_bulletin);
  894. void qed_iov_vf_task(struct work_struct *work);
  895. void qed_vf_set_vf_start_tunn_update_param(struct qed_tunnel_info *p_tun);
  896. int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
  897. struct qed_tunnel_info *p_tunn);
  898. u32 qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn, enum BAR_ID bar_id);
  899. /**
  900. * @brief - Ask PF to update the MAC address in it's bulletin board
  901. *
  902. * @param p_mac - mac address to be updated in bulletin board
  903. */
  904. int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn, u8 *p_mac);
  905. #else
  906. static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
  907. struct qed_mcp_link_params *params)
  908. {
  909. }
  910. static inline void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
  911. struct qed_mcp_link_state *link)
  912. {
  913. }
  914. static inline void
  915. qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
  916. struct qed_mcp_link_capabilities *p_link_caps)
  917. {
  918. }
  919. static inline void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs)
  920. {
  921. }
  922. static inline void qed_vf_get_num_txqs(struct qed_hwfn *p_hwfn, u8 *num_txqs)
  923. {
  924. }
  925. static inline void qed_vf_get_num_cids(struct qed_hwfn *p_hwfn, u8 *num_cids)
  926. {
  927. }
  928. static inline void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac)
  929. {
  930. }
  931. static inline void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
  932. u8 *num_vlan_filters)
  933. {
  934. }
  935. static inline void qed_vf_get_num_mac_filters(struct qed_hwfn *p_hwfn,
  936. u8 *num_mac_filters)
  937. {
  938. }
  939. static inline bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac)
  940. {
  941. return false;
  942. }
  943. static inline void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
  944. u16 *fw_major, u16 *fw_minor,
  945. u16 *fw_rev, u16 *fw_eng)
  946. {
  947. }
  948. static inline int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
  949. {
  950. return -EINVAL;
  951. }
  952. static inline int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
  953. struct qed_queue_cid *p_cid,
  954. u16 bd_max_bytes,
  955. dma_addr_t bd_chain_phys_adr,
  956. dma_addr_t cqe_pbl_addr,
  957. u16 cqe_pbl_size, void __iomem **pp_prod)
  958. {
  959. return -EINVAL;
  960. }
  961. static inline int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
  962. struct qed_queue_cid *p_cid,
  963. dma_addr_t pbl_addr,
  964. u16 pbl_size, void __iomem **pp_doorbell)
  965. {
  966. return -EINVAL;
  967. }
  968. static inline int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
  969. struct qed_queue_cid *p_cid,
  970. bool cqe_completion)
  971. {
  972. return -EINVAL;
  973. }
  974. static inline int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn,
  975. struct qed_queue_cid *p_cid)
  976. {
  977. return -EINVAL;
  978. }
  979. static inline int
  980. qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
  981. struct qed_sp_vport_update_params *p_params)
  982. {
  983. return -EINVAL;
  984. }
  985. static inline int qed_vf_pf_reset(struct qed_hwfn *p_hwfn)
  986. {
  987. return -EINVAL;
  988. }
  989. static inline int qed_vf_pf_release(struct qed_hwfn *p_hwfn)
  990. {
  991. return -EINVAL;
  992. }
  993. static inline u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id)
  994. {
  995. return 0;
  996. }
  997. static inline void qed_vf_set_sb_info(struct qed_hwfn *p_hwfn, u16 sb_id,
  998. struct qed_sb_info *p_sb)
  999. {
  1000. }
  1001. static inline int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
  1002. u8 vport_id,
  1003. u16 mtu,
  1004. u8 inner_vlan_removal,
  1005. enum qed_tpa_mode tpa_mode,
  1006. u8 max_buffers_per_cqe,
  1007. u8 only_untagged)
  1008. {
  1009. return -EINVAL;
  1010. }
  1011. static inline int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn)
  1012. {
  1013. return -EINVAL;
  1014. }
  1015. static inline int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
  1016. struct qed_filter_ucast *p_param)
  1017. {
  1018. return -EINVAL;
  1019. }
  1020. static inline void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
  1021. struct qed_filter_mcast *p_filter_cmd)
  1022. {
  1023. }
  1024. static inline int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn)
  1025. {
  1026. return -EINVAL;
  1027. }
  1028. static inline void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
  1029. struct qed_mcp_link_params
  1030. *p_params,
  1031. struct qed_bulletin_content
  1032. *p_bulletin)
  1033. {
  1034. }
  1035. static inline void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
  1036. struct qed_mcp_link_state *p_link,
  1037. struct qed_bulletin_content
  1038. *p_bulletin)
  1039. {
  1040. }
  1041. static inline void
  1042. __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
  1043. struct qed_mcp_link_capabilities *p_link_caps,
  1044. struct qed_bulletin_content *p_bulletin)
  1045. {
  1046. }
  1047. static inline void qed_iov_vf_task(struct work_struct *work)
  1048. {
  1049. }
  1050. static inline void
  1051. qed_vf_set_vf_start_tunn_update_param(struct qed_tunnel_info *p_tun)
  1052. {
  1053. }
  1054. static inline int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
  1055. struct qed_tunnel_info *p_tunn)
  1056. {
  1057. return -EINVAL;
  1058. }
  1059. static inline int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn,
  1060. u8 *p_mac)
  1061. {
  1062. return -EINVAL;
  1063. }
  1064. static inline u32
  1065. qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn,
  1066. enum BAR_ID bar_id)
  1067. {
  1068. return 0;
  1069. }
  1070. #endif
  1071. #endif