ena.h (38c7b96517ddb5ceffa38fdce8ab777e105d107e) ena.h (9a0f2079ca900f9f37806e341790e2f3ed4cb19f)
1/*-
2 * BSD LICENSE
3 *
4 * Copyright (c) 2015-2019 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

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

247
248 struct ena_com_buf bufs[ENA_PKT_MAX_BUFS];
249} __aligned(CACHE_LINE_SIZE);
250
251struct ena_rx_buffer {
252 struct mbuf *mbuf;
253 bus_dmamap_t map;
254 struct ena_com_buf ena_buf;
1/*-
2 * BSD LICENSE
3 *
4 * Copyright (c) 2015-2019 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

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

247
248 struct ena_com_buf bufs[ENA_PKT_MAX_BUFS];
249} __aligned(CACHE_LINE_SIZE);
250
251struct ena_rx_buffer {
252 struct mbuf *mbuf;
253 bus_dmamap_t map;
254 struct ena_com_buf ena_buf;
255#ifdef DEV_NETMAP
256 uint32_t netmap_buf_idx;
257#endif /* DEV_NETMAP */
255} __aligned(CACHE_LINE_SIZE);
256
257struct ena_stats_tx {
258 counter_u64_t cnt;
259 counter_u64_t bytes;
260 counter_u64_t prepare_ctx_err;
261 counter_u64_t dma_mapping_err;
262 counter_u64_t doorbells;

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

346 bool running;
347 };
348
349 /* How many packets are sent in one Tx loop, used for doorbells */
350 uint32_t acum_pkts;
351
352 /* Used for LLQ */
353 uint8_t *push_buf_intermediate_buf;
258} __aligned(CACHE_LINE_SIZE);
259
260struct ena_stats_tx {
261 counter_u64_t cnt;
262 counter_u64_t bytes;
263 counter_u64_t prepare_ctx_err;
264 counter_u64_t dma_mapping_err;
265 counter_u64_t doorbells;

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

349 bool running;
350 };
351
352 /* How many packets are sent in one Tx loop, used for doorbells */
353 uint32_t acum_pkts;
354
355 /* Used for LLQ */
356 uint8_t *push_buf_intermediate_buf;
357
358#ifdef DEV_NETMAP
359 bool initialized;
360#endif /* DEV_NETMAP */
354} __aligned(CACHE_LINE_SIZE);
355
356struct ena_stats_dev {
357 counter_u64_t wd_expired;
358 counter_u64_t interface_up;
359 counter_u64_t interface_down;
360 counter_u64_t admin_q_pause;
361};

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

465 return count;
466}
467
468int ena_up(struct ena_adapter *);
469void ena_down(struct ena_adapter *);
470int ena_restore_device(struct ena_adapter *);
471void ena_destroy_device(struct ena_adapter *, bool);
472int ena_refill_rx_bufs(struct ena_ring *, uint32_t);
361} __aligned(CACHE_LINE_SIZE);
362
363struct ena_stats_dev {
364 counter_u64_t wd_expired;
365 counter_u64_t interface_up;
366 counter_u64_t interface_down;
367 counter_u64_t admin_q_pause;
368};

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

472 return count;
473}
474
475int ena_up(struct ena_adapter *);
476void ena_down(struct ena_adapter *);
477int ena_restore_device(struct ena_adapter *);
478void ena_destroy_device(struct ena_adapter *, bool);
479int ena_refill_rx_bufs(struct ena_ring *, uint32_t);
480inline int validate_rx_req_id(struct ena_ring *, uint16_t);
473
481
482inline int
483validate_rx_req_id(struct ena_ring *rx_ring, uint16_t req_id)
484{
485 if (likely(req_id < rx_ring->ring_size))
486 return (0);
487
488 device_printf(rx_ring->adapter->pdev, "Invalid rx req_id: %hu\n",
489 req_id);
490 counter_u64_add(rx_ring->rx_stats.bad_req_id, 1);
491
492 /* Trigger device reset */
493 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, rx_ring->adapter))) {
494 rx_ring->adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID;
495 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, rx_ring->adapter);
496 }
497
498 return (EFAULT);
499}
500
474#endif /* !(ENA_H) */
501#endif /* !(ENA_H) */