nic.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. /****************************************************************************
  2. * Driver for Solarflare network controllers and boards
  3. * Copyright 2005-2006 Fen Systems Ltd.
  4. * Copyright 2006-2013 Solarflare Communications 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 <linux/bitops.h>
  11. #include <linux/delay.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/pci.h>
  14. #include <linux/module.h>
  15. #include <linux/seq_file.h>
  16. #include <linux/cpu_rmap.h>
  17. #include "net_driver.h"
  18. #include "bitfield.h"
  19. #include "efx.h"
  20. #include "nic.h"
  21. #include "farch_regs.h"
  22. #include "io.h"
  23. #include "workarounds.h"
  24. /**************************************************************************
  25. *
  26. * Generic buffer handling
  27. * These buffers are used for interrupt status, MAC stats, etc.
  28. *
  29. **************************************************************************/
  30. int ef4_nic_alloc_buffer(struct ef4_nic *efx, struct ef4_buffer *buffer,
  31. unsigned int len, gfp_t gfp_flags)
  32. {
  33. buffer->addr = dma_zalloc_coherent(&efx->pci_dev->dev, len,
  34. &buffer->dma_addr, gfp_flags);
  35. if (!buffer->addr)
  36. return -ENOMEM;
  37. buffer->len = len;
  38. return 0;
  39. }
  40. void ef4_nic_free_buffer(struct ef4_nic *efx, struct ef4_buffer *buffer)
  41. {
  42. if (buffer->addr) {
  43. dma_free_coherent(&efx->pci_dev->dev, buffer->len,
  44. buffer->addr, buffer->dma_addr);
  45. buffer->addr = NULL;
  46. }
  47. }
  48. /* Check whether an event is present in the eventq at the current
  49. * read pointer. Only useful for self-test.
  50. */
  51. bool ef4_nic_event_present(struct ef4_channel *channel)
  52. {
  53. return ef4_event_present(ef4_event(channel, channel->eventq_read_ptr));
  54. }
  55. void ef4_nic_event_test_start(struct ef4_channel *channel)
  56. {
  57. channel->event_test_cpu = -1;
  58. smp_wmb();
  59. channel->efx->type->ev_test_generate(channel);
  60. }
  61. int ef4_nic_irq_test_start(struct ef4_nic *efx)
  62. {
  63. efx->last_irq_cpu = -1;
  64. smp_wmb();
  65. return efx->type->irq_test_generate(efx);
  66. }
  67. /* Hook interrupt handler(s)
  68. * Try MSI and then legacy interrupts.
  69. */
  70. int ef4_nic_init_interrupt(struct ef4_nic *efx)
  71. {
  72. struct ef4_channel *channel;
  73. unsigned int n_irqs;
  74. int rc;
  75. if (!EF4_INT_MODE_USE_MSI(efx)) {
  76. rc = request_irq(efx->legacy_irq,
  77. efx->type->irq_handle_legacy, IRQF_SHARED,
  78. efx->name, efx);
  79. if (rc) {
  80. netif_err(efx, drv, efx->net_dev,
  81. "failed to hook legacy IRQ %d\n",
  82. efx->pci_dev->irq);
  83. goto fail1;
  84. }
  85. return 0;
  86. }
  87. #ifdef CONFIG_RFS_ACCEL
  88. if (efx->interrupt_mode == EF4_INT_MODE_MSIX) {
  89. efx->net_dev->rx_cpu_rmap =
  90. alloc_irq_cpu_rmap(efx->n_rx_channels);
  91. if (!efx->net_dev->rx_cpu_rmap) {
  92. rc = -ENOMEM;
  93. goto fail1;
  94. }
  95. }
  96. #endif
  97. /* Hook MSI or MSI-X interrupt */
  98. n_irqs = 0;
  99. ef4_for_each_channel(channel, efx) {
  100. rc = request_irq(channel->irq, efx->type->irq_handle_msi,
  101. IRQF_PROBE_SHARED, /* Not shared */
  102. efx->msi_context[channel->channel].name,
  103. &efx->msi_context[channel->channel]);
  104. if (rc) {
  105. netif_err(efx, drv, efx->net_dev,
  106. "failed to hook IRQ %d\n", channel->irq);
  107. goto fail2;
  108. }
  109. ++n_irqs;
  110. #ifdef CONFIG_RFS_ACCEL
  111. if (efx->interrupt_mode == EF4_INT_MODE_MSIX &&
  112. channel->channel < efx->n_rx_channels) {
  113. rc = irq_cpu_rmap_add(efx->net_dev->rx_cpu_rmap,
  114. channel->irq);
  115. if (rc)
  116. goto fail2;
  117. }
  118. #endif
  119. }
  120. return 0;
  121. fail2:
  122. #ifdef CONFIG_RFS_ACCEL
  123. free_irq_cpu_rmap(efx->net_dev->rx_cpu_rmap);
  124. efx->net_dev->rx_cpu_rmap = NULL;
  125. #endif
  126. ef4_for_each_channel(channel, efx) {
  127. if (n_irqs-- == 0)
  128. break;
  129. free_irq(channel->irq, &efx->msi_context[channel->channel]);
  130. }
  131. fail1:
  132. return rc;
  133. }
  134. void ef4_nic_fini_interrupt(struct ef4_nic *efx)
  135. {
  136. struct ef4_channel *channel;
  137. #ifdef CONFIG_RFS_ACCEL
  138. free_irq_cpu_rmap(efx->net_dev->rx_cpu_rmap);
  139. efx->net_dev->rx_cpu_rmap = NULL;
  140. #endif
  141. if (EF4_INT_MODE_USE_MSI(efx)) {
  142. /* Disable MSI/MSI-X interrupts */
  143. ef4_for_each_channel(channel, efx)
  144. free_irq(channel->irq,
  145. &efx->msi_context[channel->channel]);
  146. } else {
  147. /* Disable legacy interrupt */
  148. free_irq(efx->legacy_irq, efx);
  149. }
  150. }
  151. /* Register dump */
  152. #define REGISTER_REVISION_FA 1
  153. #define REGISTER_REVISION_FB 2
  154. #define REGISTER_REVISION_FC 3
  155. #define REGISTER_REVISION_FZ 3 /* last Falcon arch revision */
  156. #define REGISTER_REVISION_ED 4
  157. #define REGISTER_REVISION_EZ 4 /* latest EF10 revision */
  158. struct ef4_nic_reg {
  159. u32 offset:24;
  160. u32 min_revision:3, max_revision:3;
  161. };
  162. #define REGISTER(name, arch, min_rev, max_rev) { \
  163. arch ## R_ ## min_rev ## max_rev ## _ ## name, \
  164. REGISTER_REVISION_ ## arch ## min_rev, \
  165. REGISTER_REVISION_ ## arch ## max_rev \
  166. }
  167. #define REGISTER_AA(name) REGISTER(name, F, A, A)
  168. #define REGISTER_AB(name) REGISTER(name, F, A, B)
  169. #define REGISTER_AZ(name) REGISTER(name, F, A, Z)
  170. #define REGISTER_BB(name) REGISTER(name, F, B, B)
  171. #define REGISTER_BZ(name) REGISTER(name, F, B, Z)
  172. #define REGISTER_CZ(name) REGISTER(name, F, C, Z)
  173. static const struct ef4_nic_reg ef4_nic_regs[] = {
  174. REGISTER_AZ(ADR_REGION),
  175. REGISTER_AZ(INT_EN_KER),
  176. REGISTER_BZ(INT_EN_CHAR),
  177. REGISTER_AZ(INT_ADR_KER),
  178. REGISTER_BZ(INT_ADR_CHAR),
  179. /* INT_ACK_KER is WO */
  180. /* INT_ISR0 is RC */
  181. REGISTER_AZ(HW_INIT),
  182. REGISTER_CZ(USR_EV_CFG),
  183. REGISTER_AB(EE_SPI_HCMD),
  184. REGISTER_AB(EE_SPI_HADR),
  185. REGISTER_AB(EE_SPI_HDATA),
  186. REGISTER_AB(EE_BASE_PAGE),
  187. REGISTER_AB(EE_VPD_CFG0),
  188. /* EE_VPD_SW_CNTL and EE_VPD_SW_DATA are not used */
  189. /* PMBX_DBG_IADDR and PBMX_DBG_IDATA are indirect */
  190. /* PCIE_CORE_INDIRECT is indirect */
  191. REGISTER_AB(NIC_STAT),
  192. REGISTER_AB(GPIO_CTL),
  193. REGISTER_AB(GLB_CTL),
  194. /* FATAL_INTR_KER and FATAL_INTR_CHAR are partly RC */
  195. REGISTER_BZ(DP_CTRL),
  196. REGISTER_AZ(MEM_STAT),
  197. REGISTER_AZ(CS_DEBUG),
  198. REGISTER_AZ(ALTERA_BUILD),
  199. REGISTER_AZ(CSR_SPARE),
  200. REGISTER_AB(PCIE_SD_CTL0123),
  201. REGISTER_AB(PCIE_SD_CTL45),
  202. REGISTER_AB(PCIE_PCS_CTL_STAT),
  203. /* DEBUG_DATA_OUT is not used */
  204. /* DRV_EV is WO */
  205. REGISTER_AZ(EVQ_CTL),
  206. REGISTER_AZ(EVQ_CNT1),
  207. REGISTER_AZ(EVQ_CNT2),
  208. REGISTER_AZ(BUF_TBL_CFG),
  209. REGISTER_AZ(SRM_RX_DC_CFG),
  210. REGISTER_AZ(SRM_TX_DC_CFG),
  211. REGISTER_AZ(SRM_CFG),
  212. /* BUF_TBL_UPD is WO */
  213. REGISTER_AZ(SRM_UPD_EVQ),
  214. REGISTER_AZ(SRAM_PARITY),
  215. REGISTER_AZ(RX_CFG),
  216. REGISTER_BZ(RX_FILTER_CTL),
  217. /* RX_FLUSH_DESCQ is WO */
  218. REGISTER_AZ(RX_DC_CFG),
  219. REGISTER_AZ(RX_DC_PF_WM),
  220. REGISTER_BZ(RX_RSS_TKEY),
  221. /* RX_NODESC_DROP is RC */
  222. REGISTER_AA(RX_SELF_RST),
  223. /* RX_DEBUG, RX_PUSH_DROP are not used */
  224. REGISTER_CZ(RX_RSS_IPV6_REG1),
  225. REGISTER_CZ(RX_RSS_IPV6_REG2),
  226. REGISTER_CZ(RX_RSS_IPV6_REG3),
  227. /* TX_FLUSH_DESCQ is WO */
  228. REGISTER_AZ(TX_DC_CFG),
  229. REGISTER_AA(TX_CHKSM_CFG),
  230. REGISTER_AZ(TX_CFG),
  231. /* TX_PUSH_DROP is not used */
  232. REGISTER_AZ(TX_RESERVED),
  233. REGISTER_BZ(TX_PACE),
  234. /* TX_PACE_DROP_QID is RC */
  235. REGISTER_BB(TX_VLAN),
  236. REGISTER_BZ(TX_IPFIL_PORTEN),
  237. REGISTER_AB(MD_TXD),
  238. REGISTER_AB(MD_RXD),
  239. REGISTER_AB(MD_CS),
  240. REGISTER_AB(MD_PHY_ADR),
  241. REGISTER_AB(MD_ID),
  242. /* MD_STAT is RC */
  243. REGISTER_AB(MAC_STAT_DMA),
  244. REGISTER_AB(MAC_CTRL),
  245. REGISTER_BB(GEN_MODE),
  246. REGISTER_AB(MAC_MC_HASH_REG0),
  247. REGISTER_AB(MAC_MC_HASH_REG1),
  248. REGISTER_AB(GM_CFG1),
  249. REGISTER_AB(GM_CFG2),
  250. /* GM_IPG and GM_HD are not used */
  251. REGISTER_AB(GM_MAX_FLEN),
  252. /* GM_TEST is not used */
  253. REGISTER_AB(GM_ADR1),
  254. REGISTER_AB(GM_ADR2),
  255. REGISTER_AB(GMF_CFG0),
  256. REGISTER_AB(GMF_CFG1),
  257. REGISTER_AB(GMF_CFG2),
  258. REGISTER_AB(GMF_CFG3),
  259. REGISTER_AB(GMF_CFG4),
  260. REGISTER_AB(GMF_CFG5),
  261. REGISTER_BB(TX_SRC_MAC_CTL),
  262. REGISTER_AB(XM_ADR_LO),
  263. REGISTER_AB(XM_ADR_HI),
  264. REGISTER_AB(XM_GLB_CFG),
  265. REGISTER_AB(XM_TX_CFG),
  266. REGISTER_AB(XM_RX_CFG),
  267. REGISTER_AB(XM_MGT_INT_MASK),
  268. REGISTER_AB(XM_FC),
  269. REGISTER_AB(XM_PAUSE_TIME),
  270. REGISTER_AB(XM_TX_PARAM),
  271. REGISTER_AB(XM_RX_PARAM),
  272. /* XM_MGT_INT_MSK (note no 'A') is RC */
  273. REGISTER_AB(XX_PWR_RST),
  274. REGISTER_AB(XX_SD_CTL),
  275. REGISTER_AB(XX_TXDRV_CTL),
  276. /* XX_PRBS_CTL, XX_PRBS_CHK and XX_PRBS_ERR are not used */
  277. /* XX_CORE_STAT is partly RC */
  278. };
  279. struct ef4_nic_reg_table {
  280. u32 offset:24;
  281. u32 min_revision:3, max_revision:3;
  282. u32 step:6, rows:21;
  283. };
  284. #define REGISTER_TABLE_DIMENSIONS(_, offset, arch, min_rev, max_rev, step, rows) { \
  285. offset, \
  286. REGISTER_REVISION_ ## arch ## min_rev, \
  287. REGISTER_REVISION_ ## arch ## max_rev, \
  288. step, rows \
  289. }
  290. #define REGISTER_TABLE(name, arch, min_rev, max_rev) \
  291. REGISTER_TABLE_DIMENSIONS( \
  292. name, arch ## R_ ## min_rev ## max_rev ## _ ## name, \
  293. arch, min_rev, max_rev, \
  294. arch ## R_ ## min_rev ## max_rev ## _ ## name ## _STEP, \
  295. arch ## R_ ## min_rev ## max_rev ## _ ## name ## _ROWS)
  296. #define REGISTER_TABLE_AA(name) REGISTER_TABLE(name, F, A, A)
  297. #define REGISTER_TABLE_AZ(name) REGISTER_TABLE(name, F, A, Z)
  298. #define REGISTER_TABLE_BB(name) REGISTER_TABLE(name, F, B, B)
  299. #define REGISTER_TABLE_BZ(name) REGISTER_TABLE(name, F, B, Z)
  300. #define REGISTER_TABLE_BB_CZ(name) \
  301. REGISTER_TABLE_DIMENSIONS(name, FR_BZ_ ## name, F, B, B, \
  302. FR_BZ_ ## name ## _STEP, \
  303. FR_BB_ ## name ## _ROWS), \
  304. REGISTER_TABLE_DIMENSIONS(name, FR_BZ_ ## name, F, C, Z, \
  305. FR_BZ_ ## name ## _STEP, \
  306. FR_CZ_ ## name ## _ROWS)
  307. #define REGISTER_TABLE_CZ(name) REGISTER_TABLE(name, F, C, Z)
  308. static const struct ef4_nic_reg_table ef4_nic_reg_tables[] = {
  309. /* DRIVER is not used */
  310. /* EVQ_RPTR, TIMER_COMMAND, USR_EV and {RX,TX}_DESC_UPD are WO */
  311. REGISTER_TABLE_BB(TX_IPFIL_TBL),
  312. REGISTER_TABLE_BB(TX_SRC_MAC_TBL),
  313. REGISTER_TABLE_AA(RX_DESC_PTR_TBL_KER),
  314. REGISTER_TABLE_BB_CZ(RX_DESC_PTR_TBL),
  315. REGISTER_TABLE_AA(TX_DESC_PTR_TBL_KER),
  316. REGISTER_TABLE_BB_CZ(TX_DESC_PTR_TBL),
  317. REGISTER_TABLE_AA(EVQ_PTR_TBL_KER),
  318. REGISTER_TABLE_BB_CZ(EVQ_PTR_TBL),
  319. /* We can't reasonably read all of the buffer table (up to 8MB!).
  320. * However this driver will only use a few entries. Reading
  321. * 1K entries allows for some expansion of queue count and
  322. * size before we need to change the version. */
  323. REGISTER_TABLE_DIMENSIONS(BUF_FULL_TBL_KER, FR_AA_BUF_FULL_TBL_KER,
  324. F, A, A, 8, 1024),
  325. REGISTER_TABLE_DIMENSIONS(BUF_FULL_TBL, FR_BZ_BUF_FULL_TBL,
  326. F, B, Z, 8, 1024),
  327. REGISTER_TABLE_CZ(RX_MAC_FILTER_TBL0),
  328. REGISTER_TABLE_BB_CZ(TIMER_TBL),
  329. REGISTER_TABLE_BB_CZ(TX_PACE_TBL),
  330. REGISTER_TABLE_BZ(RX_INDIRECTION_TBL),
  331. /* TX_FILTER_TBL0 is huge and not used by this driver */
  332. REGISTER_TABLE_CZ(TX_MAC_FILTER_TBL0),
  333. REGISTER_TABLE_CZ(MC_TREG_SMEM),
  334. /* MSIX_PBA_TABLE is not mapped */
  335. /* SRM_DBG is not mapped (and is redundant with BUF_FLL_TBL) */
  336. REGISTER_TABLE_BZ(RX_FILTER_TBL0),
  337. };
  338. size_t ef4_nic_get_regs_len(struct ef4_nic *efx)
  339. {
  340. const struct ef4_nic_reg *reg;
  341. const struct ef4_nic_reg_table *table;
  342. size_t len = 0;
  343. for (reg = ef4_nic_regs;
  344. reg < ef4_nic_regs + ARRAY_SIZE(ef4_nic_regs);
  345. reg++)
  346. if (efx->type->revision >= reg->min_revision &&
  347. efx->type->revision <= reg->max_revision)
  348. len += sizeof(ef4_oword_t);
  349. for (table = ef4_nic_reg_tables;
  350. table < ef4_nic_reg_tables + ARRAY_SIZE(ef4_nic_reg_tables);
  351. table++)
  352. if (efx->type->revision >= table->min_revision &&
  353. efx->type->revision <= table->max_revision)
  354. len += table->rows * min_t(size_t, table->step, 16);
  355. return len;
  356. }
  357. void ef4_nic_get_regs(struct ef4_nic *efx, void *buf)
  358. {
  359. const struct ef4_nic_reg *reg;
  360. const struct ef4_nic_reg_table *table;
  361. for (reg = ef4_nic_regs;
  362. reg < ef4_nic_regs + ARRAY_SIZE(ef4_nic_regs);
  363. reg++) {
  364. if (efx->type->revision >= reg->min_revision &&
  365. efx->type->revision <= reg->max_revision) {
  366. ef4_reado(efx, (ef4_oword_t *)buf, reg->offset);
  367. buf += sizeof(ef4_oword_t);
  368. }
  369. }
  370. for (table = ef4_nic_reg_tables;
  371. table < ef4_nic_reg_tables + ARRAY_SIZE(ef4_nic_reg_tables);
  372. table++) {
  373. size_t size, i;
  374. if (!(efx->type->revision >= table->min_revision &&
  375. efx->type->revision <= table->max_revision))
  376. continue;
  377. size = min_t(size_t, table->step, 16);
  378. for (i = 0; i < table->rows; i++) {
  379. switch (table->step) {
  380. case 4: /* 32-bit SRAM */
  381. ef4_readd(efx, buf, table->offset + 4 * i);
  382. break;
  383. case 8: /* 64-bit SRAM */
  384. ef4_sram_readq(efx,
  385. efx->membase + table->offset,
  386. buf, i);
  387. break;
  388. case 16: /* 128-bit-readable register */
  389. ef4_reado_table(efx, buf, table->offset, i);
  390. break;
  391. case 32: /* 128-bit register, interleaved */
  392. ef4_reado_table(efx, buf, table->offset, 2 * i);
  393. break;
  394. default:
  395. WARN_ON(1);
  396. return;
  397. }
  398. buf += size;
  399. }
  400. }
  401. }
  402. /**
  403. * ef4_nic_describe_stats - Describe supported statistics for ethtool
  404. * @desc: Array of &struct ef4_hw_stat_desc describing the statistics
  405. * @count: Length of the @desc array
  406. * @mask: Bitmask of which elements of @desc are enabled
  407. * @names: Buffer to copy names to, or %NULL. The names are copied
  408. * starting at intervals of %ETH_GSTRING_LEN bytes.
  409. *
  410. * Returns the number of visible statistics, i.e. the number of set
  411. * bits in the first @count bits of @mask for which a name is defined.
  412. */
  413. size_t ef4_nic_describe_stats(const struct ef4_hw_stat_desc *desc, size_t count,
  414. const unsigned long *mask, u8 *names)
  415. {
  416. size_t visible = 0;
  417. size_t index;
  418. for_each_set_bit(index, mask, count) {
  419. if (desc[index].name) {
  420. if (names) {
  421. strlcpy(names, desc[index].name,
  422. ETH_GSTRING_LEN);
  423. names += ETH_GSTRING_LEN;
  424. }
  425. ++visible;
  426. }
  427. }
  428. return visible;
  429. }
  430. /**
  431. * ef4_nic_update_stats - Convert statistics DMA buffer to array of u64
  432. * @desc: Array of &struct ef4_hw_stat_desc describing the DMA buffer
  433. * layout. DMA widths of 0, 16, 32 and 64 are supported; where
  434. * the width is specified as 0 the corresponding element of
  435. * @stats is not updated.
  436. * @count: Length of the @desc array
  437. * @mask: Bitmask of which elements of @desc are enabled
  438. * @stats: Buffer to update with the converted statistics. The length
  439. * of this array must be at least @count.
  440. * @dma_buf: DMA buffer containing hardware statistics
  441. * @accumulate: If set, the converted values will be added rather than
  442. * directly stored to the corresponding elements of @stats
  443. */
  444. void ef4_nic_update_stats(const struct ef4_hw_stat_desc *desc, size_t count,
  445. const unsigned long *mask,
  446. u64 *stats, const void *dma_buf, bool accumulate)
  447. {
  448. size_t index;
  449. for_each_set_bit(index, mask, count) {
  450. if (desc[index].dma_width) {
  451. const void *addr = dma_buf + desc[index].offset;
  452. u64 val;
  453. switch (desc[index].dma_width) {
  454. case 16:
  455. val = le16_to_cpup((__le16 *)addr);
  456. break;
  457. case 32:
  458. val = le32_to_cpup((__le32 *)addr);
  459. break;
  460. case 64:
  461. val = le64_to_cpup((__le64 *)addr);
  462. break;
  463. default:
  464. WARN_ON(1);
  465. val = 0;
  466. break;
  467. }
  468. if (accumulate)
  469. stats[index] += val;
  470. else
  471. stats[index] = val;
  472. }
  473. }
  474. }
  475. void ef4_nic_fix_nodesc_drop_stat(struct ef4_nic *efx, u64 *rx_nodesc_drops)
  476. {
  477. /* if down, or this is the first update after coming up */
  478. if (!(efx->net_dev->flags & IFF_UP) || !efx->rx_nodesc_drops_prev_state)
  479. efx->rx_nodesc_drops_while_down +=
  480. *rx_nodesc_drops - efx->rx_nodesc_drops_total;
  481. efx->rx_nodesc_drops_total = *rx_nodesc_drops;
  482. efx->rx_nodesc_drops_prev_state = !!(efx->net_dev->flags & IFF_UP);
  483. *rx_nodesc_drops -= efx->rx_nodesc_drops_while_down;
  484. }