tc_counters.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /****************************************************************************
  3. * Driver for Solarflare network controllers and boards
  4. * Copyright 2022 Advanced Micro Devices, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation, incorporated herein by reference.
  9. */
  10. #include "tc_counters.h"
  11. #include "tc_encap_actions.h"
  12. #include "mae_counter_format.h"
  13. #include "mae.h"
  14. #include "rx_common.h"
  15. /* Counter-management hashtables */
  16. static const struct rhashtable_params efx_tc_counter_id_ht_params = {
  17. .key_len = offsetof(struct efx_tc_counter_index, linkage),
  18. .key_offset = 0,
  19. .head_offset = offsetof(struct efx_tc_counter_index, linkage),
  20. };
  21. static const struct rhashtable_params efx_tc_counter_ht_params = {
  22. .key_len = offsetof(struct efx_tc_counter, linkage),
  23. .key_offset = 0,
  24. .head_offset = offsetof(struct efx_tc_counter, linkage),
  25. };
  26. static void efx_tc_counter_free(void *ptr, void *__unused)
  27. {
  28. struct efx_tc_counter *cnt = ptr;
  29. WARN_ON(!list_empty(&cnt->users));
  30. /* We'd like to synchronize_rcu() here, but unfortunately we aren't
  31. * removing the element from the hashtable (it's not clear that's a
  32. * safe thing to do in an rhashtable_free_and_destroy free_fn), so
  33. * threads could still be obtaining new pointers to *cnt if they can
  34. * race against this function at all.
  35. */
  36. flush_work(&cnt->work);
  37. EFX_WARN_ON_PARANOID(spin_is_locked(&cnt->lock));
  38. kfree(cnt);
  39. }
  40. static void efx_tc_counter_id_free(void *ptr, void *__unused)
  41. {
  42. struct efx_tc_counter_index *ctr = ptr;
  43. WARN_ON(refcount_read(&ctr->ref));
  44. kfree(ctr);
  45. }
  46. int efx_tc_init_counters(struct efx_nic *efx)
  47. {
  48. int rc;
  49. rc = rhashtable_init(&efx->tc->counter_id_ht, &efx_tc_counter_id_ht_params);
  50. if (rc < 0)
  51. goto fail_counter_id_ht;
  52. rc = rhashtable_init(&efx->tc->counter_ht, &efx_tc_counter_ht_params);
  53. if (rc < 0)
  54. goto fail_counter_ht;
  55. return 0;
  56. fail_counter_ht:
  57. rhashtable_destroy(&efx->tc->counter_id_ht);
  58. fail_counter_id_ht:
  59. return rc;
  60. }
  61. /* Only call this in init failure teardown.
  62. * Normal exit should fini instead as there may be entries in the table.
  63. */
  64. void efx_tc_destroy_counters(struct efx_nic *efx)
  65. {
  66. rhashtable_destroy(&efx->tc->counter_ht);
  67. rhashtable_destroy(&efx->tc->counter_id_ht);
  68. }
  69. void efx_tc_fini_counters(struct efx_nic *efx)
  70. {
  71. rhashtable_free_and_destroy(&efx->tc->counter_id_ht, efx_tc_counter_id_free, NULL);
  72. rhashtable_free_and_destroy(&efx->tc->counter_ht, efx_tc_counter_free, NULL);
  73. }
  74. static void efx_tc_counter_work(struct work_struct *work)
  75. {
  76. struct efx_tc_counter *cnt = container_of(work, struct efx_tc_counter, work);
  77. struct efx_tc_encap_action *encap;
  78. struct efx_tc_action_set *act;
  79. unsigned long touched;
  80. struct neighbour *n;
  81. spin_lock_bh(&cnt->lock);
  82. touched = READ_ONCE(cnt->touched);
  83. list_for_each_entry(act, &cnt->users, count_user) {
  84. encap = act->encap_md;
  85. if (!encap)
  86. continue;
  87. if (!encap->neigh) /* can't happen */
  88. continue;
  89. if (time_after_eq(encap->neigh->used, touched))
  90. continue;
  91. encap->neigh->used = touched;
  92. /* We have passed traffic using this ARP entry, so
  93. * indicate to the ARP cache that it's still active
  94. */
  95. if (encap->neigh->dst_ip)
  96. n = neigh_lookup(&arp_tbl, &encap->neigh->dst_ip,
  97. encap->neigh->egdev);
  98. else
  99. #if IS_ENABLED(CONFIG_IPV6)
  100. n = neigh_lookup(ipv6_stub->nd_tbl,
  101. &encap->neigh->dst_ip6,
  102. encap->neigh->egdev);
  103. #else
  104. n = NULL;
  105. #endif
  106. if (!n)
  107. continue;
  108. neigh_event_send(n, NULL);
  109. neigh_release(n);
  110. }
  111. spin_unlock_bh(&cnt->lock);
  112. }
  113. /* Counter allocation */
  114. struct efx_tc_counter *efx_tc_flower_allocate_counter(struct efx_nic *efx,
  115. int type)
  116. {
  117. struct efx_tc_counter *cnt;
  118. int rc, rc2;
  119. cnt = kzalloc_obj(*cnt, GFP_USER);
  120. if (!cnt)
  121. return ERR_PTR(-ENOMEM);
  122. spin_lock_init(&cnt->lock);
  123. INIT_WORK(&cnt->work, efx_tc_counter_work);
  124. cnt->touched = jiffies;
  125. cnt->type = type;
  126. rc = efx_mae_allocate_counter(efx, cnt);
  127. if (rc)
  128. goto fail1;
  129. INIT_LIST_HEAD(&cnt->users);
  130. rc = rhashtable_insert_fast(&efx->tc->counter_ht, &cnt->linkage,
  131. efx_tc_counter_ht_params);
  132. if (rc)
  133. goto fail2;
  134. return cnt;
  135. fail2:
  136. /* If we get here, it implies that we couldn't insert into the table,
  137. * which in turn probably means that the fw_id was already taken.
  138. * In that case, it's unclear whether we really 'own' the fw_id; but
  139. * the firmware seemed to think we did, so it's proper to free it.
  140. */
  141. rc2 = efx_mae_free_counter(efx, cnt);
  142. if (rc2)
  143. netif_warn(efx, hw, efx->net_dev,
  144. "Failed to free MAE counter %u, rc %d\n",
  145. cnt->fw_id, rc2);
  146. fail1:
  147. kfree(cnt);
  148. return ERR_PTR(rc > 0 ? -EIO : rc);
  149. }
  150. void efx_tc_flower_release_counter(struct efx_nic *efx,
  151. struct efx_tc_counter *cnt)
  152. {
  153. int rc;
  154. rhashtable_remove_fast(&efx->tc->counter_ht, &cnt->linkage,
  155. efx_tc_counter_ht_params);
  156. rc = efx_mae_free_counter(efx, cnt);
  157. if (rc)
  158. netif_warn(efx, hw, efx->net_dev,
  159. "Failed to free MAE counter %u, rc %d\n",
  160. cnt->fw_id, rc);
  161. WARN_ON(!list_empty(&cnt->users));
  162. /* This doesn't protect counter updates coming in arbitrarily long
  163. * after we deleted the counter. The RCU just ensures that we won't
  164. * free the counter while another thread has a pointer to it.
  165. * Ensuring we don't update the wrong counter if the ID gets re-used
  166. * is handled by the generation count.
  167. */
  168. synchronize_rcu();
  169. flush_work(&cnt->work);
  170. EFX_WARN_ON_PARANOID(spin_is_locked(&cnt->lock));
  171. kfree(cnt);
  172. }
  173. static struct efx_tc_counter *efx_tc_flower_find_counter_by_fw_id(
  174. struct efx_nic *efx, int type, u32 fw_id)
  175. {
  176. struct efx_tc_counter key = {};
  177. key.fw_id = fw_id;
  178. key.type = type;
  179. return rhashtable_lookup_fast(&efx->tc->counter_ht, &key,
  180. efx_tc_counter_ht_params);
  181. }
  182. /* TC cookie to counter mapping */
  183. void efx_tc_flower_put_counter_index(struct efx_nic *efx,
  184. struct efx_tc_counter_index *ctr)
  185. {
  186. if (!refcount_dec_and_test(&ctr->ref))
  187. return; /* still in use */
  188. rhashtable_remove_fast(&efx->tc->counter_id_ht, &ctr->linkage,
  189. efx_tc_counter_id_ht_params);
  190. efx_tc_flower_release_counter(efx, ctr->cnt);
  191. kfree(ctr);
  192. }
  193. struct efx_tc_counter_index *efx_tc_flower_get_counter_index(
  194. struct efx_nic *efx, unsigned long cookie,
  195. enum efx_tc_counter_type type)
  196. {
  197. struct efx_tc_counter_index *ctr, *old;
  198. struct efx_tc_counter *cnt;
  199. ctr = kzalloc_obj(*ctr, GFP_USER);
  200. if (!ctr)
  201. return ERR_PTR(-ENOMEM);
  202. ctr->cookie = cookie;
  203. old = rhashtable_lookup_get_insert_fast(&efx->tc->counter_id_ht,
  204. &ctr->linkage,
  205. efx_tc_counter_id_ht_params);
  206. if (old) {
  207. /* don't need our new entry */
  208. kfree(ctr);
  209. if (IS_ERR(old)) /* oh dear, it's actually an error */
  210. return ERR_CAST(old);
  211. if (!refcount_inc_not_zero(&old->ref))
  212. return ERR_PTR(-EAGAIN);
  213. /* existing entry found */
  214. ctr = old;
  215. } else {
  216. cnt = efx_tc_flower_allocate_counter(efx, type);
  217. if (IS_ERR(cnt)) {
  218. rhashtable_remove_fast(&efx->tc->counter_id_ht,
  219. &ctr->linkage,
  220. efx_tc_counter_id_ht_params);
  221. kfree(ctr);
  222. return ERR_CAST(cnt);
  223. }
  224. ctr->cnt = cnt;
  225. refcount_set(&ctr->ref, 1);
  226. }
  227. return ctr;
  228. }
  229. struct efx_tc_counter_index *efx_tc_flower_find_counter_index(
  230. struct efx_nic *efx, unsigned long cookie)
  231. {
  232. struct efx_tc_counter_index key = {};
  233. key.cookie = cookie;
  234. return rhashtable_lookup_fast(&efx->tc->counter_id_ht, &key,
  235. efx_tc_counter_id_ht_params);
  236. }
  237. /* TC Channel. Counter updates are delivered on this channel's RXQ. */
  238. static void efx_tc_handle_no_channel(struct efx_nic *efx)
  239. {
  240. netif_warn(efx, drv, efx->net_dev,
  241. "MAE counters require MSI-X and 1 additional interrupt vector.\n");
  242. }
  243. static int efx_tc_probe_channel(struct efx_channel *channel)
  244. {
  245. struct efx_rx_queue *rx_queue = &channel->rx_queue;
  246. channel->irq_moderation_us = 0;
  247. rx_queue->core_index = 0;
  248. INIT_WORK(&rx_queue->grant_work, efx_mae_counters_grant_credits);
  249. return 0;
  250. }
  251. static int efx_tc_start_channel(struct efx_channel *channel)
  252. {
  253. struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel);
  254. struct efx_nic *efx = channel->efx;
  255. return efx_mae_start_counters(efx, rx_queue);
  256. }
  257. static void efx_tc_stop_channel(struct efx_channel *channel)
  258. {
  259. struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel);
  260. struct efx_nic *efx = channel->efx;
  261. int rc;
  262. rc = efx_mae_stop_counters(efx, rx_queue);
  263. if (rc)
  264. netif_warn(efx, drv, efx->net_dev,
  265. "Failed to stop MAE counters streaming, rc=%d.\n",
  266. rc);
  267. rx_queue->grant_credits = false;
  268. flush_work(&rx_queue->grant_work);
  269. }
  270. static void efx_tc_remove_channel(struct efx_channel *channel)
  271. {
  272. }
  273. static void efx_tc_get_channel_name(struct efx_channel *channel,
  274. char *buf, size_t len)
  275. {
  276. snprintf(buf, len, "%s-mae", channel->efx->name);
  277. }
  278. static void efx_tc_counter_update(struct efx_nic *efx,
  279. enum efx_tc_counter_type counter_type,
  280. u32 counter_idx, u64 packets, u64 bytes,
  281. u32 mark)
  282. {
  283. struct efx_tc_counter *cnt;
  284. rcu_read_lock(); /* Protect against deletion of 'cnt' */
  285. cnt = efx_tc_flower_find_counter_by_fw_id(efx, counter_type, counter_idx);
  286. if (!cnt) {
  287. /* This can legitimately happen when a counter is removed,
  288. * with updates for the counter still in-flight; however this
  289. * should be an infrequent occurrence.
  290. */
  291. if (net_ratelimit())
  292. netif_dbg(efx, drv, efx->net_dev,
  293. "Got update for unwanted MAE counter %u type %u\n",
  294. counter_idx, counter_type);
  295. goto out;
  296. }
  297. spin_lock_bh(&cnt->lock);
  298. if ((s32)mark - (s32)cnt->gen < 0) {
  299. /* This counter update packet is from before the counter was
  300. * allocated; thus it must be for a previous counter with
  301. * the same ID that has since been freed, and it should be
  302. * ignored.
  303. */
  304. } else {
  305. /* Update latest seen generation count. This ensures that
  306. * even a long-lived counter won't start getting ignored if
  307. * the generation count wraps around, unless it somehow
  308. * manages to go 1<<31 generations without an update.
  309. */
  310. cnt->gen = mark;
  311. /* update counter values */
  312. cnt->packets += packets;
  313. cnt->bytes += bytes;
  314. cnt->touched = jiffies;
  315. }
  316. spin_unlock_bh(&cnt->lock);
  317. schedule_work(&cnt->work);
  318. out:
  319. rcu_read_unlock();
  320. }
  321. static void efx_tc_rx_version_1(struct efx_nic *efx, const u8 *data, u32 mark)
  322. {
  323. u16 n_counters, i;
  324. /* Header format:
  325. * + | 0 | 1 | 2 | 3 |
  326. * 0 |version | reserved |
  327. * 4 | seq_index | n_counters |
  328. */
  329. n_counters = le16_to_cpu(*(const __le16 *)(data + 6));
  330. /* Counter update entry format:
  331. * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f |
  332. * | counter_idx | packet_count | byte_count |
  333. */
  334. for (i = 0; i < n_counters; i++) {
  335. const void *entry = data + 8 + 16 * i;
  336. u64 packet_count, byte_count;
  337. u32 counter_idx;
  338. counter_idx = le32_to_cpu(*(const __le32 *)entry);
  339. packet_count = le32_to_cpu(*(const __le32 *)(entry + 4)) |
  340. ((u64)le16_to_cpu(*(const __le16 *)(entry + 8)) << 32);
  341. byte_count = le16_to_cpu(*(const __le16 *)(entry + 10)) |
  342. ((u64)le32_to_cpu(*(const __le32 *)(entry + 12)) << 16);
  343. efx_tc_counter_update(efx, EFX_TC_COUNTER_TYPE_AR, counter_idx,
  344. packet_count, byte_count, mark);
  345. }
  346. }
  347. #define TCV2_HDR_PTR(pkt, field) \
  348. ((void)BUILD_BUG_ON_ZERO(ERF_SC_PACKETISER_HEADER_##field##_LBN & 7), \
  349. (pkt) + ERF_SC_PACKETISER_HEADER_##field##_LBN / 8)
  350. #define TCV2_HDR_BYTE(pkt, field) \
  351. ((void)BUILD_BUG_ON_ZERO(ERF_SC_PACKETISER_HEADER_##field##_WIDTH != 8),\
  352. *TCV2_HDR_PTR(pkt, field))
  353. #define TCV2_HDR_WORD(pkt, field) \
  354. ((void)BUILD_BUG_ON_ZERO(ERF_SC_PACKETISER_HEADER_##field##_WIDTH != 16),\
  355. (void)BUILD_BUG_ON_ZERO(ERF_SC_PACKETISER_HEADER_##field##_LBN & 15), \
  356. *(__force const __le16 *)TCV2_HDR_PTR(pkt, field))
  357. #define TCV2_PKT_PTR(pkt, poff, i, field) \
  358. ((void)BUILD_BUG_ON_ZERO(ERF_SC_PACKETISER_PAYLOAD_##field##_LBN & 7), \
  359. (pkt) + ERF_SC_PACKETISER_PAYLOAD_##field##_LBN/8 + poff + \
  360. i * ER_RX_SL_PACKETISER_PAYLOAD_WORD_SIZE)
  361. /* Read a little-endian 48-bit field with 16-bit alignment */
  362. static u64 efx_tc_read48(const __le16 *field)
  363. {
  364. u64 out = 0;
  365. int i;
  366. for (i = 0; i < 3; i++)
  367. out |= (u64)le16_to_cpu(field[i]) << (i * 16);
  368. return out;
  369. }
  370. static enum efx_tc_counter_type efx_tc_rx_version_2(struct efx_nic *efx,
  371. const u8 *data, u32 mark)
  372. {
  373. u8 payload_offset, header_offset, ident;
  374. enum efx_tc_counter_type type;
  375. u16 n_counters, i;
  376. ident = TCV2_HDR_BYTE(data, IDENTIFIER);
  377. switch (ident) {
  378. case ERF_SC_PACKETISER_HEADER_IDENTIFIER_AR:
  379. type = EFX_TC_COUNTER_TYPE_AR;
  380. break;
  381. case ERF_SC_PACKETISER_HEADER_IDENTIFIER_CT:
  382. type = EFX_TC_COUNTER_TYPE_CT;
  383. break;
  384. case ERF_SC_PACKETISER_HEADER_IDENTIFIER_OR:
  385. type = EFX_TC_COUNTER_TYPE_OR;
  386. break;
  387. default:
  388. if (net_ratelimit())
  389. netif_err(efx, drv, efx->net_dev,
  390. "ignored v2 MAE counter packet (bad identifier %u"
  391. "), counters may be inaccurate\n", ident);
  392. return EFX_TC_COUNTER_TYPE_MAX;
  393. }
  394. header_offset = TCV2_HDR_BYTE(data, HEADER_OFFSET);
  395. /* mae_counter_format.h implies that this offset is fixed, since it
  396. * carries on with SOP-based LBNs for the fields in this header
  397. */
  398. if (header_offset != ERF_SC_PACKETISER_HEADER_HEADER_OFFSET_DEFAULT) {
  399. if (net_ratelimit())
  400. netif_err(efx, drv, efx->net_dev,
  401. "choked on v2 MAE counter packet (bad header_offset %u"
  402. "), counters may be inaccurate\n", header_offset);
  403. return EFX_TC_COUNTER_TYPE_MAX;
  404. }
  405. payload_offset = TCV2_HDR_BYTE(data, PAYLOAD_OFFSET);
  406. n_counters = le16_to_cpu(TCV2_HDR_WORD(data, COUNT));
  407. for (i = 0; i < n_counters; i++) {
  408. const void *counter_idx_p, *packet_count_p, *byte_count_p;
  409. u64 packet_count, byte_count;
  410. u32 counter_idx;
  411. /* 24-bit field with 32-bit alignment */
  412. counter_idx_p = TCV2_PKT_PTR(data, payload_offset, i, COUNTER_INDEX);
  413. BUILD_BUG_ON(ERF_SC_PACKETISER_PAYLOAD_COUNTER_INDEX_WIDTH != 24);
  414. BUILD_BUG_ON(ERF_SC_PACKETISER_PAYLOAD_COUNTER_INDEX_LBN & 31);
  415. counter_idx = le32_to_cpu(*(const __le32 *)counter_idx_p) & 0xffffff;
  416. /* 48-bit field with 16-bit alignment */
  417. packet_count_p = TCV2_PKT_PTR(data, payload_offset, i, PACKET_COUNT);
  418. BUILD_BUG_ON(ERF_SC_PACKETISER_PAYLOAD_PACKET_COUNT_WIDTH != 48);
  419. BUILD_BUG_ON(ERF_SC_PACKETISER_PAYLOAD_PACKET_COUNT_LBN & 15);
  420. packet_count = efx_tc_read48((const __le16 *)packet_count_p);
  421. /* 48-bit field with 16-bit alignment */
  422. byte_count_p = TCV2_PKT_PTR(data, payload_offset, i, BYTE_COUNT);
  423. BUILD_BUG_ON(ERF_SC_PACKETISER_PAYLOAD_BYTE_COUNT_WIDTH != 48);
  424. BUILD_BUG_ON(ERF_SC_PACKETISER_PAYLOAD_BYTE_COUNT_LBN & 15);
  425. byte_count = efx_tc_read48((const __le16 *)byte_count_p);
  426. if (type == EFX_TC_COUNTER_TYPE_CT) {
  427. /* CT counters are 1-bit saturating counters to update
  428. * the lastuse time in CT stats. A received CT counter
  429. * should have packet counter to 0 and only LSB bit on
  430. * in byte counter.
  431. */
  432. if (packet_count || byte_count != 1)
  433. netdev_warn_once(efx->net_dev,
  434. "CT counter with inconsistent state (%llu, %llu)\n",
  435. packet_count, byte_count);
  436. /* Do not increment the driver's byte counter */
  437. byte_count = 0;
  438. }
  439. efx_tc_counter_update(efx, type, counter_idx, packet_count,
  440. byte_count, mark);
  441. }
  442. return type;
  443. }
  444. /* We always swallow the packet, whether successful or not, since it's not
  445. * a network packet and shouldn't ever be forwarded to the stack.
  446. * @mark is the generation count for counter allocations.
  447. */
  448. static bool efx_tc_rx(struct efx_rx_queue *rx_queue, u32 mark)
  449. {
  450. struct efx_channel *channel = efx_rx_queue_channel(rx_queue);
  451. struct efx_rx_buffer *rx_buf = efx_rx_buffer(rx_queue,
  452. channel->rx_pkt_index);
  453. const u8 *data = efx_rx_buf_va(rx_buf);
  454. struct efx_nic *efx = rx_queue->efx;
  455. enum efx_tc_counter_type type;
  456. u8 version;
  457. /* version is always first byte of packet */
  458. version = *data;
  459. switch (version) {
  460. case 1:
  461. type = EFX_TC_COUNTER_TYPE_AR;
  462. efx_tc_rx_version_1(efx, data, mark);
  463. break;
  464. case ERF_SC_PACKETISER_HEADER_VERSION_VALUE: // 2
  465. type = efx_tc_rx_version_2(efx, data, mark);
  466. break;
  467. default:
  468. if (net_ratelimit())
  469. netif_err(efx, drv, efx->net_dev,
  470. "choked on MAE counter packet (bad version %u"
  471. "); counters may be inaccurate\n",
  472. version);
  473. goto out;
  474. }
  475. if (type < EFX_TC_COUNTER_TYPE_MAX) {
  476. /* Update seen_gen unconditionally, to avoid a missed wakeup if
  477. * we race with efx_mae_stop_counters().
  478. */
  479. efx->tc->seen_gen[type] = mark;
  480. if (efx->tc->flush_counters &&
  481. (s32)(efx->tc->flush_gen[type] - mark) <= 0)
  482. wake_up(&efx->tc->flush_wq);
  483. }
  484. out:
  485. efx_free_rx_buffers(rx_queue, rx_buf, 1);
  486. channel->rx_pkt_n_frags = 0;
  487. return true;
  488. }
  489. const struct efx_channel_type efx_tc_channel_type = {
  490. .handle_no_channel = efx_tc_handle_no_channel,
  491. .pre_probe = efx_tc_probe_channel,
  492. .start = efx_tc_start_channel,
  493. .stop = efx_tc_stop_channel,
  494. .post_remove = efx_tc_remove_channel,
  495. .get_name = efx_tc_get_channel_name,
  496. .receive_raw = efx_tc_rx,
  497. .keep_eventq = true,
  498. };