aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/enic/Makefile2
-rw-r--r--drivers/net/enic/enic.h2
-rw-r--r--drivers/net/enic/enic_dev.c230
-rw-r--r--drivers/net/enic/enic_dev.h42
-rw-r--r--drivers/net/enic/enic_main.c207
5 files changed, 275 insertions, 208 deletions
diff --git a/drivers/net/enic/Makefile b/drivers/net/enic/Makefile
index e7b6c31880ba..2e573be16c13 100644
--- a/drivers/net/enic/Makefile
+++ b/drivers/net/enic/Makefile
@@ -1,5 +1,5 @@
1obj-$(CONFIG_ENIC) := enic.o 1obj-$(CONFIG_ENIC) := enic.o
2 2
3enic-y := enic_main.o vnic_cq.o vnic_intr.o vnic_wq.o \ 3enic-y := enic_main.o vnic_cq.o vnic_intr.o vnic_wq.o \
4 enic_res.o vnic_dev.o vnic_rq.o vnic_vic.o 4 enic_res.o enic_dev.o vnic_dev.o vnic_rq.o vnic_vic.o
5 5
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 44865bb10c96..1385a609ed49 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -32,7 +32,7 @@
32 32
33#define DRV_NAME "enic" 33#define DRV_NAME "enic"
34#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" 34#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
35#define DRV_VERSION "2.1.1.2a" 35#define DRV_VERSION "2.1.1.3"
36#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc" 36#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc"
37 37
38#define ENIC_BARS_MAX 6 38#define ENIC_BARS_MAX 6
diff --git a/drivers/net/enic/enic_dev.c b/drivers/net/enic/enic_dev.c
new file mode 100644
index 000000000000..a52dbd2b3c63
--- /dev/null
+++ b/drivers/net/enic/enic_dev.c
@@ -0,0 +1,230 @@
1/*
2 * Copyright 2011 Cisco Systems, Inc. All rights reserved.
3 *
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15 * SOFTWARE.
16 *
17 */
18
19#include <linux/pci.h>
20#include <linux/etherdevice.h>
21
22#include "vnic_dev.h"
23#include "vnic_vic.h"
24#include "enic_res.h"
25#include "enic.h"
26#include "enic_dev.h"
27
28int enic_dev_fw_info(struct enic *enic, struct vnic_devcmd_fw_info **fw_info)
29{
30 int err;
31
32 spin_lock(&enic->devcmd_lock);
33 err = vnic_dev_fw_info(enic->vdev, fw_info);
34 spin_unlock(&enic->devcmd_lock);
35
36 return err;
37}
38
39int enic_dev_stats_dump(struct enic *enic, struct vnic_stats **vstats)
40{
41 int err;
42
43 spin_lock(&enic->devcmd_lock);
44 err = vnic_dev_stats_dump(enic->vdev, vstats);
45 spin_unlock(&enic->devcmd_lock);
46
47 return err;
48}
49
50int enic_dev_add_station_addr(struct enic *enic)
51{
52 int err = 0;
53
54 if (is_valid_ether_addr(enic->netdev->dev_addr)) {
55 spin_lock(&enic->devcmd_lock);
56 err = vnic_dev_add_addr(enic->vdev, enic->netdev->dev_addr);
57 spin_unlock(&enic->devcmd_lock);
58 }
59
60 return err;
61}
62
63int enic_dev_del_station_addr(struct enic *enic)
64{
65 int err = 0;
66
67 if (is_valid_ether_addr(enic->netdev->dev_addr)) {
68 spin_lock(&enic->devcmd_lock);
69 err = vnic_dev_del_addr(enic->vdev, enic->netdev->dev_addr);
70 spin_unlock(&enic->devcmd_lock);
71 }
72
73 return err;
74}
75
76int enic_dev_packet_filter(struct enic *enic, int directed, int multicast,
77 int broadcast, int promisc, int allmulti)
78{
79 int err;
80
81 spin_lock(&enic->devcmd_lock);
82 err = vnic_dev_packet_filter(enic->vdev, directed,
83 multicast, broadcast, promisc, allmulti);
84 spin_unlock(&enic->devcmd_lock);
85
86 return err;
87}
88
89int enic_dev_add_addr(struct enic *enic, u8 *addr)
90{
91 int err;
92
93 spin_lock(&enic->devcmd_lock);
94 err = vnic_dev_add_addr(enic->vdev, addr);
95 spin_unlock(&enic->devcmd_lock);
96
97 return err;
98}
99
100int enic_dev_del_addr(struct enic *enic, u8 *addr)
101{
102 int err;
103
104 spin_lock(&enic->devcmd_lock);
105 err = vnic_dev_del_addr(enic->vdev, addr);
106 spin_unlock(&enic->devcmd_lock);
107
108 return err;
109}
110
111int enic_dev_hw_version(struct enic *enic, enum vnic_dev_hw_version *hw_ver)
112{
113 int err;
114
115 spin_lock(&enic->devcmd_lock);
116 err = vnic_dev_hw_version(enic->vdev, hw_ver);
117 spin_unlock(&enic->devcmd_lock);
118
119 return err;
120}
121
122int enic_dev_notify_unset(struct enic *enic)
123{
124 int err;
125
126 spin_lock(&enic->devcmd_lock);
127 err = vnic_dev_notify_unset(enic->vdev);
128 spin_unlock(&enic->devcmd_lock);
129
130 return err;
131}
132
133int enic_dev_hang_notify(struct enic *enic)
134{
135 int err;
136
137 spin_lock(&enic->devcmd_lock);
138 err = vnic_dev_hang_notify(enic->vdev);
139 spin_unlock(&enic->devcmd_lock);
140
141 return err;
142}
143
144int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic)
145{
146 int err;
147
148 spin_lock(&enic->devcmd_lock);
149 err = vnic_dev_set_ig_vlan_rewrite_mode(enic->vdev,
150 IG_VLAN_REWRITE_MODE_PRIORITY_TAG_DEFAULT_VLAN);
151 spin_unlock(&enic->devcmd_lock);
152
153 return err;
154}
155
156int enic_dev_enable(struct enic *enic)
157{
158 int err;
159
160 spin_lock(&enic->devcmd_lock);
161 err = vnic_dev_enable_wait(enic->vdev);
162 spin_unlock(&enic->devcmd_lock);
163
164 return err;
165}
166
167int enic_dev_disable(struct enic *enic)
168{
169 int err;
170
171 spin_lock(&enic->devcmd_lock);
172 err = vnic_dev_disable(enic->vdev);
173 spin_unlock(&enic->devcmd_lock);
174
175 return err;
176}
177
178int enic_vnic_dev_deinit(struct enic *enic)
179{
180 int err;
181
182 spin_lock(&enic->devcmd_lock);
183 err = vnic_dev_deinit(enic->vdev);
184 spin_unlock(&enic->devcmd_lock);
185
186 return err;
187}
188
189int enic_dev_init_prov(struct enic *enic, struct vic_provinfo *vp)
190{
191 int err;
192
193 spin_lock(&enic->devcmd_lock);
194 err = vnic_dev_init_prov(enic->vdev,
195 (u8 *)vp, vic_provinfo_size(vp));
196 spin_unlock(&enic->devcmd_lock);
197
198 return err;
199}
200
201int enic_dev_init_done(struct enic *enic, int *done, int *error)
202{
203 int err;
204
205 spin_lock(&enic->devcmd_lock);
206 err = vnic_dev_init_done(enic->vdev, done, error);
207 spin_unlock(&enic->devcmd_lock);
208
209 return err;
210}
211
212/* rtnl lock is held */
213void enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
214{
215 struct enic *enic = netdev_priv(netdev);
216
217 spin_lock(&enic->devcmd_lock);
218 enic_add_vlan(enic, vid);
219 spin_unlock(&enic->devcmd_lock);
220}
221
222/* rtnl lock is held */
223void enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
224{
225 struct enic *enic = netdev_priv(netdev);
226
227 spin_lock(&enic->devcmd_lock);
228 enic_del_vlan(enic, vid);
229 spin_unlock(&enic->devcmd_lock);
230}
diff --git a/drivers/net/enic/enic_dev.h b/drivers/net/enic/enic_dev.h
new file mode 100644
index 000000000000..3ac6ba1db25b
--- /dev/null
+++ b/drivers/net/enic/enic_dev.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright 2011 Cisco Systems, Inc. All rights reserved.
3 *
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15 * SOFTWARE.
16 *
17 */
18
19#ifndef _ENIC_DEV_H_
20#define _ENIC_DEV_H_
21
22int enic_dev_fw_info(struct enic *enic, struct vnic_devcmd_fw_info **fw_info);
23int enic_dev_stats_dump(struct enic *enic, struct vnic_stats **vstats);
24int enic_dev_add_station_addr(struct enic *enic);
25int enic_dev_del_station_addr(struct enic *enic);
26int enic_dev_packet_filter(struct enic *enic, int directed, int multicast,
27 int broadcast, int promisc, int allmulti);
28int enic_dev_add_addr(struct enic *enic, u8 *addr);
29int enic_dev_del_addr(struct enic *enic, u8 *addr);
30void enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
31void enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
32int enic_dev_hw_version(struct enic *enic, enum vnic_dev_hw_version *hw_ver);
33int enic_dev_notify_unset(struct enic *enic);
34int enic_dev_hang_notify(struct enic *enic);
35int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);
36int enic_dev_enable(struct enic *enic);
37int enic_dev_disable(struct enic *enic);
38int enic_vnic_dev_deinit(struct enic *enic);
39int enic_dev_init_prov(struct enic *enic, struct vic_provinfo *vp);
40int enic_dev_init_done(struct enic *enic, int *done, int *error);
41
42#endif /* _ENIC_DEV_H_ */
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 37f907b32d68..3893370d95a8 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -44,6 +44,7 @@
44#include "vnic_vic.h" 44#include "vnic_vic.h"
45#include "enic_res.h" 45#include "enic_res.h"
46#include "enic.h" 46#include "enic.h"
47#include "enic_dev.h"
47 48
48#define ENIC_NOTIFY_TIMER_PERIOD (2 * HZ) 49#define ENIC_NOTIFY_TIMER_PERIOD (2 * HZ)
49#define WQ_ENET_MAX_DESC_LEN (1 << WQ_ENET_LEN_BITS) 50#define WQ_ENET_MAX_DESC_LEN (1 << WQ_ENET_LEN_BITS)
@@ -190,18 +191,6 @@ static int enic_get_settings(struct net_device *netdev,
190 return 0; 191 return 0;
191} 192}
192 193
193static int enic_dev_fw_info(struct enic *enic,
194 struct vnic_devcmd_fw_info **fw_info)
195{
196 int err;
197
198 spin_lock(&enic->devcmd_lock);
199 err = vnic_dev_fw_info(enic->vdev, fw_info);
200 spin_unlock(&enic->devcmd_lock);
201
202 return err;
203}
204
205static void enic_get_drvinfo(struct net_device *netdev, 194static void enic_get_drvinfo(struct net_device *netdev,
206 struct ethtool_drvinfo *drvinfo) 195 struct ethtool_drvinfo *drvinfo)
207{ 196{
@@ -246,17 +235,6 @@ static int enic_get_sset_count(struct net_device *netdev, int sset)
246 } 235 }
247} 236}
248 237
249static int enic_dev_stats_dump(struct enic *enic, struct vnic_stats **vstats)
250{
251 int err;
252
253 spin_lock(&enic->devcmd_lock);
254 err = vnic_dev_stats_dump(enic->vdev, vstats);
255 spin_unlock(&enic->devcmd_lock);
256
257 return err;
258}
259
260static void enic_get_ethtool_stats(struct net_device *netdev, 238static void enic_get_ethtool_stats(struct net_device *netdev,
261 struct ethtool_stats *stats, u64 *data) 239 struct ethtool_stats *stats, u64 *data)
262{ 240{
@@ -919,32 +897,6 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr)
919 return 0; 897 return 0;
920} 898}
921 899
922static int enic_dev_add_station_addr(struct enic *enic)
923{
924 int err = 0;
925
926 if (is_valid_ether_addr(enic->netdev->dev_addr)) {
927 spin_lock(&enic->devcmd_lock);
928 err = vnic_dev_add_addr(enic->vdev, enic->netdev->dev_addr);
929 spin_unlock(&enic->devcmd_lock);
930 }
931
932 return err;
933}
934
935static int enic_dev_del_station_addr(struct enic *enic)
936{
937 int err = 0;
938
939 if (is_valid_ether_addr(enic->netdev->dev_addr)) {
940 spin_lock(&enic->devcmd_lock);
941 err = vnic_dev_del_addr(enic->vdev, enic->netdev->dev_addr);
942 spin_unlock(&enic->devcmd_lock);
943 }
944
945 return err;
946}
947
948static int enic_set_mac_address_dynamic(struct net_device *netdev, void *p) 900static int enic_set_mac_address_dynamic(struct net_device *netdev, void *p)
949{ 901{
950 struct enic *enic = netdev_priv(netdev); 902 struct enic *enic = netdev_priv(netdev);
@@ -989,41 +941,6 @@ static int enic_set_mac_address(struct net_device *netdev, void *p)
989 return enic_dev_add_station_addr(enic); 941 return enic_dev_add_station_addr(enic);
990} 942}
991 943
992static int enic_dev_packet_filter(struct enic *enic, int directed,
993 int multicast, int broadcast, int promisc, int allmulti)
994{
995 int err;
996
997 spin_lock(&enic->devcmd_lock);
998 err = vnic_dev_packet_filter(enic->vdev, directed,
999 multicast, broadcast, promisc, allmulti);
1000 spin_unlock(&enic->devcmd_lock);
1001
1002 return err;
1003}
1004
1005static int enic_dev_add_addr(struct enic *enic, u8 *addr)
1006{
1007 int err;
1008
1009 spin_lock(&enic->devcmd_lock);
1010 err = vnic_dev_add_addr(enic->vdev, addr);
1011 spin_unlock(&enic->devcmd_lock);
1012
1013 return err;
1014}
1015
1016static int enic_dev_del_addr(struct enic *enic, u8 *addr)
1017{
1018 int err;
1019
1020 spin_lock(&enic->devcmd_lock);
1021 err = vnic_dev_del_addr(enic->vdev, addr);
1022 spin_unlock(&enic->devcmd_lock);
1023
1024 return err;
1025}
1026
1027static void enic_add_multicast_addr_list(struct enic *enic) 944static void enic_add_multicast_addr_list(struct enic *enic)
1028{ 945{
1029 struct net_device *netdev = enic->netdev; 946 struct net_device *netdev = enic->netdev;
@@ -1170,26 +1087,6 @@ static void enic_vlan_rx_register(struct net_device *netdev,
1170 enic->vlan_group = vlan_group; 1087 enic->vlan_group = vlan_group;
1171} 1088}
1172 1089
1173/* rtnl lock is held */
1174static void enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1175{
1176 struct enic *enic = netdev_priv(netdev);
1177
1178 spin_lock(&enic->devcmd_lock);
1179 enic_add_vlan(enic, vid);
1180 spin_unlock(&enic->devcmd_lock);
1181}
1182
1183/* rtnl lock is held */
1184static void enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1185{
1186 struct enic *enic = netdev_priv(netdev);
1187
1188 spin_lock(&enic->devcmd_lock);
1189 enic_del_vlan(enic, vid);
1190 spin_unlock(&enic->devcmd_lock);
1191}
1192
1193/* netif_tx_lock held, BHs disabled */ 1090/* netif_tx_lock held, BHs disabled */
1194static void enic_tx_timeout(struct net_device *netdev) 1091static void enic_tx_timeout(struct net_device *netdev)
1195{ 1092{
@@ -1197,40 +1094,6 @@ static void enic_tx_timeout(struct net_device *netdev)
1197 schedule_work(&enic->reset); 1094 schedule_work(&enic->reset);
1198} 1095}
1199 1096
1200static int enic_vnic_dev_deinit(struct enic *enic)
1201{
1202 int err;
1203
1204 spin_lock(&enic->devcmd_lock);
1205 err = vnic_dev_deinit(enic->vdev);
1206 spin_unlock(&enic->devcmd_lock);
1207
1208 return err;
1209}
1210
1211static int enic_dev_init_prov(struct enic *enic, struct vic_provinfo *vp)
1212{
1213 int err;
1214
1215 spin_lock(&enic->devcmd_lock);
1216 err = vnic_dev_init_prov(enic->vdev,
1217 (u8 *)vp, vic_provinfo_size(vp));
1218 spin_unlock(&enic->devcmd_lock);
1219
1220 return err;
1221}
1222
1223static int enic_dev_init_done(struct enic *enic, int *done, int *error)
1224{
1225 int err;
1226
1227 spin_lock(&enic->devcmd_lock);
1228 err = vnic_dev_init_done(enic->vdev, done, error);
1229 spin_unlock(&enic->devcmd_lock);
1230
1231 return err;
1232}
1233
1234static int enic_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) 1097static int enic_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
1235{ 1098{
1236 struct enic *enic = netdev_priv(netdev); 1099 struct enic *enic = netdev_priv(netdev);
@@ -1505,18 +1368,6 @@ static int enic_rq_alloc_buf_a1(struct vnic_rq *rq)
1505 return 0; 1368 return 0;
1506} 1369}
1507 1370
1508static int enic_dev_hw_version(struct enic *enic,
1509 enum vnic_dev_hw_version *hw_ver)
1510{
1511 int err;
1512
1513 spin_lock(&enic->devcmd_lock);
1514 err = vnic_dev_hw_version(enic->vdev, hw_ver);
1515 spin_unlock(&enic->devcmd_lock);
1516
1517 return err;
1518}
1519
1520static int enic_set_rq_alloc_buf(struct enic *enic) 1371static int enic_set_rq_alloc_buf(struct enic *enic)
1521{ 1372{
1522 enum vnic_dev_hw_version hw_ver; 1373 enum vnic_dev_hw_version hw_ver;
@@ -1897,39 +1748,6 @@ static int enic_dev_notify_set(struct enic *enic)
1897 return err; 1748 return err;
1898} 1749}
1899 1750
1900static int enic_dev_notify_unset(struct enic *enic)
1901{
1902 int err;
1903
1904 spin_lock(&enic->devcmd_lock);
1905 err = vnic_dev_notify_unset(enic->vdev);
1906 spin_unlock(&enic->devcmd_lock);
1907
1908 return err;
1909}
1910
1911static int enic_dev_enable(struct enic *enic)
1912{
1913 int err;
1914
1915 spin_lock(&enic->devcmd_lock);
1916 err = vnic_dev_enable_wait(enic->vdev);
1917 spin_unlock(&enic->devcmd_lock);
1918
1919 return err;
1920}
1921
1922static int enic_dev_disable(struct enic *enic)
1923{
1924 int err;
1925
1926 spin_lock(&enic->devcmd_lock);
1927 err = vnic_dev_disable(enic->vdev);
1928 spin_unlock(&enic->devcmd_lock);
1929
1930 return err;
1931}
1932
1933static void enic_notify_timer_start(struct enic *enic) 1751static void enic_notify_timer_start(struct enic *enic)
1934{ 1752{
1935 switch (vnic_dev_get_intr_mode(enic->vdev)) { 1753 switch (vnic_dev_get_intr_mode(enic->vdev)) {
@@ -2281,29 +2099,6 @@ static int enic_set_rss_nic_cfg(struct enic *enic)
2281 rss_hash_bits, rss_base_cpu, rss_enable); 2099 rss_hash_bits, rss_base_cpu, rss_enable);
2282} 2100}
2283 2101
2284static int enic_dev_hang_notify(struct enic *enic)
2285{
2286 int err;
2287
2288 spin_lock(&enic->devcmd_lock);
2289 err = vnic_dev_hang_notify(enic->vdev);
2290 spin_unlock(&enic->devcmd_lock);
2291
2292 return err;
2293}
2294
2295static int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic)
2296{
2297 int err;
2298
2299 spin_lock(&enic->devcmd_lock);
2300 err = vnic_dev_set_ig_vlan_rewrite_mode(enic->vdev,
2301 IG_VLAN_REWRITE_MODE_PRIORITY_TAG_DEFAULT_VLAN);
2302 spin_unlock(&enic->devcmd_lock);
2303
2304 return err;
2305}
2306
2307static void enic_reset(struct work_struct *work) 2102static void enic_reset(struct work_struct *work)
2308{ 2103{
2309 struct enic *enic = container_of(work, struct enic, reset); 2104 struct enic *enic = container_of(work, struct enic, reset);