Skip to content

Commit 3a35780

Browse files
David VomLehndavem330
authored andcommitted
net: ethernet: aquantia: Common functions and definitions
Add files containing the functions and definitions used in common in different functional areas. Signed-off-by: Alexander Loktionov <[email protected]> Signed-off-by: Dmitrii Tarakanov <[email protected]> Signed-off-by: Pavel Belous <[email protected]> Signed-off-by: Dmitry Bezrukov <[email protected]> Signed-off-by: David M. VomLehn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5015024 commit 3a35780

File tree

3 files changed

+150
-0
lines changed

3 files changed

+150
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* aQuantia Corporation Network Driver
3+
* Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
4+
*
5+
* This program is free software; you can redistribute it and/or modify it
6+
* under the terms and conditions of the GNU General Public License,
7+
* version 2, as published by the Free Software Foundation.
8+
*/
9+
10+
/* File aq_cfg.h: Definition of configuration parameters and constants. */
11+
12+
#ifndef AQ_CFG_H
13+
#define AQ_CFG_H
14+
15+
#define AQ_CFG_VECS_DEF 4U
16+
#define AQ_CFG_TCS_DEF 1U
17+
18+
#define AQ_CFG_TXDS_DEF 4096U
19+
#define AQ_CFG_RXDS_DEF 1024U
20+
21+
#define AQ_CFG_IS_POLLING_DEF 0U
22+
23+
#define AQ_CFG_FORCE_LEGACY_INT 0U
24+
25+
#define AQ_CFG_IS_INTERRUPT_MODERATION_DEF 1U
26+
#define AQ_CFG_INTERRUPT_MODERATION_RATE_DEF 0xFFFFU
27+
#define AQ_CFG_IRQ_MASK 0x1FFU
28+
29+
#define AQ_CFG_VECS_MAX 8U
30+
#define AQ_CFG_TCS_MAX 8U
31+
32+
#define AQ_CFG_TX_FRAME_MAX (16U * 1024U)
33+
#define AQ_CFG_RX_FRAME_MAX (4U * 1024U)
34+
35+
/* LRO */
36+
#define AQ_CFG_IS_LRO_DEF 1U
37+
38+
/* RSS */
39+
#define AQ_CFG_RSS_INDIRECTION_TABLE_MAX 128U
40+
#define AQ_CFG_RSS_HASHKEY_SIZE 320U
41+
42+
#define AQ_CFG_IS_RSS_DEF 1U
43+
#define AQ_CFG_NUM_RSS_QUEUES_DEF AQ_CFG_VECS_DEF
44+
#define AQ_CFG_RSS_BASE_CPU_NUM_DEF 0U
45+
46+
#define AQ_CFG_PCI_FUNC_MSIX_IRQS 9U
47+
#define AQ_CFG_PCI_FUNC_PORTS 2U
48+
49+
#define AQ_CFG_SERVICE_TIMER_INTERVAL (2 * HZ)
50+
#define AQ_CFG_POLLING_TIMER_INTERVAL ((unsigned int)(2 * HZ))
51+
52+
#define AQ_CFG_SKB_FRAGS_MAX 32U
53+
54+
#define AQ_CFG_NAPI_WEIGHT 64U
55+
56+
#define AQ_CFG_MULTICAST_ADDRESS_MAX 32U
57+
58+
/*#define AQ_CFG_MAC_ADDR_PERMANENT {0x30, 0x0E, 0xE3, 0x12, 0x34, 0x56}*/
59+
60+
#define AQ_CFG_FC_MODE 3U
61+
62+
#define AQ_CFG_SPEED_MSK 0xFFFFU /* 0xFFFFU==auto_neg */
63+
64+
#define AQ_CFG_IS_AUTONEG_DEF 1U
65+
#define AQ_CFG_MTU_DEF 1514U
66+
67+
#define AQ_CFG_LOCK_TRYS 100U
68+
69+
#define AQ_CFG_DRV_AUTHOR "aQuantia"
70+
#define AQ_CFG_DRV_DESC "aQuantia Corporation(R) Network Driver"
71+
#define AQ_CFG_DRV_NAME "aquantia"
72+
#define AQ_CFG_DRV_VERSION __stringify(NIC_MAJOR_DRIVER_VERSION)"."\
73+
__stringify(NIC_MINOR_DRIVER_VERSION)"."\
74+
__stringify(NIC_BUILD_DRIVER_VERSION)"."\
75+
__stringify(NIC_REVISION_DRIVER_VERSION)
76+
77+
#endif /* AQ_CFG_H */
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* aQuantia Corporation Network Driver
3+
* Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
4+
*
5+
* This program is free software; you can redistribute it and/or modify it
6+
* under the terms and conditions of the GNU General Public License,
7+
* version 2, as published by the Free Software Foundation.
8+
*/
9+
10+
/* File aq_common.h: Basic includes for all files in project. */
11+
12+
#ifndef AQ_COMMON_H
13+
#define AQ_COMMON_H
14+
15+
#include <linux/etherdevice.h>
16+
#include <linux/pci.h>
17+
18+
#include "ver.h"
19+
#include "aq_nic.h"
20+
#include "aq_cfg.h"
21+
#include "aq_utils.h"
22+
23+
#endif /* AQ_COMMON_H */
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* aQuantia Corporation Network Driver
3+
* Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
4+
*
5+
* This program is free software; you can redistribute it and/or modify it
6+
* under the terms and conditions of the GNU General Public License,
7+
* version 2, as published by the Free Software Foundation.
8+
*/
9+
10+
/* File aq_utils.h: Useful macro and structures used in all layers of driver. */
11+
12+
#ifndef AQ_UTILS_H
13+
#define AQ_UTILS_H
14+
15+
#include "aq_common.h"
16+
17+
#define AQ_DIMOF(_ARY_) ARRAY_SIZE(_ARY_)
18+
19+
struct aq_obj_s {
20+
spinlock_t lock; /* spinlock for nic/rings processing */
21+
atomic_t flags;
22+
atomic_t busy_count;
23+
};
24+
25+
static inline void aq_utils_obj_set(atomic_t *flags, u32 mask)
26+
{
27+
unsigned long flags_old, flags_new;
28+
29+
do {
30+
flags_old = atomic_read(flags);
31+
flags_new = flags_old | (mask);
32+
} while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
33+
}
34+
35+
static inline void aq_utils_obj_clear(atomic_t *flags, u32 mask)
36+
{
37+
unsigned long flags_old, flags_new;
38+
39+
do {
40+
flags_old = atomic_read(flags);
41+
flags_new = flags_old & ~(mask);
42+
} while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
43+
}
44+
45+
static inline bool aq_utils_obj_test(atomic_t *flags, u32 mask)
46+
{
47+
return atomic_read(flags) & mask;
48+
}
49+
50+
#endif /* AQ_UTILS_H */

0 commit comments

Comments
 (0)