ice_eswitch.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* Copyright (C) 2019-2021, Intel Corporation. */
  3. #include "ice.h"
  4. #include "ice_lib.h"
  5. #include "ice_eswitch.h"
  6. #include "ice_eswitch_br.h"
  7. #include "ice_fltr.h"
  8. #include "ice_repr.h"
  9. #include "devlink/devlink.h"
  10. #include "ice_tc_lib.h"
  11. /**
  12. * ice_eswitch_setup_env - configure eswitch HW filters
  13. * @pf: pointer to PF struct
  14. *
  15. * This function adds HW filters configuration specific for switchdev
  16. * mode.
  17. */
  18. static int ice_eswitch_setup_env(struct ice_pf *pf)
  19. {
  20. struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi;
  21. struct net_device *netdev = uplink_vsi->netdev;
  22. bool if_running = netif_running(netdev);
  23. struct ice_vsi_vlan_ops *vlan_ops;
  24. if (if_running && !test_and_set_bit(ICE_VSI_DOWN, uplink_vsi->state))
  25. if (ice_down(uplink_vsi))
  26. return -ENODEV;
  27. ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx);
  28. netif_addr_lock_bh(netdev);
  29. __dev_uc_unsync(netdev, NULL);
  30. __dev_mc_unsync(netdev, NULL);
  31. netif_addr_unlock_bh(netdev);
  32. if (ice_vsi_add_vlan_zero(uplink_vsi))
  33. goto err_vlan_zero;
  34. if (ice_set_dflt_vsi(uplink_vsi))
  35. goto err_def_rx;
  36. if (ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, true,
  37. ICE_FLTR_TX))
  38. goto err_def_tx;
  39. vlan_ops = ice_get_compat_vsi_vlan_ops(uplink_vsi);
  40. if (vlan_ops->dis_rx_filtering(uplink_vsi))
  41. goto err_vlan_filtering;
  42. if (ice_vsi_update_local_lb(uplink_vsi, true))
  43. goto err_override_local_lb;
  44. if (if_running && ice_up(uplink_vsi))
  45. goto err_up;
  46. return 0;
  47. err_up:
  48. ice_vsi_update_local_lb(uplink_vsi, false);
  49. err_override_local_lb:
  50. vlan_ops->ena_rx_filtering(uplink_vsi);
  51. err_vlan_filtering:
  52. ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false,
  53. ICE_FLTR_TX);
  54. err_def_tx:
  55. ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false,
  56. ICE_FLTR_RX);
  57. err_def_rx:
  58. ice_vsi_del_vlan_zero(uplink_vsi);
  59. err_vlan_zero:
  60. ice_fltr_add_mac_and_broadcast(uplink_vsi,
  61. uplink_vsi->port_info->mac.perm_addr,
  62. ICE_FWD_TO_VSI);
  63. if (if_running)
  64. ice_up(uplink_vsi);
  65. return -ENODEV;
  66. }
  67. /**
  68. * ice_eswitch_release_repr - clear PR VSI configuration
  69. * @pf: poiner to PF struct
  70. * @repr: pointer to PR
  71. */
  72. static void
  73. ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr)
  74. {
  75. struct ice_vsi *vsi = repr->src_vsi;
  76. /* Skip representors that aren't configured */
  77. if (!repr->dst)
  78. return;
  79. ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof);
  80. metadata_dst_free(repr->dst);
  81. repr->dst = NULL;
  82. ice_fltr_add_mac_and_broadcast(vsi, repr->parent_mac,
  83. ICE_FWD_TO_VSI);
  84. }
  85. /**
  86. * ice_eswitch_setup_repr - configure PR to run in switchdev mode
  87. * @pf: pointer to PF struct
  88. * @repr: pointer to PR struct
  89. */
  90. static int ice_eswitch_setup_repr(struct ice_pf *pf, struct ice_repr *repr)
  91. {
  92. struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi;
  93. struct ice_vsi *vsi = repr->src_vsi;
  94. struct metadata_dst *dst;
  95. repr->dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX,
  96. GFP_KERNEL);
  97. if (!repr->dst)
  98. return -ENOMEM;
  99. netif_keep_dst(uplink_vsi->netdev);
  100. dst = repr->dst;
  101. dst->u.port_info.port_id = vsi->vsi_num;
  102. dst->u.port_info.lower_dev = uplink_vsi->netdev;
  103. return 0;
  104. }
  105. /**
  106. * ice_eswitch_cfg_vsi - configure VSI to work in slow-path
  107. * @vsi: VSI structure of representee
  108. * @mac: representee MAC
  109. *
  110. * Return: 0 on success, non-zero on error.
  111. */
  112. int ice_eswitch_cfg_vsi(struct ice_vsi *vsi, const u8 *mac)
  113. {
  114. int err;
  115. ice_remove_vsi_fltr(&vsi->back->hw, vsi->idx);
  116. err = ice_vsi_update_security(vsi, ice_vsi_ctx_clear_antispoof);
  117. if (err)
  118. goto err_update_security;
  119. err = ice_vsi_add_vlan_zero(vsi);
  120. if (err)
  121. goto err_vlan_zero;
  122. return 0;
  123. err_vlan_zero:
  124. ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof);
  125. err_update_security:
  126. ice_fltr_add_mac_and_broadcast(vsi, mac, ICE_FWD_TO_VSI);
  127. return err;
  128. }
  129. /**
  130. * ice_eswitch_decfg_vsi - unroll changes done to VSI for switchdev
  131. * @vsi: VSI structure of representee
  132. * @mac: representee MAC
  133. */
  134. void ice_eswitch_decfg_vsi(struct ice_vsi *vsi, const u8 *mac)
  135. {
  136. ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof);
  137. ice_fltr_add_mac_and_broadcast(vsi, mac, ICE_FWD_TO_VSI);
  138. }
  139. /**
  140. * ice_eswitch_update_repr - reconfigure port representor
  141. * @repr_id: representor ID
  142. * @vsi: VSI for which port representor is configured
  143. */
  144. void ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi)
  145. {
  146. struct ice_pf *pf = vsi->back;
  147. struct ice_repr *repr;
  148. int err;
  149. if (!ice_is_switchdev_running(pf))
  150. return;
  151. repr = xa_load(&pf->eswitch.reprs, *repr_id);
  152. if (!repr)
  153. return;
  154. repr->src_vsi = vsi;
  155. repr->dst->u.port_info.port_id = vsi->vsi_num;
  156. if (repr->br_port)
  157. repr->br_port->vsi = vsi;
  158. err = ice_eswitch_cfg_vsi(vsi, repr->parent_mac);
  159. if (err)
  160. dev_err(ice_pf_to_dev(pf), "Failed to update VSI of port representor %d",
  161. repr->id);
  162. /* The VSI number is different, reload the PR with new id */
  163. if (repr->id != vsi->vsi_num) {
  164. xa_erase(&pf->eswitch.reprs, repr->id);
  165. repr->id = vsi->vsi_num;
  166. if (xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL))
  167. dev_err(ice_pf_to_dev(pf), "Failed to reload port representor %d",
  168. repr->id);
  169. *repr_id = repr->id;
  170. }
  171. }
  172. /**
  173. * ice_eswitch_port_start_xmit - callback for packets transmit
  174. * @skb: send buffer
  175. * @netdev: network interface device structure
  176. *
  177. * Returns NETDEV_TX_OK if sent, else an error code
  178. */
  179. netdev_tx_t
  180. ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
  181. {
  182. struct ice_repr *repr = ice_netdev_to_repr(netdev);
  183. unsigned int len = skb->len;
  184. int ret;
  185. skb_dst_drop(skb);
  186. dst_hold((struct dst_entry *)repr->dst);
  187. skb_dst_set(skb, (struct dst_entry *)repr->dst);
  188. skb->dev = repr->dst->u.port_info.lower_dev;
  189. ret = dev_queue_xmit(skb);
  190. ice_repr_inc_tx_stats(repr, len, ret);
  191. return ret;
  192. }
  193. /**
  194. * ice_eswitch_set_target_vsi - set eswitch context in Tx context descriptor
  195. * @skb: pointer to send buffer
  196. * @off: pointer to offload struct
  197. */
  198. void
  199. ice_eswitch_set_target_vsi(struct sk_buff *skb,
  200. struct ice_tx_offload_params *off)
  201. {
  202. struct metadata_dst *dst = skb_metadata_dst(skb);
  203. u64 cd_cmd, dst_vsi;
  204. if (!dst) {
  205. cd_cmd = ICE_TX_CTX_DESC_SWTCH_UPLINK << ICE_TXD_CTX_QW1_CMD_S;
  206. off->cd_qw1 |= (cd_cmd | ICE_TX_DESC_DTYPE_CTX);
  207. } else {
  208. cd_cmd = ICE_TX_CTX_DESC_SWTCH_VSI << ICE_TXD_CTX_QW1_CMD_S;
  209. dst_vsi = FIELD_PREP(ICE_TXD_CTX_QW1_VSI_M,
  210. dst->u.port_info.port_id);
  211. off->cd_qw1 = cd_cmd | dst_vsi | ICE_TX_DESC_DTYPE_CTX;
  212. }
  213. }
  214. /**
  215. * ice_eswitch_release_env - clear eswitch HW filters
  216. * @pf: pointer to PF struct
  217. *
  218. * This function removes HW filters configuration specific for switchdev
  219. * mode and restores default legacy mode settings.
  220. */
  221. static void ice_eswitch_release_env(struct ice_pf *pf)
  222. {
  223. struct ice_vsi *uplink_vsi = pf->eswitch.uplink_vsi;
  224. struct ice_vsi_vlan_ops *vlan_ops;
  225. vlan_ops = ice_get_compat_vsi_vlan_ops(uplink_vsi);
  226. ice_vsi_update_local_lb(uplink_vsi, false);
  227. vlan_ops->ena_rx_filtering(uplink_vsi);
  228. ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false,
  229. ICE_FLTR_TX);
  230. ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false,
  231. ICE_FLTR_RX);
  232. ice_fltr_add_mac_and_broadcast(uplink_vsi,
  233. uplink_vsi->port_info->mac.perm_addr,
  234. ICE_FWD_TO_VSI);
  235. }
  236. /**
  237. * ice_eswitch_enable_switchdev - configure eswitch in switchdev mode
  238. * @pf: pointer to PF structure
  239. */
  240. static int ice_eswitch_enable_switchdev(struct ice_pf *pf)
  241. {
  242. struct ice_vsi *uplink_vsi;
  243. uplink_vsi = ice_get_main_vsi(pf);
  244. if (!uplink_vsi)
  245. return -ENODEV;
  246. if (netif_is_any_bridge_port(uplink_vsi->netdev)) {
  247. dev_err(ice_pf_to_dev(pf),
  248. "Uplink port cannot be a bridge port\n");
  249. return -EINVAL;
  250. }
  251. pf->eswitch.uplink_vsi = uplink_vsi;
  252. if (ice_eswitch_setup_env(pf))
  253. return -ENODEV;
  254. if (ice_eswitch_br_offloads_init(pf))
  255. goto err_br_offloads;
  256. pf->eswitch.is_running = true;
  257. return 0;
  258. err_br_offloads:
  259. ice_eswitch_release_env(pf);
  260. return -ENODEV;
  261. }
  262. /**
  263. * ice_eswitch_disable_switchdev - disable eswitch resources
  264. * @pf: pointer to PF structure
  265. */
  266. static void ice_eswitch_disable_switchdev(struct ice_pf *pf)
  267. {
  268. ice_eswitch_br_offloads_deinit(pf);
  269. ice_eswitch_release_env(pf);
  270. pf->eswitch.is_running = false;
  271. }
  272. /**
  273. * ice_eswitch_mode_set - set new eswitch mode
  274. * @devlink: pointer to devlink structure
  275. * @mode: eswitch mode to switch to
  276. * @extack: pointer to extack structure
  277. */
  278. int
  279. ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
  280. struct netlink_ext_ack *extack)
  281. {
  282. struct ice_pf *pf = devlink_priv(devlink);
  283. if (pf->eswitch_mode == mode)
  284. return 0;
  285. if (ice_has_vfs(pf)) {
  286. dev_info(ice_pf_to_dev(pf), "Changing eswitch mode is allowed only if there is no VFs created");
  287. NL_SET_ERR_MSG_MOD(extack, "Changing eswitch mode is allowed only if there is no VFs created");
  288. return -EOPNOTSUPP;
  289. }
  290. switch (mode) {
  291. case DEVLINK_ESWITCH_MODE_LEGACY:
  292. dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to legacy",
  293. pf->hw.pf_id);
  294. xa_destroy(&pf->eswitch.reprs);
  295. NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to legacy");
  296. break;
  297. case DEVLINK_ESWITCH_MODE_SWITCHDEV:
  298. {
  299. if (ice_is_adq_active(pf)) {
  300. dev_err(ice_pf_to_dev(pf), "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs and try again, e.g. tc qdisc del dev $PF root");
  301. NL_SET_ERR_MSG_MOD(extack, "Couldn't change eswitch mode to switchdev - ADQ is active. Delete ADQ configs and try again, e.g. tc qdisc del dev $PF root");
  302. return -EOPNOTSUPP;
  303. }
  304. dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev",
  305. pf->hw.pf_id);
  306. xa_init(&pf->eswitch.reprs);
  307. NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to switchdev");
  308. break;
  309. }
  310. default:
  311. NL_SET_ERR_MSG_MOD(extack, "Unknown eswitch mode");
  312. return -EINVAL;
  313. }
  314. pf->eswitch_mode = mode;
  315. return 0;
  316. }
  317. /**
  318. * ice_eswitch_mode_get - get current eswitch mode
  319. * @devlink: pointer to devlink structure
  320. * @mode: output parameter for current eswitch mode
  321. */
  322. int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode)
  323. {
  324. struct ice_pf *pf = devlink_priv(devlink);
  325. *mode = pf->eswitch_mode;
  326. return 0;
  327. }
  328. /**
  329. * ice_is_eswitch_mode_switchdev - check if eswitch mode is set to switchdev
  330. * @pf: pointer to PF structure
  331. *
  332. * Returns true if eswitch mode is set to DEVLINK_ESWITCH_MODE_SWITCHDEV,
  333. * false otherwise.
  334. */
  335. bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)
  336. {
  337. return pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV;
  338. }
  339. /**
  340. * ice_eswitch_start_all_tx_queues - start Tx queues of all port representors
  341. * @pf: pointer to PF structure
  342. */
  343. static void ice_eswitch_start_all_tx_queues(struct ice_pf *pf)
  344. {
  345. struct ice_repr *repr;
  346. unsigned long id;
  347. if (test_bit(ICE_DOWN, pf->state))
  348. return;
  349. xa_for_each(&pf->eswitch.reprs, id, repr)
  350. ice_repr_start_tx_queues(repr);
  351. }
  352. /**
  353. * ice_eswitch_stop_all_tx_queues - stop Tx queues of all port representors
  354. * @pf: pointer to PF structure
  355. */
  356. void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf)
  357. {
  358. struct ice_repr *repr;
  359. unsigned long id;
  360. if (test_bit(ICE_DOWN, pf->state))
  361. return;
  362. xa_for_each(&pf->eswitch.reprs, id, repr)
  363. ice_repr_stop_tx_queues(repr);
  364. }
  365. static void ice_eswitch_stop_reprs(struct ice_pf *pf)
  366. {
  367. ice_eswitch_stop_all_tx_queues(pf);
  368. }
  369. static void ice_eswitch_start_reprs(struct ice_pf *pf)
  370. {
  371. ice_eswitch_start_all_tx_queues(pf);
  372. }
  373. static int
  374. ice_eswitch_attach(struct ice_pf *pf, struct ice_repr *repr, unsigned long *id)
  375. {
  376. int err;
  377. if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY)
  378. return 0;
  379. if (xa_empty(&pf->eswitch.reprs)) {
  380. err = ice_eswitch_enable_switchdev(pf);
  381. if (err)
  382. return err;
  383. }
  384. ice_eswitch_stop_reprs(pf);
  385. err = repr->ops.add(repr);
  386. if (err)
  387. goto err_create_repr;
  388. err = ice_eswitch_setup_repr(pf, repr);
  389. if (err)
  390. goto err_setup_repr;
  391. err = xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL);
  392. if (err)
  393. goto err_xa_alloc;
  394. *id = repr->id;
  395. ice_eswitch_start_reprs(pf);
  396. return 0;
  397. err_xa_alloc:
  398. ice_eswitch_release_repr(pf, repr);
  399. err_setup_repr:
  400. repr->ops.rem(repr);
  401. err_create_repr:
  402. if (xa_empty(&pf->eswitch.reprs))
  403. ice_eswitch_disable_switchdev(pf);
  404. ice_eswitch_start_reprs(pf);
  405. return err;
  406. }
  407. /**
  408. * ice_eswitch_attach_vf - attach VF to a eswitch
  409. * @pf: pointer to PF structure
  410. * @vf: pointer to VF structure to be attached
  411. *
  412. * During attaching port representor for VF is created.
  413. *
  414. * Return: zero on success or an error code on failure.
  415. */
  416. int ice_eswitch_attach_vf(struct ice_pf *pf, struct ice_vf *vf)
  417. {
  418. struct devlink *devlink = priv_to_devlink(pf);
  419. struct ice_repr *repr;
  420. int err;
  421. if (!ice_is_eswitch_mode_switchdev(pf))
  422. return 0;
  423. repr = ice_repr_create_vf(vf);
  424. if (IS_ERR(repr))
  425. return PTR_ERR(repr);
  426. devl_lock(devlink);
  427. err = ice_eswitch_attach(pf, repr, &vf->repr_id);
  428. if (err)
  429. ice_repr_destroy(repr);
  430. devl_unlock(devlink);
  431. return err;
  432. }
  433. /**
  434. * ice_eswitch_attach_sf - attach SF to a eswitch
  435. * @pf: pointer to PF structure
  436. * @sf: pointer to SF structure to be attached
  437. *
  438. * During attaching port representor for SF is created.
  439. *
  440. * Return: zero on success or an error code on failure.
  441. */
  442. int ice_eswitch_attach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf)
  443. {
  444. struct ice_repr *repr = ice_repr_create_sf(sf);
  445. int err;
  446. if (IS_ERR(repr))
  447. return PTR_ERR(repr);
  448. err = ice_eswitch_attach(pf, repr, &sf->repr_id);
  449. if (err)
  450. ice_repr_destroy(repr);
  451. return err;
  452. }
  453. static void ice_eswitch_detach(struct ice_pf *pf, struct ice_repr *repr)
  454. {
  455. ice_eswitch_stop_reprs(pf);
  456. repr->ops.rem(repr);
  457. xa_erase(&pf->eswitch.reprs, repr->id);
  458. if (xa_empty(&pf->eswitch.reprs))
  459. ice_eswitch_disable_switchdev(pf);
  460. ice_eswitch_release_repr(pf, repr);
  461. ice_repr_destroy(repr);
  462. if (xa_empty(&pf->eswitch.reprs)) {
  463. struct devlink *devlink = priv_to_devlink(pf);
  464. /* since all port representors are destroyed, there is
  465. * no point in keeping the nodes
  466. */
  467. ice_devlink_rate_clear_tx_topology(ice_get_main_vsi(pf));
  468. devl_rate_nodes_destroy(devlink);
  469. } else {
  470. ice_eswitch_start_reprs(pf);
  471. }
  472. }
  473. /**
  474. * ice_eswitch_detach_vf - detach VF from a eswitch
  475. * @pf: pointer to PF structure
  476. * @vf: pointer to VF structure to be detached
  477. */
  478. void ice_eswitch_detach_vf(struct ice_pf *pf, struct ice_vf *vf)
  479. {
  480. struct ice_repr *repr = xa_load(&pf->eswitch.reprs, vf->repr_id);
  481. struct devlink *devlink = priv_to_devlink(pf);
  482. if (!repr)
  483. return;
  484. devl_lock(devlink);
  485. ice_eswitch_detach(pf, repr);
  486. devl_unlock(devlink);
  487. }
  488. /**
  489. * ice_eswitch_detach_sf - detach SF from a eswitch
  490. * @pf: pointer to PF structure
  491. * @sf: pointer to SF structure to be detached
  492. */
  493. void ice_eswitch_detach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf)
  494. {
  495. struct ice_repr *repr = xa_load(&pf->eswitch.reprs, sf->repr_id);
  496. if (!repr)
  497. return;
  498. ice_eswitch_detach(pf, repr);
  499. }
  500. /**
  501. * ice_eswitch_get_target - get netdev based on src_vsi from descriptor
  502. * @rx_ring: ring used to receive the packet
  503. * @rx_desc: descriptor used to get src_vsi value
  504. *
  505. * Get src_vsi value from descriptor and load correct representor. If it isn't
  506. * found return rx_ring->netdev.
  507. */
  508. struct net_device *ice_eswitch_get_target(struct ice_rx_ring *rx_ring,
  509. union ice_32b_rx_flex_desc *rx_desc)
  510. {
  511. struct ice_eswitch *eswitch = &rx_ring->vsi->back->eswitch;
  512. struct ice_32b_rx_flex_desc_nic_2 *desc;
  513. struct ice_repr *repr;
  514. desc = (struct ice_32b_rx_flex_desc_nic_2 *)rx_desc;
  515. repr = xa_load(&eswitch->reprs, le16_to_cpu(desc->src_vsi));
  516. if (!repr)
  517. return rx_ring->netdev;
  518. return repr->netdev;
  519. }