162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright 2008-2010 Cisco Systems, Inc. All rights reserved. 462306a36Sopenharmony_ci * Copyright 2007 Nuova Systems, Inc. All rights reserved. 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _VNIC_NIC_H_ 862306a36Sopenharmony_ci#define _VNIC_NIC_H_ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#define NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD 0xffUL 1162306a36Sopenharmony_ci#define NIC_CFG_RSS_DEFAULT_CPU_SHIFT 0 1262306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE (0xffUL << 8) 1362306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_MASK_FIELD 0xffUL 1462306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_SHIFT 8 1562306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_BITS (7UL << 16) 1662306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_BITS_MASK_FIELD 7UL 1762306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_BITS_SHIFT 16 1862306a36Sopenharmony_ci#define NIC_CFG_RSS_BASE_CPU (7UL << 19) 1962306a36Sopenharmony_ci#define NIC_CFG_RSS_BASE_CPU_MASK_FIELD 7UL 2062306a36Sopenharmony_ci#define NIC_CFG_RSS_BASE_CPU_SHIFT 19 2162306a36Sopenharmony_ci#define NIC_CFG_RSS_ENABLE (1UL << 22) 2262306a36Sopenharmony_ci#define NIC_CFG_RSS_ENABLE_MASK_FIELD 1UL 2362306a36Sopenharmony_ci#define NIC_CFG_RSS_ENABLE_SHIFT 22 2462306a36Sopenharmony_ci#define NIC_CFG_TSO_IPID_SPLIT_EN (1UL << 23) 2562306a36Sopenharmony_ci#define NIC_CFG_TSO_IPID_SPLIT_EN_MASK_FIELD 1UL 2662306a36Sopenharmony_ci#define NIC_CFG_TSO_IPID_SPLIT_EN_SHIFT 23 2762306a36Sopenharmony_ci#define NIC_CFG_IG_VLAN_STRIP_EN (1UL << 24) 2862306a36Sopenharmony_ci#define NIC_CFG_IG_VLAN_STRIP_EN_MASK_FIELD 1UL 2962306a36Sopenharmony_ci#define NIC_CFG_IG_VLAN_STRIP_EN_SHIFT 24 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_UDP_IPV4 (1 << 0) 3262306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_IPV4 (1 << 1) 3362306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_TCP_IPV4 (1 << 2) 3462306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_IPV6 (1 << 3) 3562306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_TCP_IPV6 (1 << 4) 3662306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_IPV6_EX (1 << 5) 3762306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_TCP_IPV6_EX (1 << 6) 3862306a36Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_UDP_IPV6 (1 << 7) 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_cistatic inline void vnic_set_nic_cfg(u32 *nic_cfg, 4162306a36Sopenharmony_ci u8 rss_default_cpu, u8 rss_hash_type, 4262306a36Sopenharmony_ci u8 rss_hash_bits, u8 rss_base_cpu, 4362306a36Sopenharmony_ci u8 rss_enable, u8 tso_ipid_split_en, 4462306a36Sopenharmony_ci u8 ig_vlan_strip_en) 4562306a36Sopenharmony_ci{ 4662306a36Sopenharmony_ci *nic_cfg = (rss_default_cpu & NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD) | 4762306a36Sopenharmony_ci ((rss_hash_type & NIC_CFG_RSS_HASH_TYPE_MASK_FIELD) 4862306a36Sopenharmony_ci << NIC_CFG_RSS_HASH_TYPE_SHIFT) | 4962306a36Sopenharmony_ci ((rss_hash_bits & NIC_CFG_RSS_HASH_BITS_MASK_FIELD) 5062306a36Sopenharmony_ci << NIC_CFG_RSS_HASH_BITS_SHIFT) | 5162306a36Sopenharmony_ci ((rss_base_cpu & NIC_CFG_RSS_BASE_CPU_MASK_FIELD) 5262306a36Sopenharmony_ci << NIC_CFG_RSS_BASE_CPU_SHIFT) | 5362306a36Sopenharmony_ci ((rss_enable & NIC_CFG_RSS_ENABLE_MASK_FIELD) 5462306a36Sopenharmony_ci << NIC_CFG_RSS_ENABLE_SHIFT) | 5562306a36Sopenharmony_ci ((tso_ipid_split_en & NIC_CFG_TSO_IPID_SPLIT_EN_MASK_FIELD) 5662306a36Sopenharmony_ci << NIC_CFG_TSO_IPID_SPLIT_EN_SHIFT) | 5762306a36Sopenharmony_ci ((ig_vlan_strip_en & NIC_CFG_IG_VLAN_STRIP_EN_MASK_FIELD) 5862306a36Sopenharmony_ci << NIC_CFG_IG_VLAN_STRIP_EN_SHIFT); 5962306a36Sopenharmony_ci} 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#endif /* _VNIC_NIC_H_ */ 62