aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxge/vxge-config.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/vxge/vxge-config.h')
-rw-r--r--drivers/net/vxge/vxge-config.h169
1 files changed, 105 insertions, 64 deletions
diff --git a/drivers/net/vxge/vxge-config.h b/drivers/net/vxge/vxge-config.h
index 5c00861b6c2c..e249e288d160 100644
--- a/drivers/net/vxge/vxge-config.h
+++ b/drivers/net/vxge/vxge-config.h
@@ -20,13 +20,6 @@
20#define VXGE_CACHE_LINE_SIZE 128 20#define VXGE_CACHE_LINE_SIZE 128
21#endif 21#endif
22 22
23#define vxge_os_vaprintf(level, mask, fmt, ...) { \
24 char buff[255]; \
25 snprintf(buff, 255, fmt, __VA_ARGS__); \
26 printk(buff); \
27 printk("\n"); \
28}
29
30#ifndef VXGE_ALIGN 23#ifndef VXGE_ALIGN
31#define VXGE_ALIGN(adrs, size) \ 24#define VXGE_ALIGN(adrs, size) \
32 (((size) - (((u64)adrs) & ((size)-1))) & ((size)-1)) 25 (((size) - (((u64)adrs) & ((size)-1))) & ((size)-1))
@@ -36,8 +29,16 @@
36#define VXGE_HW_MAX_MTU 9600 29#define VXGE_HW_MAX_MTU 9600
37#define VXGE_HW_DEFAULT_MTU 1500 30#define VXGE_HW_DEFAULT_MTU 1500
38 31
39#ifdef VXGE_DEBUG_ASSERT 32#define VXGE_HW_MAX_ROM_IMAGES 8
40 33
34struct eprom_image {
35 u8 is_valid:1;
36 u8 index;
37 u8 type;
38 u16 version;
39};
40
41#ifdef VXGE_DEBUG_ASSERT
41/** 42/**
42 * vxge_assert 43 * vxge_assert
43 * @test: C-condition to check 44 * @test: C-condition to check
@@ -48,16 +49,13 @@
48 * compilation 49 * compilation
49 * time. 50 * time.
50 */ 51 */
51#define vxge_assert(test) { \ 52#define vxge_assert(test) BUG_ON(!(test))
52 if (!(test)) \
53 vxge_os_bug("bad cond: "#test" at %s:%d\n", \
54 __FILE__, __LINE__); }
55#else 53#else
56#define vxge_assert(test) 54#define vxge_assert(test)
57#endif /* end of VXGE_DEBUG_ASSERT */ 55#endif /* end of VXGE_DEBUG_ASSERT */
58 56
59/** 57/**
60 * enum enum vxge_debug_level 58 * enum vxge_debug_level
61 * @VXGE_NONE: debug disabled 59 * @VXGE_NONE: debug disabled
62 * @VXGE_ERR: all errors going to be logged out 60 * @VXGE_ERR: all errors going to be logged out
63 * @VXGE_TRACE: all errors plus all kind of verbose tracing print outs 61 * @VXGE_TRACE: all errors plus all kind of verbose tracing print outs
@@ -159,6 +157,47 @@ enum vxge_hw_device_link_state {
159}; 157};
160 158
161/** 159/**
160 * enum enum vxge_hw_fw_upgrade_code - FW upgrade return codes.
161 * @VXGE_HW_FW_UPGRADE_OK: All OK send next 16 bytes
162 * @VXGE_HW_FW_UPGRADE_DONE: upload completed
163 * @VXGE_HW_FW_UPGRADE_ERR: upload error
164 * @VXGE_FW_UPGRADE_BYTES2SKIP: skip bytes in the stream
165 *
166 */
167enum vxge_hw_fw_upgrade_code {
168 VXGE_HW_FW_UPGRADE_OK = 0,
169 VXGE_HW_FW_UPGRADE_DONE = 1,
170 VXGE_HW_FW_UPGRADE_ERR = 2,
171 VXGE_FW_UPGRADE_BYTES2SKIP = 3
172};
173
174/**
175 * enum enum vxge_hw_fw_upgrade_err_code - FW upgrade error codes.
176 * @VXGE_HW_FW_UPGRADE_ERR_CORRUPT_DATA_1: corrupt data
177 * @VXGE_HW_FW_UPGRADE_ERR_BUFFER_OVERFLOW: buffer overflow
178 * @VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_3: invalid .ncf file
179 * @VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_4: invalid .ncf file
180 * @VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_5: invalid .ncf file
181 * @VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_6: invalid .ncf file
182 * @VXGE_HW_FW_UPGRADE_ERR_CORRUPT_DATA_7: corrupt data
183 * @VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_8: invalid .ncf file
184 * @VXGE_HW_FW_UPGRADE_ERR_GENERIC_ERROR_UNKNOWN: generic error unknown type
185 * @VXGE_HW_FW_UPGRADE_ERR_FAILED_TO_FLASH: failed to flash image check failed
186 */
187enum vxge_hw_fw_upgrade_err_code {
188 VXGE_HW_FW_UPGRADE_ERR_CORRUPT_DATA_1 = 1,
189 VXGE_HW_FW_UPGRADE_ERR_BUFFER_OVERFLOW = 2,
190 VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_3 = 3,
191 VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_4 = 4,
192 VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_5 = 5,
193 VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_6 = 6,
194 VXGE_HW_FW_UPGRADE_ERR_CORRUPT_DATA_7 = 7,
195 VXGE_HW_FW_UPGRADE_ERR_INV_NCF_FILE_8 = 8,
196 VXGE_HW_FW_UPGRADE_ERR_GENERIC_ERROR_UNKNOWN = 9,
197 VXGE_HW_FW_UPGRADE_ERR_FAILED_TO_FLASH = 10
198};
199
200/**
162 * struct vxge_hw_device_date - Date Format 201 * struct vxge_hw_device_date - Date Format
163 * @day: Day 202 * @day: Day
164 * @month: Month 203 * @month: Month
@@ -275,9 +314,9 @@ struct vxge_hw_ring_config {
275#define VXGE_HW_RING_DEFAULT 1 314#define VXGE_HW_RING_DEFAULT 1
276 315
277 u32 ring_blocks; 316 u32 ring_blocks;
278#define VXGE_HW_MIN_RING_BLOCKS 1 317#define VXGE_HW_MIN_RING_BLOCKS 1
279#define VXGE_HW_MAX_RING_BLOCKS 128 318#define VXGE_HW_MAX_RING_BLOCKS 128
280#define VXGE_HW_DEF_RING_BLOCKS 2 319#define VXGE_HW_DEF_RING_BLOCKS 2
281 320
282 u32 buffer_mode; 321 u32 buffer_mode;
283#define VXGE_HW_RING_RXD_BUFFER_MODE_1 1 322#define VXGE_HW_RING_RXD_BUFFER_MODE_1 1
@@ -465,7 +504,6 @@ struct vxge_hw_device_config {
465 * See also: vxge_hw_driver_initialize(). 504 * See also: vxge_hw_driver_initialize().
466 */ 505 */
467struct vxge_hw_uld_cbs { 506struct vxge_hw_uld_cbs {
468
469 void (*link_up)(struct __vxge_hw_device *devh); 507 void (*link_up)(struct __vxge_hw_device *devh);
470 void (*link_down)(struct __vxge_hw_device *devh); 508 void (*link_down)(struct __vxge_hw_device *devh);
471 void (*crit_err)(struct __vxge_hw_device *devh, 509 void (*crit_err)(struct __vxge_hw_device *devh,
@@ -652,6 +690,7 @@ struct __vxge_hw_virtualpath {
652 struct vxge_hw_vpath_stats_hw_info *hw_stats; 690 struct vxge_hw_vpath_stats_hw_info *hw_stats;
653 struct vxge_hw_vpath_stats_hw_info *hw_stats_sav; 691 struct vxge_hw_vpath_stats_hw_info *hw_stats_sav;
654 struct vxge_hw_vpath_stats_sw_info *sw_stats; 692 struct vxge_hw_vpath_stats_sw_info *sw_stats;
693 spinlock_t lock;
655}; 694};
656 695
657/* 696/*
@@ -661,7 +700,7 @@ struct __vxge_hw_virtualpath {
661 * 700 *
662 * This structure is used to store the callback information. 701 * This structure is used to store the callback information.
663 */ 702 */
664struct __vxge_hw_vpath_handle{ 703struct __vxge_hw_vpath_handle {
665 struct list_head item; 704 struct list_head item;
666 struct __vxge_hw_virtualpath *vpath; 705 struct __vxge_hw_virtualpath *vpath;
667}; 706};
@@ -674,9 +713,6 @@ struct __vxge_hw_vpath_handle{
674/** 713/**
675 * struct __vxge_hw_device - Hal device object 714 * struct __vxge_hw_device - Hal device object
676 * @magic: Magic Number 715 * @magic: Magic Number
677 * @device_id: PCI Device Id of the adapter
678 * @major_revision: PCI Device major revision
679 * @minor_revision: PCI Device minor revision
680 * @bar0: BAR0 virtual address. 716 * @bar0: BAR0 virtual address.
681 * @pdev: Physical device handle 717 * @pdev: Physical device handle
682 * @config: Confguration passed by the LL driver at initialization 718 * @config: Confguration passed by the LL driver at initialization
@@ -688,9 +724,6 @@ struct __vxge_hw_device {
688 u32 magic; 724 u32 magic;
689#define VXGE_HW_DEVICE_MAGIC 0x12345678 725#define VXGE_HW_DEVICE_MAGIC 0x12345678
690#define VXGE_HW_DEVICE_DEAD 0xDEADDEAD 726#define VXGE_HW_DEVICE_DEAD 0xDEADDEAD
691 u16 device_id;
692 u8 major_revision;
693 u8 minor_revision;
694 void __iomem *bar0; 727 void __iomem *bar0;
695 struct pci_dev *pdev; 728 struct pci_dev *pdev;
696 struct net_device *ndev; 729 struct net_device *ndev;
@@ -731,6 +764,7 @@ struct __vxge_hw_device {
731 u32 debug_level; 764 u32 debug_level;
732 u32 level_err; 765 u32 level_err;
733 u32 level_trace; 766 u32 level_trace;
767 u16 eprom_versions[VXGE_HW_MAX_ROM_IMAGES];
734}; 768};
735 769
736#define VXGE_HW_INFO_LEN 64 770#define VXGE_HW_INFO_LEN 64
@@ -781,8 +815,8 @@ struct vxge_hw_device_hw_info {
781 u8 serial_number[VXGE_HW_INFO_LEN]; 815 u8 serial_number[VXGE_HW_INFO_LEN];
782 u8 part_number[VXGE_HW_INFO_LEN]; 816 u8 part_number[VXGE_HW_INFO_LEN];
783 u8 product_desc[VXGE_HW_INFO_LEN]; 817 u8 product_desc[VXGE_HW_INFO_LEN];
784 u8 (mac_addrs)[VXGE_HW_MAX_VIRTUAL_PATHS][ETH_ALEN]; 818 u8 mac_addrs[VXGE_HW_MAX_VIRTUAL_PATHS][ETH_ALEN];
785 u8 (mac_addr_masks)[VXGE_HW_MAX_VIRTUAL_PATHS][ETH_ALEN]; 819 u8 mac_addr_masks[VXGE_HW_MAX_VIRTUAL_PATHS][ETH_ALEN];
786}; 820};
787 821
788/** 822/**
@@ -829,20 +863,10 @@ struct vxge_hw_device_attr {
829 loc, \ 863 loc, \
830 offset, \ 864 offset, \
831 &val64); \ 865 &val64); \
832 \
833 if (status != VXGE_HW_OK) \ 866 if (status != VXGE_HW_OK) \
834 return status; \ 867 return status; \
835} 868}
836 869
837#define VXGE_HW_VPATH_STATS_PIO_READ(offset) { \
838 status = __vxge_hw_vpath_stats_access(vpath, \
839 VXGE_HW_STATS_OP_READ, \
840 offset, \
841 &val64); \
842 if (status != VXGE_HW_OK) \
843 return status; \
844}
845
846/* 870/*
847 * struct __vxge_hw_ring - Ring channel. 871 * struct __vxge_hw_ring - Ring channel.
848 * @channel: Channel "base" of this ring, the common part of all HW 872 * @channel: Channel "base" of this ring, the common part of all HW
@@ -1114,7 +1138,7 @@ struct __vxge_hw_non_offload_db_wrapper {
1114 * lookup to determine the transmit port. 1138 * lookup to determine the transmit port.
1115 * 01: Send on physical Port1. 1139 * 01: Send on physical Port1.
1116 * 10: Send on physical Port0. 1140 * 10: Send on physical Port0.
1117 * 11: Send on both ports. 1141 * 11: Send on both ports.
1118 * Bits 18 to 21 - Reserved 1142 * Bits 18 to 21 - Reserved
1119 * Bits 22 to 23 - Gather_Code. This field is set by the host and 1143 * Bits 22 to 23 - Gather_Code. This field is set by the host and
1120 * is used to describe how individual buffers comprise a frame. 1144 * is used to describe how individual buffers comprise a frame.
@@ -1413,12 +1437,12 @@ enum vxge_hw_rth_algoritms {
1413 * See also: vxge_hw_vpath_rts_rth_set(), vxge_hw_vpath_rts_rth_get(). 1437 * See also: vxge_hw_vpath_rts_rth_set(), vxge_hw_vpath_rts_rth_get().
1414 */ 1438 */
1415struct vxge_hw_rth_hash_types { 1439struct vxge_hw_rth_hash_types {
1416 u8 hash_type_tcpipv4_en; 1440 u8 hash_type_tcpipv4_en:1,
1417 u8 hash_type_ipv4_en; 1441 hash_type_ipv4_en:1,
1418 u8 hash_type_tcpipv6_en; 1442 hash_type_tcpipv6_en:1,
1419 u8 hash_type_ipv6_en; 1443 hash_type_ipv6_en:1,
1420 u8 hash_type_tcpipv6ex_en; 1444 hash_type_tcpipv6ex_en:1,
1421 u8 hash_type_ipv6ex_en; 1445 hash_type_ipv6ex_en:1;
1422}; 1446};
1423 1447
1424void vxge_hw_device_debug_set( 1448void vxge_hw_device_debug_set(
@@ -1893,6 +1917,15 @@ out:
1893 return vaddr; 1917 return vaddr;
1894} 1918}
1895 1919
1920static inline void vxge_os_dma_free(struct pci_dev *pdev, const void *vaddr,
1921 struct pci_dev **p_dma_acch)
1922{
1923 unsigned long misaligned = *(unsigned long *)p_dma_acch;
1924 u8 *tmp = (u8 *)vaddr;
1925 tmp -= misaligned;
1926 kfree((void *)tmp);
1927}
1928
1896/* 1929/*
1897 * __vxge_hw_mempool_item_priv - will return pointer on per item private space 1930 * __vxge_hw_mempool_item_priv - will return pointer on per item private space
1898 */ 1931 */
@@ -1962,7 +1995,6 @@ enum vxge_hw_status vxge_hw_vpath_mtu_set(
1962void 1995void
1963vxge_hw_vpath_rx_doorbell_init(struct __vxge_hw_vpath_handle *vp); 1996vxge_hw_vpath_rx_doorbell_init(struct __vxge_hw_vpath_handle *vp);
1964 1997
1965
1966#ifndef readq 1998#ifndef readq
1967static inline u64 readq(void __iomem *addr) 1999static inline u64 readq(void __iomem *addr)
1968{ 2000{
@@ -2000,7 +2032,7 @@ enum vxge_hw_status
2000vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask); 2032vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask);
2001 2033
2002/** 2034/**
2003 * vxge_debug 2035 * vxge_debug_ll
2004 * @level: level of debug verbosity. 2036 * @level: level of debug verbosity.
2005 * @mask: mask for the debug 2037 * @mask: mask for the debug
2006 * @buf: Circular buffer for tracing 2038 * @buf: Circular buffer for tracing
@@ -2012,26 +2044,13 @@ vxge_hw_vpath_strip_fcs_check(struct __vxge_hw_device *hldev, u64 vpath_mask);
2012 * may be compiled out if DEBUG macro was never defined. 2044 * may be compiled out if DEBUG macro was never defined.
2013 * See also: enum vxge_debug_level{}. 2045 * See also: enum vxge_debug_level{}.
2014 */ 2046 */
2015
2016#define vxge_trace_aux(level, mask, fmt, ...) \
2017{\
2018 vxge_os_vaprintf(level, mask, fmt, __VA_ARGS__);\
2019}
2020
2021#define vxge_debug(module, level, mask, fmt, ...) { \
2022if ((level >= VXGE_TRACE && ((module & VXGE_DEBUG_TRACE_MASK) == module)) || \
2023 (level >= VXGE_ERR && ((module & VXGE_DEBUG_ERR_MASK) == module))) {\
2024 if ((mask & VXGE_DEBUG_MASK) == mask)\
2025 vxge_trace_aux(level, mask, fmt, __VA_ARGS__); \
2026} \
2027}
2028
2029#if (VXGE_COMPONENT_LL & VXGE_DEBUG_MODULE_MASK) 2047#if (VXGE_COMPONENT_LL & VXGE_DEBUG_MODULE_MASK)
2030#define vxge_debug_ll(level, mask, fmt, ...) \ 2048#define vxge_debug_ll(level, mask, fmt, ...) do { \
2031{\ 2049 if ((level >= VXGE_ERR && VXGE_COMPONENT_LL & VXGE_DEBUG_ERR_MASK) || \
2032 vxge_debug(VXGE_COMPONENT_LL, level, mask, fmt, __VA_ARGS__);\ 2050 (level >= VXGE_TRACE && VXGE_COMPONENT_LL & VXGE_DEBUG_TRACE_MASK))\
2033} 2051 if ((mask & VXGE_DEBUG_MASK) == mask) \
2034 2052 printk(fmt "\n", __VA_ARGS__); \
2053} while (0)
2035#else 2054#else
2036#define vxge_debug_ll(level, mask, fmt, ...) 2055#define vxge_debug_ll(level, mask, fmt, ...)
2037#endif 2056#endif
@@ -2051,4 +2070,26 @@ enum vxge_hw_status vxge_hw_vpath_rts_rth_set(
2051 2070
2052enum vxge_hw_status 2071enum vxge_hw_status
2053__vxge_hw_device_is_privilaged(u32 host_type, u32 func_id); 2072__vxge_hw_device_is_privilaged(u32 host_type, u32 func_id);
2073
2074#define VXGE_HW_MIN_SUCCESSIVE_IDLE_COUNT 5
2075#define VXGE_HW_MAX_POLLING_COUNT 100
2076
2077void
2078vxge_hw_device_wait_receive_idle(struct __vxge_hw_device *hldev);
2079
2080enum vxge_hw_status
2081vxge_hw_upgrade_read_version(struct __vxge_hw_device *hldev, u32 *major,
2082 u32 *minor, u32 *build);
2083
2084enum vxge_hw_status vxge_hw_flash_fw(struct __vxge_hw_device *hldev);
2085
2086enum vxge_hw_status
2087vxge_update_fw_image(struct __vxge_hw_device *hldev, const u8 *filebuf,
2088 int size);
2089
2090enum vxge_hw_status
2091vxge_hw_vpath_eprom_img_ver_get(struct __vxge_hw_device *hldev,
2092 struct eprom_image *eprom_image_data);
2093
2094int vxge_hw_vpath_wait_receive_idle(struct __vxge_hw_device *hldev, u32 vp_id);
2054#endif 2095#endif