qed_sp_commands.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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. #include <linux/types.h>
  33. #include <asm/byteorder.h>
  34. #include <linux/bitops.h>
  35. #include <linux/errno.h>
  36. #include <linux/kernel.h>
  37. #include <linux/string.h>
  38. #include "qed.h"
  39. #include <linux/qed/qed_chain.h>
  40. #include "qed_cxt.h"
  41. #include "qed_dcbx.h"
  42. #include "qed_hsi.h"
  43. #include "qed_hw.h"
  44. #include "qed_int.h"
  45. #include "qed_reg_addr.h"
  46. #include "qed_sp.h"
  47. #include "qed_sriov.h"
  48. int qed_sp_init_request(struct qed_hwfn *p_hwfn,
  49. struct qed_spq_entry **pp_ent,
  50. u8 cmd, u8 protocol, struct qed_sp_init_data *p_data)
  51. {
  52. u32 opaque_cid = p_data->opaque_fid << 16 | p_data->cid;
  53. struct qed_spq_entry *p_ent = NULL;
  54. int rc;
  55. if (!pp_ent)
  56. return -ENOMEM;
  57. rc = qed_spq_get_entry(p_hwfn, pp_ent);
  58. if (rc)
  59. return rc;
  60. p_ent = *pp_ent;
  61. p_ent->elem.hdr.cid = cpu_to_le32(opaque_cid);
  62. p_ent->elem.hdr.cmd_id = cmd;
  63. p_ent->elem.hdr.protocol_id = protocol;
  64. p_ent->priority = QED_SPQ_PRIORITY_NORMAL;
  65. p_ent->comp_mode = p_data->comp_mode;
  66. p_ent->comp_done.done = 0;
  67. switch (p_ent->comp_mode) {
  68. case QED_SPQ_MODE_EBLOCK:
  69. p_ent->comp_cb.cookie = &p_ent->comp_done;
  70. break;
  71. case QED_SPQ_MODE_BLOCK:
  72. if (!p_data->p_comp_data)
  73. return -EINVAL;
  74. p_ent->comp_cb.cookie = p_data->p_comp_data->cookie;
  75. break;
  76. case QED_SPQ_MODE_CB:
  77. if (!p_data->p_comp_data)
  78. p_ent->comp_cb.function = NULL;
  79. else
  80. p_ent->comp_cb = *p_data->p_comp_data;
  81. break;
  82. default:
  83. DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n",
  84. p_ent->comp_mode);
  85. return -EINVAL;
  86. }
  87. DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
  88. "Initialized: CID %08x cmd %02x protocol %02x data_addr %lu comp_mode [%s]\n",
  89. opaque_cid, cmd, protocol,
  90. (unsigned long)&p_ent->ramrod,
  91. D_TRINE(p_ent->comp_mode, QED_SPQ_MODE_EBLOCK,
  92. QED_SPQ_MODE_BLOCK, "MODE_EBLOCK", "MODE_BLOCK",
  93. "MODE_CB"));
  94. memset(&p_ent->ramrod, 0, sizeof(p_ent->ramrod));
  95. return 0;
  96. }
  97. static enum tunnel_clss qed_tunn_get_clss_type(u8 type)
  98. {
  99. switch (type) {
  100. case QED_TUNN_CLSS_MAC_VLAN:
  101. return TUNNEL_CLSS_MAC_VLAN;
  102. case QED_TUNN_CLSS_MAC_VNI:
  103. return TUNNEL_CLSS_MAC_VNI;
  104. case QED_TUNN_CLSS_INNER_MAC_VLAN:
  105. return TUNNEL_CLSS_INNER_MAC_VLAN;
  106. case QED_TUNN_CLSS_INNER_MAC_VNI:
  107. return TUNNEL_CLSS_INNER_MAC_VNI;
  108. default:
  109. return TUNNEL_CLSS_MAC_VLAN;
  110. }
  111. }
  112. static void
  113. qed_tunn_set_pf_fix_tunn_mode(struct qed_hwfn *p_hwfn,
  114. struct qed_tunn_update_params *p_src,
  115. struct pf_update_tunnel_config *p_tunn_cfg)
  116. {
  117. unsigned long cached_tunn_mode = p_hwfn->cdev->tunn_mode;
  118. unsigned long update_mask = p_src->tunn_mode_update_mask;
  119. unsigned long tunn_mode = p_src->tunn_mode;
  120. unsigned long new_tunn_mode = 0;
  121. if (test_bit(QED_MODE_L2GRE_TUNN, &update_mask)) {
  122. if (test_bit(QED_MODE_L2GRE_TUNN, &tunn_mode))
  123. __set_bit(QED_MODE_L2GRE_TUNN, &new_tunn_mode);
  124. } else {
  125. if (test_bit(QED_MODE_L2GRE_TUNN, &cached_tunn_mode))
  126. __set_bit(QED_MODE_L2GRE_TUNN, &new_tunn_mode);
  127. }
  128. if (test_bit(QED_MODE_IPGRE_TUNN, &update_mask)) {
  129. if (test_bit(QED_MODE_IPGRE_TUNN, &tunn_mode))
  130. __set_bit(QED_MODE_IPGRE_TUNN, &new_tunn_mode);
  131. } else {
  132. if (test_bit(QED_MODE_IPGRE_TUNN, &cached_tunn_mode))
  133. __set_bit(QED_MODE_IPGRE_TUNN, &new_tunn_mode);
  134. }
  135. if (test_bit(QED_MODE_VXLAN_TUNN, &update_mask)) {
  136. if (test_bit(QED_MODE_VXLAN_TUNN, &tunn_mode))
  137. __set_bit(QED_MODE_VXLAN_TUNN, &new_tunn_mode);
  138. } else {
  139. if (test_bit(QED_MODE_VXLAN_TUNN, &cached_tunn_mode))
  140. __set_bit(QED_MODE_VXLAN_TUNN, &new_tunn_mode);
  141. }
  142. if (p_src->update_geneve_udp_port) {
  143. p_tunn_cfg->set_geneve_udp_port_flg = 1;
  144. p_tunn_cfg->geneve_udp_port =
  145. cpu_to_le16(p_src->geneve_udp_port);
  146. }
  147. if (test_bit(QED_MODE_L2GENEVE_TUNN, &update_mask)) {
  148. if (test_bit(QED_MODE_L2GENEVE_TUNN, &tunn_mode))
  149. __set_bit(QED_MODE_L2GENEVE_TUNN, &new_tunn_mode);
  150. } else {
  151. if (test_bit(QED_MODE_L2GENEVE_TUNN, &cached_tunn_mode))
  152. __set_bit(QED_MODE_L2GENEVE_TUNN, &new_tunn_mode);
  153. }
  154. if (test_bit(QED_MODE_IPGENEVE_TUNN, &update_mask)) {
  155. if (test_bit(QED_MODE_IPGENEVE_TUNN, &tunn_mode))
  156. __set_bit(QED_MODE_IPGENEVE_TUNN, &new_tunn_mode);
  157. } else {
  158. if (test_bit(QED_MODE_IPGENEVE_TUNN, &cached_tunn_mode))
  159. __set_bit(QED_MODE_IPGENEVE_TUNN, &new_tunn_mode);
  160. }
  161. p_src->tunn_mode = new_tunn_mode;
  162. }
  163. static void
  164. qed_tunn_set_pf_update_params(struct qed_hwfn *p_hwfn,
  165. struct qed_tunn_update_params *p_src,
  166. struct pf_update_tunnel_config *p_tunn_cfg)
  167. {
  168. unsigned long tunn_mode = p_src->tunn_mode;
  169. enum tunnel_clss type;
  170. qed_tunn_set_pf_fix_tunn_mode(p_hwfn, p_src, p_tunn_cfg);
  171. p_tunn_cfg->update_rx_pf_clss = p_src->update_rx_pf_clss;
  172. p_tunn_cfg->update_tx_pf_clss = p_src->update_tx_pf_clss;
  173. type = qed_tunn_get_clss_type(p_src->tunn_clss_vxlan);
  174. p_tunn_cfg->tunnel_clss_vxlan = type;
  175. type = qed_tunn_get_clss_type(p_src->tunn_clss_l2gre);
  176. p_tunn_cfg->tunnel_clss_l2gre = type;
  177. type = qed_tunn_get_clss_type(p_src->tunn_clss_ipgre);
  178. p_tunn_cfg->tunnel_clss_ipgre = type;
  179. if (p_src->update_vxlan_udp_port) {
  180. p_tunn_cfg->set_vxlan_udp_port_flg = 1;
  181. p_tunn_cfg->vxlan_udp_port = cpu_to_le16(p_src->vxlan_udp_port);
  182. }
  183. if (test_bit(QED_MODE_L2GRE_TUNN, &tunn_mode))
  184. p_tunn_cfg->tx_enable_l2gre = 1;
  185. if (test_bit(QED_MODE_IPGRE_TUNN, &tunn_mode))
  186. p_tunn_cfg->tx_enable_ipgre = 1;
  187. if (test_bit(QED_MODE_VXLAN_TUNN, &tunn_mode))
  188. p_tunn_cfg->tx_enable_vxlan = 1;
  189. if (p_src->update_geneve_udp_port) {
  190. p_tunn_cfg->set_geneve_udp_port_flg = 1;
  191. p_tunn_cfg->geneve_udp_port =
  192. cpu_to_le16(p_src->geneve_udp_port);
  193. }
  194. if (test_bit(QED_MODE_L2GENEVE_TUNN, &tunn_mode))
  195. p_tunn_cfg->tx_enable_l2geneve = 1;
  196. if (test_bit(QED_MODE_IPGENEVE_TUNN, &tunn_mode))
  197. p_tunn_cfg->tx_enable_ipgeneve = 1;
  198. type = qed_tunn_get_clss_type(p_src->tunn_clss_l2geneve);
  199. p_tunn_cfg->tunnel_clss_l2geneve = type;
  200. type = qed_tunn_get_clss_type(p_src->tunn_clss_ipgeneve);
  201. p_tunn_cfg->tunnel_clss_ipgeneve = type;
  202. }
  203. static void qed_set_hw_tunn_mode(struct qed_hwfn *p_hwfn,
  204. struct qed_ptt *p_ptt,
  205. unsigned long tunn_mode)
  206. {
  207. u8 l2gre_enable = 0, ipgre_enable = 0, vxlan_enable = 0;
  208. u8 l2geneve_enable = 0, ipgeneve_enable = 0;
  209. if (test_bit(QED_MODE_L2GRE_TUNN, &tunn_mode))
  210. l2gre_enable = 1;
  211. if (test_bit(QED_MODE_IPGRE_TUNN, &tunn_mode))
  212. ipgre_enable = 1;
  213. if (test_bit(QED_MODE_VXLAN_TUNN, &tunn_mode))
  214. vxlan_enable = 1;
  215. qed_set_gre_enable(p_hwfn, p_ptt, l2gre_enable, ipgre_enable);
  216. qed_set_vxlan_enable(p_hwfn, p_ptt, vxlan_enable);
  217. if (test_bit(QED_MODE_L2GENEVE_TUNN, &tunn_mode))
  218. l2geneve_enable = 1;
  219. if (test_bit(QED_MODE_IPGENEVE_TUNN, &tunn_mode))
  220. ipgeneve_enable = 1;
  221. qed_set_geneve_enable(p_hwfn, p_ptt, l2geneve_enable,
  222. ipgeneve_enable);
  223. }
  224. static void
  225. qed_tunn_set_pf_start_params(struct qed_hwfn *p_hwfn,
  226. struct qed_tunn_start_params *p_src,
  227. struct pf_start_tunnel_config *p_tunn_cfg)
  228. {
  229. unsigned long tunn_mode;
  230. enum tunnel_clss type;
  231. if (!p_src)
  232. return;
  233. tunn_mode = p_src->tunn_mode;
  234. type = qed_tunn_get_clss_type(p_src->tunn_clss_vxlan);
  235. p_tunn_cfg->tunnel_clss_vxlan = type;
  236. type = qed_tunn_get_clss_type(p_src->tunn_clss_l2gre);
  237. p_tunn_cfg->tunnel_clss_l2gre = type;
  238. type = qed_tunn_get_clss_type(p_src->tunn_clss_ipgre);
  239. p_tunn_cfg->tunnel_clss_ipgre = type;
  240. if (p_src->update_vxlan_udp_port) {
  241. p_tunn_cfg->set_vxlan_udp_port_flg = 1;
  242. p_tunn_cfg->vxlan_udp_port = cpu_to_le16(p_src->vxlan_udp_port);
  243. }
  244. if (test_bit(QED_MODE_L2GRE_TUNN, &tunn_mode))
  245. p_tunn_cfg->tx_enable_l2gre = 1;
  246. if (test_bit(QED_MODE_IPGRE_TUNN, &tunn_mode))
  247. p_tunn_cfg->tx_enable_ipgre = 1;
  248. if (test_bit(QED_MODE_VXLAN_TUNN, &tunn_mode))
  249. p_tunn_cfg->tx_enable_vxlan = 1;
  250. if (p_src->update_geneve_udp_port) {
  251. p_tunn_cfg->set_geneve_udp_port_flg = 1;
  252. p_tunn_cfg->geneve_udp_port =
  253. cpu_to_le16(p_src->geneve_udp_port);
  254. }
  255. if (test_bit(QED_MODE_L2GENEVE_TUNN, &tunn_mode))
  256. p_tunn_cfg->tx_enable_l2geneve = 1;
  257. if (test_bit(QED_MODE_IPGENEVE_TUNN, &tunn_mode))
  258. p_tunn_cfg->tx_enable_ipgeneve = 1;
  259. type = qed_tunn_get_clss_type(p_src->tunn_clss_l2geneve);
  260. p_tunn_cfg->tunnel_clss_l2geneve = type;
  261. type = qed_tunn_get_clss_type(p_src->tunn_clss_ipgeneve);
  262. p_tunn_cfg->tunnel_clss_ipgeneve = type;
  263. }
  264. int qed_sp_pf_start(struct qed_hwfn *p_hwfn,
  265. struct qed_tunn_start_params *p_tunn,
  266. enum qed_mf_mode mode, bool allow_npar_tx_switch)
  267. {
  268. struct pf_start_ramrod_data *p_ramrod = NULL;
  269. u16 sb = qed_int_get_sp_sb_id(p_hwfn);
  270. u8 sb_index = p_hwfn->p_eq->eq_sb_index;
  271. struct qed_spq_entry *p_ent = NULL;
  272. struct qed_sp_init_data init_data;
  273. int rc = -EINVAL;
  274. u8 page_cnt;
  275. /* update initial eq producer */
  276. qed_eq_prod_update(p_hwfn,
  277. qed_chain_get_prod_idx(&p_hwfn->p_eq->chain));
  278. memset(&init_data, 0, sizeof(init_data));
  279. init_data.cid = qed_spq_get_cid(p_hwfn);
  280. init_data.opaque_fid = p_hwfn->hw_info.opaque_fid;
  281. init_data.comp_mode = QED_SPQ_MODE_EBLOCK;
  282. rc = qed_sp_init_request(p_hwfn, &p_ent,
  283. COMMON_RAMROD_PF_START,
  284. PROTOCOLID_COMMON, &init_data);
  285. if (rc)
  286. return rc;
  287. p_ramrod = &p_ent->ramrod.pf_start;
  288. p_ramrod->event_ring_sb_id = cpu_to_le16(sb);
  289. p_ramrod->event_ring_sb_index = sb_index;
  290. p_ramrod->path_id = QED_PATH_ID(p_hwfn);
  291. p_ramrod->dont_log_ramrods = 0;
  292. p_ramrod->log_type_mask = cpu_to_le16(0xf);
  293. switch (mode) {
  294. case QED_MF_DEFAULT:
  295. case QED_MF_NPAR:
  296. p_ramrod->mf_mode = MF_NPAR;
  297. break;
  298. case QED_MF_OVLAN:
  299. p_ramrod->mf_mode = MF_OVLAN;
  300. break;
  301. default:
  302. DP_NOTICE(p_hwfn, "Unsupported MF mode, init as DEFAULT\n");
  303. p_ramrod->mf_mode = MF_NPAR;
  304. }
  305. p_ramrod->outer_tag = p_hwfn->hw_info.ovlan;
  306. /* Place EQ address in RAMROD */
  307. DMA_REGPAIR_LE(p_ramrod->event_ring_pbl_addr,
  308. p_hwfn->p_eq->chain.pbl_sp.p_phys_table);
  309. page_cnt = (u8)qed_chain_get_page_cnt(&p_hwfn->p_eq->chain);
  310. p_ramrod->event_ring_num_pages = page_cnt;
  311. DMA_REGPAIR_LE(p_ramrod->consolid_q_pbl_addr,
  312. p_hwfn->p_consq->chain.pbl_sp.p_phys_table);
  313. qed_tunn_set_pf_start_params(p_hwfn, p_tunn, &p_ramrod->tunnel_config);
  314. if (IS_MF_SI(p_hwfn))
  315. p_ramrod->allow_npar_tx_switching = allow_npar_tx_switch;
  316. switch (p_hwfn->hw_info.personality) {
  317. case QED_PCI_ETH:
  318. p_ramrod->personality = PERSONALITY_ETH;
  319. break;
  320. case QED_PCI_FCOE:
  321. p_ramrod->personality = PERSONALITY_FCOE;
  322. break;
  323. case QED_PCI_ISCSI:
  324. p_ramrod->personality = PERSONALITY_ISCSI;
  325. break;
  326. case QED_PCI_ETH_ROCE:
  327. p_ramrod->personality = PERSONALITY_RDMA_AND_ETH;
  328. break;
  329. default:
  330. DP_NOTICE(p_hwfn, "Unknown personality %d\n",
  331. p_hwfn->hw_info.personality);
  332. p_ramrod->personality = PERSONALITY_ETH;
  333. }
  334. if (p_hwfn->cdev->p_iov_info) {
  335. struct qed_hw_sriov_info *p_iov = p_hwfn->cdev->p_iov_info;
  336. p_ramrod->base_vf_id = (u8) p_iov->first_vf_in_pf;
  337. p_ramrod->num_vfs = (u8) p_iov->total_vfs;
  338. }
  339. p_ramrod->hsi_fp_ver.major_ver_arr[ETH_VER_KEY] = ETH_HSI_VER_MAJOR;
  340. p_ramrod->hsi_fp_ver.minor_ver_arr[ETH_VER_KEY] = ETH_HSI_VER_MINOR;
  341. DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
  342. "Setting event_ring_sb [id %04x index %02x], outer_tag [%d]\n",
  343. sb, sb_index, p_ramrod->outer_tag);
  344. rc = qed_spq_post(p_hwfn, p_ent, NULL);
  345. if (p_tunn) {
  346. qed_set_hw_tunn_mode(p_hwfn, p_hwfn->p_main_ptt,
  347. p_tunn->tunn_mode);
  348. p_hwfn->cdev->tunn_mode = p_tunn->tunn_mode;
  349. }
  350. return rc;
  351. }
  352. int qed_sp_pf_update(struct qed_hwfn *p_hwfn)
  353. {
  354. struct qed_spq_entry *p_ent = NULL;
  355. struct qed_sp_init_data init_data;
  356. int rc = -EINVAL;
  357. /* Get SPQ entry */
  358. memset(&init_data, 0, sizeof(init_data));
  359. init_data.cid = qed_spq_get_cid(p_hwfn);
  360. init_data.opaque_fid = p_hwfn->hw_info.opaque_fid;
  361. init_data.comp_mode = QED_SPQ_MODE_CB;
  362. rc = qed_sp_init_request(p_hwfn, &p_ent,
  363. COMMON_RAMROD_PF_UPDATE, PROTOCOLID_COMMON,
  364. &init_data);
  365. if (rc)
  366. return rc;
  367. qed_dcbx_set_pf_update_params(&p_hwfn->p_dcbx_info->results,
  368. &p_ent->ramrod.pf_update);
  369. return qed_spq_post(p_hwfn, p_ent, NULL);
  370. }
  371. /* Set pf update ramrod command params */
  372. int qed_sp_pf_update_tunn_cfg(struct qed_hwfn *p_hwfn,
  373. struct qed_tunn_update_params *p_tunn,
  374. enum spq_mode comp_mode,
  375. struct qed_spq_comp_cb *p_comp_data)
  376. {
  377. struct qed_spq_entry *p_ent = NULL;
  378. struct qed_sp_init_data init_data;
  379. int rc = -EINVAL;
  380. /* Get SPQ entry */
  381. memset(&init_data, 0, sizeof(init_data));
  382. init_data.cid = qed_spq_get_cid(p_hwfn);
  383. init_data.opaque_fid = p_hwfn->hw_info.opaque_fid;
  384. init_data.comp_mode = comp_mode;
  385. init_data.p_comp_data = p_comp_data;
  386. rc = qed_sp_init_request(p_hwfn, &p_ent,
  387. COMMON_RAMROD_PF_UPDATE, PROTOCOLID_COMMON,
  388. &init_data);
  389. if (rc)
  390. return rc;
  391. qed_tunn_set_pf_update_params(p_hwfn, p_tunn,
  392. &p_ent->ramrod.pf_update.tunnel_config);
  393. rc = qed_spq_post(p_hwfn, p_ent, NULL);
  394. if (rc)
  395. return rc;
  396. if (p_tunn->update_vxlan_udp_port)
  397. qed_set_vxlan_dest_port(p_hwfn, p_hwfn->p_main_ptt,
  398. p_tunn->vxlan_udp_port);
  399. if (p_tunn->update_geneve_udp_port)
  400. qed_set_geneve_dest_port(p_hwfn, p_hwfn->p_main_ptt,
  401. p_tunn->geneve_udp_port);
  402. qed_set_hw_tunn_mode(p_hwfn, p_hwfn->p_main_ptt, p_tunn->tunn_mode);
  403. p_hwfn->cdev->tunn_mode = p_tunn->tunn_mode;
  404. return rc;
  405. }
  406. int qed_sp_pf_stop(struct qed_hwfn *p_hwfn)
  407. {
  408. struct qed_spq_entry *p_ent = NULL;
  409. struct qed_sp_init_data init_data;
  410. int rc = -EINVAL;
  411. /* Get SPQ entry */
  412. memset(&init_data, 0, sizeof(init_data));
  413. init_data.cid = qed_spq_get_cid(p_hwfn);
  414. init_data.opaque_fid = p_hwfn->hw_info.opaque_fid;
  415. init_data.comp_mode = QED_SPQ_MODE_EBLOCK;
  416. rc = qed_sp_init_request(p_hwfn, &p_ent,
  417. COMMON_RAMROD_PF_STOP, PROTOCOLID_COMMON,
  418. &init_data);
  419. if (rc)
  420. return rc;
  421. return qed_spq_post(p_hwfn, p_ent, NULL);
  422. }
  423. int qed_sp_heartbeat_ramrod(struct qed_hwfn *p_hwfn)
  424. {
  425. struct qed_spq_entry *p_ent = NULL;
  426. struct qed_sp_init_data init_data;
  427. int rc;
  428. /* Get SPQ entry */
  429. memset(&init_data, 0, sizeof(init_data));
  430. init_data.cid = qed_spq_get_cid(p_hwfn);
  431. init_data.opaque_fid = p_hwfn->hw_info.opaque_fid;
  432. init_data.comp_mode = QED_SPQ_MODE_EBLOCK;
  433. rc = qed_sp_init_request(p_hwfn, &p_ent,
  434. COMMON_RAMROD_EMPTY, PROTOCOLID_COMMON,
  435. &init_data);
  436. if (rc)
  437. return rc;
  438. return qed_spq_post(p_hwfn, p_ent, NULL);
  439. }