ena.h (2287afd8180cb5f48c6a3ff6235e0b743b13353a) ena.h (9eb1615f33e9174fa5f1ca46954c35b3f026a98a)
1/*-
2 * BSD LICENSE
3 *
4 * Copyright (c) 2015-2020 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

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

509 enum ena_regs_reset_reason_types reset_reason)
510{
511 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
512 adapter->reset_reason = reset_reason;
513 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
514 }
515}
516
1/*-
2 * BSD LICENSE
3 *
4 * Copyright (c) 2015-2020 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

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

509 enum ena_regs_reset_reason_types reset_reason)
510{
511 if (likely(!ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter))) {
512 adapter->reset_reason = reset_reason;
513 ENA_FLAG_SET_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter);
514 }
515}
516
517static inline int
518validate_rx_req_id(struct ena_ring *rx_ring, uint16_t req_id)
519{
520 if (likely(req_id < rx_ring->ring_size))
521 return (0);
522
523 device_printf(rx_ring->adapter->pdev, "Invalid rx req_id: %hu\n",
524 req_id);
525 counter_u64_add(rx_ring->rx_stats.bad_req_id, 1);
526
527 /* Trigger device reset */
528 ena_trigger_reset(rx_ring->adapter, ENA_REGS_RESET_INV_RX_REQ_ID);
529
530 return (EFAULT);
531}
532
533#endif /* !(ENA_H) */
517#endif /* !(ENA_H) */