ena.h (eb4c4f4a2e18659b67a6bf1ea5f473c7ed8c854f) ena.h (78554d0c707c9401dbae53fb8bc65d291a5a09a5)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
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

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

494
495#define ENA_LOCK_INIT() \
496 sx_init(&ena_global_lock, "ENA global lock")
497#define ENA_LOCK_DESTROY() sx_destroy(&ena_global_lock)
498#define ENA_LOCK_LOCK() sx_xlock(&ena_global_lock)
499#define ENA_LOCK_UNLOCK() sx_unlock(&ena_global_lock)
500#define ENA_LOCK_ASSERT() sx_assert(&ena_global_lock, SA_XLOCKED)
501
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
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

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

494
495#define ENA_LOCK_INIT() \
496 sx_init(&ena_global_lock, "ENA global lock")
497#define ENA_LOCK_DESTROY() sx_destroy(&ena_global_lock)
498#define ENA_LOCK_LOCK() sx_xlock(&ena_global_lock)
499#define ENA_LOCK_UNLOCK() sx_unlock(&ena_global_lock)
500#define ENA_LOCK_ASSERT() sx_assert(&ena_global_lock, SA_XLOCKED)
501
502#define ENA_TIMER_INIT(_adapter) \
503 callout_init(&(_adapter)->timer_service, true)
504#define ENA_TIMER_DRAIN(_adapter) \
505 callout_drain(&(_adapter)->timer_service)
506#define ENA_TIMER_RESET(_adapter) \
507 callout_reset_sbt(&(_adapter)->timer_service, SBT_1S, SBT_1S, \
508 ena_timer_service, (void*)(_adapter), 0)
509
502#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max)
503#define clamp_val(val, lo, hi) clamp_t(__typeof(val), val, lo, hi)
504
505extern struct sx ena_global_lock;
506
507static inline int ena_mbuf_count(struct mbuf *mbuf)
508{
509 int count = 1;

--- 29 unchanged lines hidden ---
510#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max)
511#define clamp_val(val, lo, hi) clamp_t(__typeof(val), val, lo, hi)
512
513extern struct sx ena_global_lock;
514
515static inline int ena_mbuf_count(struct mbuf *mbuf)
516{
517 int count = 1;

--- 29 unchanged lines hidden ---