171d10453SEric Joyner /* SPDX-License-Identifier: BSD-3-Clause */ 271d10453SEric Joyner /* Copyright (c) 2020, 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 /*$FreeBSD$*/ 3271d10453SEric Joyner 3371d10453SEric Joyner /** 3471d10453SEric Joyner * @file ice_features.h 3571d10453SEric Joyner * @brief device feature controls 3671d10453SEric Joyner * 3771d10453SEric Joyner * Contains a list of various device features which could be enabled or 3871d10453SEric Joyner * disabled. 3971d10453SEric Joyner */ 4071d10453SEric Joyner 4171d10453SEric Joyner #ifndef _ICE_FEATURES_H_ 4271d10453SEric Joyner #define _ICE_FEATURES_H_ 4371d10453SEric Joyner 4471d10453SEric Joyner /** 4571d10453SEric Joyner * @enum feat_list 4671d10453SEric Joyner * @brief driver feature enumeration 4771d10453SEric Joyner * 4871d10453SEric Joyner * Enumeration of possible device driver features that can be enabled or 4971d10453SEric Joyner * disabled. Each possible value represents a different feature which can be 5071d10453SEric Joyner * enabled or disabled. 5171d10453SEric Joyner * 5271d10453SEric Joyner * The driver stores a bitmap of the features that the device and OS are 5371d10453SEric Joyner * capable of, as well as another bitmap indicating which features are 5471d10453SEric Joyner * currently enabled for that device. 5571d10453SEric Joyner */ 5671d10453SEric Joyner enum feat_list { 5771d10453SEric Joyner ICE_FEATURE_SRIOV, 5871d10453SEric Joyner ICE_FEATURE_RSS, 5971d10453SEric Joyner ICE_FEATURE_NETMAP, 6071d10453SEric Joyner ICE_FEATURE_FDIR, 6171d10453SEric Joyner ICE_FEATURE_MSI, 6271d10453SEric Joyner ICE_FEATURE_MSIX, 6371d10453SEric Joyner ICE_FEATURE_RDMA, 6471d10453SEric Joyner ICE_FEATURE_SAFE_MODE, 6571d10453SEric Joyner ICE_FEATURE_LENIENT_LINK_MODE, 6671d10453SEric Joyner ICE_FEATURE_DEFAULT_OVERRIDE, 6771d10453SEric Joyner /* Must be last entry */ 6871d10453SEric Joyner ICE_FEATURE_COUNT 6971d10453SEric Joyner }; 7071d10453SEric Joyner 7171d10453SEric Joyner /** 7271d10453SEric Joyner * ice_disable_unsupported_features - Disable features not enabled by OS 7371d10453SEric Joyner * @bitmap: the feature bitmap 7471d10453SEric Joyner * 7571d10453SEric Joyner * Check for OS support of various driver features. Clear the feature bit for 7671d10453SEric Joyner * any feature which is not enabled by the OS. This should be called early 7771d10453SEric Joyner * during driver attach after setting up the feature bitmap. 7871d10453SEric Joyner * 7971d10453SEric Joyner * @remark the bitmap parameter is marked as unused in order to avoid an 8071d10453SEric Joyner * unused parameter warning in case none of the features need to be disabled. 8171d10453SEric Joyner */ 8271d10453SEric Joyner static inline void 8371d10453SEric Joyner ice_disable_unsupported_features(ice_bitmap_t __unused *bitmap) 8471d10453SEric Joyner { 8571d10453SEric Joyner ice_clear_bit(ICE_FEATURE_SRIOV, bitmap); 8671d10453SEric Joyner #ifndef DEV_NETMAP 8771d10453SEric Joyner ice_clear_bit(ICE_FEATURE_NETMAP, bitmap); 8871d10453SEric Joyner #endif 8971d10453SEric Joyner } 9071d10453SEric Joyner 9171d10453SEric Joyner #endif 92