ena.h (637ff00f2f9bd6c8509d0e2ac8959c7a23f09650) ena.h (a33ec635d1f6d574d54e6f6d74766d070183be4c)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2015-2024 Amazon.com, Inc. or its affiliates.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 313 unchanged lines hidden (view full) ---

322 /* The maximum length the driver can push to the device (For LLQ) */
323 uint8_t tx_max_header_size;
324 /* The maximum (and default) mbuf size for the Rx descriptor. */
325 uint16_t rx_mbuf_sz;
326
327 };
328
329 uint8_t first_interrupt;
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2015-2024 Amazon.com, Inc. or its affiliates.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 313 unchanged lines hidden (view full) ---

322 /* The maximum length the driver can push to the device (For LLQ) */
323 uint8_t tx_max_header_size;
324 /* The maximum (and default) mbuf size for the Rx descriptor. */
325 uint16_t rx_mbuf_sz;
326
327 };
328
329 uint8_t first_interrupt;
330 uint8_t cleanup_running;
330 uint16_t no_interrupt_event_cnt;
331
332 struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS];
333
334 struct ena_que *que;
335 struct lro_ctrl lro;
336
337 uint16_t next_to_use;

--- 241 unchanged lines hidden (view full) ---

579
580 while ((mbuf = mbuf->m_next) != NULL)
581 ++count;
582
583 return count;
584}
585
586static inline void
331 uint16_t no_interrupt_event_cnt;
332
333 struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS];
334
335 struct ena_que *que;
336 struct lro_ctrl lro;
337
338 uint16_t next_to_use;

--- 241 unchanged lines hidden (view full) ---

580
581 while ((mbuf = mbuf->m_next) != NULL)
582 ++count;
583
584 return count;
585}
586
587static inline void
587ena_trigger_reset(struct ena_adapter *adapter,
588 enum ena_regs_reset_reason_types reset_reason)
588ena_increment_reset_counter(struct ena_adapter *adapter)
589{
589{
590 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
591 const struct ena_reset_stats_offset *ena_reset_stats_offset =
592 &resets_to_stats_offset_map[reset_reason];
590 enum ena_regs_reset_reason_types reset_reason = adapter->reset_reason;
591 const struct ena_reset_stats_offset *ena_reset_stats_offset =
592 &resets_to_stats_offset_map[reset_reason];
593
593
594 if (ena_reset_stats_offset->has_counter) {
595 uint64_t *stat_ptr = (uint64_t *)&adapter->dev_stats +
596 ena_reset_stats_offset->stat_offset;
594 if (ena_reset_stats_offset->has_counter) {
595 uint64_t *stat_ptr = (uint64_t *)&adapter->dev_stats +
596 ena_reset_stats_offset->stat_offset;
597
597
598 counter_u64_add((counter_u64_t)(*stat_ptr), 1);
599 }
598 counter_u64_add((counter_u64_t)(*stat_ptr), 1);
599 }
600
600
601 counter_u64_add(adapter->dev_stats.total_resets, 1);
601 counter_u64_add(adapter->dev_stats.total_resets, 1);
602}
603
604static inline void
605ena_trigger_reset(struct ena_adapter *adapter,
606 enum ena_regs_reset_reason_types reset_reason)
607{
608 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
602 adapter->reset_reason = reset_reason;
603 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
604 }
605}
606
607static inline void
608ena_ring_tx_doorbell(struct ena_ring *tx_ring)
609{
610 ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
611 counter_u64_add(tx_ring->tx_stats.doorbells, 1);
612 tx_ring->acum_pkts = 0;
613}
614
615#endif /* !(ENA_H) */
609 adapter->reset_reason = reset_reason;
610 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
611 }
612}
613
614static inline void
615ena_ring_tx_doorbell(struct ena_ring *tx_ring)
616{
617 ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
618 counter_u64_add(tx_ring->tx_stats.doorbells, 1);
619 tx_ring->acum_pkts = 0;
620}
621
622#endif /* !(ENA_H) */