18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2008 Cisco Systems, Inc. All rights reserved. 38c2ecf20Sopenharmony_ci * Copyright 2007 Nuova Systems, Inc. All rights reserved. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * This program is free software; you may redistribute it and/or modify 68c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by 78c2ecf20Sopenharmony_ci * the Free Software Foundation; version 2 of the License. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 108c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 118c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 128c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 138c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 148c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 158c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 168c2ecf20Sopenharmony_ci * SOFTWARE. 178c2ecf20Sopenharmony_ci */ 188c2ecf20Sopenharmony_ci#ifndef _VNIC_NIC_H_ 198c2ecf20Sopenharmony_ci#define _VNIC_NIC_H_ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* 228c2ecf20Sopenharmony_ci * These defines avoid symbol clash between fnic and enic (Cisco 10G Eth 238c2ecf20Sopenharmony_ci * Driver) when both are built with CONFIG options =y 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_ci#define vnic_set_nic_cfg fnic_set_nic_cfg 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD 0xffUL 288c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_DEFAULT_CPU_SHIFT 0 298c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE (0xffUL << 8) 308c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_MASK_FIELD 0xffUL 318c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_HASH_TYPE_SHIFT 8 328c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_HASH_BITS (7UL << 16) 338c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_HASH_BITS_MASK_FIELD 7UL 348c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_HASH_BITS_SHIFT 16 358c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_BASE_CPU (7UL << 19) 368c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_BASE_CPU_MASK_FIELD 7UL 378c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_BASE_CPU_SHIFT 19 388c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_ENABLE (1UL << 22) 398c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_ENABLE_MASK_FIELD 1UL 408c2ecf20Sopenharmony_ci#define NIC_CFG_RSS_ENABLE_SHIFT 22 418c2ecf20Sopenharmony_ci#define NIC_CFG_TSO_IPID_SPLIT_EN (1UL << 23) 428c2ecf20Sopenharmony_ci#define NIC_CFG_TSO_IPID_SPLIT_EN_MASK_FIELD 1UL 438c2ecf20Sopenharmony_ci#define NIC_CFG_TSO_IPID_SPLIT_EN_SHIFT 23 448c2ecf20Sopenharmony_ci#define NIC_CFG_IG_VLAN_STRIP_EN (1UL << 24) 458c2ecf20Sopenharmony_ci#define NIC_CFG_IG_VLAN_STRIP_EN_MASK_FIELD 1UL 468c2ecf20Sopenharmony_ci#define NIC_CFG_IG_VLAN_STRIP_EN_SHIFT 24 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_cistatic inline void vnic_set_nic_cfg(u32 *nic_cfg, 498c2ecf20Sopenharmony_ci u8 rss_default_cpu, u8 rss_hash_type, 508c2ecf20Sopenharmony_ci u8 rss_hash_bits, u8 rss_base_cpu, 518c2ecf20Sopenharmony_ci u8 rss_enable, u8 tso_ipid_split_en, 528c2ecf20Sopenharmony_ci u8 ig_vlan_strip_en) 538c2ecf20Sopenharmony_ci{ 548c2ecf20Sopenharmony_ci *nic_cfg = (rss_default_cpu & NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD) | 558c2ecf20Sopenharmony_ci ((rss_hash_type & NIC_CFG_RSS_HASH_TYPE_MASK_FIELD) 568c2ecf20Sopenharmony_ci << NIC_CFG_RSS_HASH_TYPE_SHIFT) | 578c2ecf20Sopenharmony_ci ((rss_hash_bits & NIC_CFG_RSS_HASH_BITS_MASK_FIELD) 588c2ecf20Sopenharmony_ci << NIC_CFG_RSS_HASH_BITS_SHIFT) | 598c2ecf20Sopenharmony_ci ((rss_base_cpu & NIC_CFG_RSS_BASE_CPU_MASK_FIELD) 608c2ecf20Sopenharmony_ci << NIC_CFG_RSS_BASE_CPU_SHIFT) | 618c2ecf20Sopenharmony_ci ((rss_enable & NIC_CFG_RSS_ENABLE_MASK_FIELD) 628c2ecf20Sopenharmony_ci << NIC_CFG_RSS_ENABLE_SHIFT) | 638c2ecf20Sopenharmony_ci ((tso_ipid_split_en & NIC_CFG_TSO_IPID_SPLIT_EN_MASK_FIELD) 648c2ecf20Sopenharmony_ci << NIC_CFG_TSO_IPID_SPLIT_EN_SHIFT) | 658c2ecf20Sopenharmony_ci ((ig_vlan_strip_en & NIC_CFG_IG_VLAN_STRIP_EN_MASK_FIELD) 668c2ecf20Sopenharmony_ci << NIC_CFG_IG_VLAN_STRIP_EN_SHIFT); 678c2ecf20Sopenharmony_ci} 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#endif /* _VNIC_NIC_H_ */ 70