vnic_nic.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 2008 Cisco Systems, Inc. All rights reserved.
  3. * Copyright 2007 Nuova Systems, Inc. All rights reserved.
  4. *
  5. * This program is free software; you may redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; version 2 of the License.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  10. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  12. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  13. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  14. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  15. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  16. * SOFTWARE.
  17. */
  18. #ifndef _VNIC_NIC_H_
  19. #define _VNIC_NIC_H_
  20. /*
  21. * These defines avoid symbol clash between fnic and enic (Cisco 10G Eth
  22. * Driver) when both are built with CONFIG options =y
  23. */
  24. #define vnic_set_nic_cfg fnic_set_nic_cfg
  25. #define NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD 0xffUL
  26. #define NIC_CFG_RSS_DEFAULT_CPU_SHIFT 0
  27. #define NIC_CFG_RSS_HASH_TYPE (0xffUL << 8)
  28. #define NIC_CFG_RSS_HASH_TYPE_MASK_FIELD 0xffUL
  29. #define NIC_CFG_RSS_HASH_TYPE_SHIFT 8
  30. #define NIC_CFG_RSS_HASH_BITS (7UL << 16)
  31. #define NIC_CFG_RSS_HASH_BITS_MASK_FIELD 7UL
  32. #define NIC_CFG_RSS_HASH_BITS_SHIFT 16
  33. #define NIC_CFG_RSS_BASE_CPU (7UL << 19)
  34. #define NIC_CFG_RSS_BASE_CPU_MASK_FIELD 7UL
  35. #define NIC_CFG_RSS_BASE_CPU_SHIFT 19
  36. #define NIC_CFG_RSS_ENABLE (1UL << 22)
  37. #define NIC_CFG_RSS_ENABLE_MASK_FIELD 1UL
  38. #define NIC_CFG_RSS_ENABLE_SHIFT 22
  39. #define NIC_CFG_TSO_IPID_SPLIT_EN (1UL << 23)
  40. #define NIC_CFG_TSO_IPID_SPLIT_EN_MASK_FIELD 1UL
  41. #define NIC_CFG_TSO_IPID_SPLIT_EN_SHIFT 23
  42. #define NIC_CFG_IG_VLAN_STRIP_EN (1UL << 24)
  43. #define NIC_CFG_IG_VLAN_STRIP_EN_MASK_FIELD 1UL
  44. #define NIC_CFG_IG_VLAN_STRIP_EN_SHIFT 24
  45. static inline void vnic_set_nic_cfg(u32 *nic_cfg,
  46. u8 rss_default_cpu, u8 rss_hash_type,
  47. u8 rss_hash_bits, u8 rss_base_cpu,
  48. u8 rss_enable, u8 tso_ipid_split_en,
  49. u8 ig_vlan_strip_en)
  50. {
  51. *nic_cfg = (rss_default_cpu & NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD) |
  52. ((rss_hash_type & NIC_CFG_RSS_HASH_TYPE_MASK_FIELD)
  53. << NIC_CFG_RSS_HASH_TYPE_SHIFT) |
  54. ((rss_hash_bits & NIC_CFG_RSS_HASH_BITS_MASK_FIELD)
  55. << NIC_CFG_RSS_HASH_BITS_SHIFT) |
  56. ((rss_base_cpu & NIC_CFG_RSS_BASE_CPU_MASK_FIELD)
  57. << NIC_CFG_RSS_BASE_CPU_SHIFT) |
  58. ((rss_enable & NIC_CFG_RSS_ENABLE_MASK_FIELD)
  59. << NIC_CFG_RSS_ENABLE_SHIFT) |
  60. ((tso_ipid_split_en & NIC_CFG_TSO_IPID_SPLIT_EN_MASK_FIELD)
  61. << NIC_CFG_TSO_IPID_SPLIT_EN_SHIFT) |
  62. ((ig_vlan_strip_en & NIC_CFG_IG_VLAN_STRIP_EN_MASK_FIELD)
  63. << NIC_CFG_IG_VLAN_STRIP_EN_SHIFT);
  64. }
  65. #endif /* _VNIC_NIC_H_ */