171d10453SEric Joyner /* SPDX-License-Identifier: BSD-3-Clause */
2015f8cc5SEric Joyner /* Copyright (c) 2024, Intel Corporation
371d10453SEric Joyner * All rights reserved.
471d10453SEric Joyner *
571d10453SEric Joyner * Redistribution and use in source and binary forms, with or without
671d10453SEric Joyner * modification, are permitted provided that the following conditions are met:
771d10453SEric Joyner *
871d10453SEric Joyner * 1. Redistributions of source code must retain the above copyright notice,
971d10453SEric Joyner * this list of conditions and the following disclaimer.
1071d10453SEric Joyner *
1171d10453SEric Joyner * 2. Redistributions in binary form must reproduce the above copyright
1271d10453SEric Joyner * notice, this list of conditions and the following disclaimer in the
1371d10453SEric Joyner * documentation and/or other materials provided with the distribution.
1471d10453SEric Joyner *
1571d10453SEric Joyner * 3. Neither the name of the Intel Corporation nor the names of its
1671d10453SEric Joyner * contributors may be used to endorse or promote products derived from
1771d10453SEric Joyner * this software without specific prior written permission.
1871d10453SEric Joyner *
1971d10453SEric Joyner * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2071d10453SEric Joyner * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2171d10453SEric Joyner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2271d10453SEric Joyner * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2371d10453SEric Joyner * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2471d10453SEric Joyner * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2571d10453SEric Joyner * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2671d10453SEric Joyner * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2771d10453SEric Joyner * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2871d10453SEric Joyner * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2971d10453SEric Joyner * POSSIBILITY OF SUCH DAMAGE.
3071d10453SEric Joyner */
3171d10453SEric Joyner
3271d10453SEric Joyner /**
3371d10453SEric Joyner * @file ice_features.h
3471d10453SEric Joyner * @brief device feature controls
3571d10453SEric Joyner *
3671d10453SEric Joyner * Contains a list of various device features which could be enabled or
3771d10453SEric Joyner * disabled.
3871d10453SEric Joyner */
3971d10453SEric Joyner
4071d10453SEric Joyner #ifndef _ICE_FEATURES_H_
4171d10453SEric Joyner #define _ICE_FEATURES_H_
4271d10453SEric Joyner
4371d10453SEric Joyner /**
4471d10453SEric Joyner * @enum feat_list
4571d10453SEric Joyner * @brief driver feature enumeration
4671d10453SEric Joyner *
4771d10453SEric Joyner * Enumeration of possible device driver features that can be enabled or
4871d10453SEric Joyner * disabled. Each possible value represents a different feature which can be
4971d10453SEric Joyner * enabled or disabled.
5071d10453SEric Joyner *
5171d10453SEric Joyner * The driver stores a bitmap of the features that the device and OS are
5271d10453SEric Joyner * capable of, as well as another bitmap indicating which features are
5371d10453SEric Joyner * currently enabled for that device.
5471d10453SEric Joyner */
5571d10453SEric Joyner enum feat_list {
5671d10453SEric Joyner ICE_FEATURE_SRIOV,
5771d10453SEric Joyner ICE_FEATURE_RSS,
5871d10453SEric Joyner ICE_FEATURE_NETMAP,
5971d10453SEric Joyner ICE_FEATURE_FDIR,
6071d10453SEric Joyner ICE_FEATURE_MSI,
6171d10453SEric Joyner ICE_FEATURE_MSIX,
6271d10453SEric Joyner ICE_FEATURE_RDMA,
6371d10453SEric Joyner ICE_FEATURE_SAFE_MODE,
6471d10453SEric Joyner ICE_FEATURE_LENIENT_LINK_MODE,
659cf1841cSEric Joyner ICE_FEATURE_LINK_MGMT_VER_1,
669cf1841cSEric Joyner ICE_FEATURE_LINK_MGMT_VER_2,
679cf1841cSEric Joyner ICE_FEATURE_HEALTH_STATUS,
6856429daeSEric Joyner ICE_FEATURE_FW_LOGGING,
6956429daeSEric Joyner ICE_FEATURE_HAS_PBA,
708923de59SPiotr Kubaj ICE_FEATURE_DCB,
718923de59SPiotr Kubaj ICE_FEATURE_TX_BALANCE,
729c30461dSEric Joyner ICE_FEATURE_DUAL_NAC,
739c30461dSEric Joyner ICE_FEATURE_TEMP_SENSOR,
7471d10453SEric Joyner /* Must be last entry */
7571d10453SEric Joyner ICE_FEATURE_COUNT
7671d10453SEric Joyner };
7771d10453SEric Joyner
7871d10453SEric Joyner /**
7971d10453SEric Joyner * ice_disable_unsupported_features - Disable features not enabled by OS
8071d10453SEric Joyner * @bitmap: the feature bitmap
8171d10453SEric Joyner *
8271d10453SEric Joyner * Check for OS support of various driver features. Clear the feature bit for
8371d10453SEric Joyner * any feature which is not enabled by the OS. This should be called early
8471d10453SEric Joyner * during driver attach after setting up the feature bitmap.
8571d10453SEric Joyner *
8671d10453SEric Joyner * @remark the bitmap parameter is marked as unused in order to avoid an
8771d10453SEric Joyner * unused parameter warning in case none of the features need to be disabled.
8871d10453SEric Joyner */
8971d10453SEric Joyner static inline void
ice_disable_unsupported_features(ice_bitmap_t __unused * bitmap)9071d10453SEric Joyner ice_disable_unsupported_features(ice_bitmap_t __unused *bitmap)
9171d10453SEric Joyner {
9271d10453SEric Joyner #ifndef DEV_NETMAP
9371d10453SEric Joyner ice_clear_bit(ICE_FEATURE_NETMAP, bitmap);
9471d10453SEric Joyner #endif
9571d10453SEric Joyner }
9671d10453SEric Joyner
9771d10453SEric Joyner #endif
98