]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/60007_sfc-driverlink-conditional.patch1
Stop dhcpcd before starting if it was running
[people/pmueller/ipfire-2.x.git] / src / patches / 60007_sfc-driverlink-conditional.patch1
CommitLineData
cc90b958
BS
1From: jbeulich@novell.com
2Subject: conditionalize driverlink additions to Solarflare driver
3Patch-mainline: obsolete
4References: FATE#303479
5
6At once converted the EFX_TRACE() invocations after vetoed RX/TX
7callbacks to ...LOG() ones, which is consistent with Solarflare's
8current code according to David Riddoch (2008-09-12).
9
10Index: head-2008-09-01/drivers/net/sfc/Kconfig
11===================================================================
12--- head-2008-09-01.orig/drivers/net/sfc/Kconfig 2008-07-17 16:18:07.000000000 +0200
13+++ head-2008-09-01/drivers/net/sfc/Kconfig 2008-09-12 14:01:48.000000000 +0200
14@@ -13,8 +13,12 @@ config SFC
15 To compile this driver as a module, choose M here. The module
16 will be called sfc.
17
18+config SFC_DRIVERLINK
19+ bool
20+
21 config SFC_RESOURCE
22 depends on SFC && X86
23+ select SFC_DRIVERLINK
24 tristate "Solarflare Solarstorm SFC4000 resource driver"
25 help
26 This module provides the SFC resource manager driver.
27Index: head-2008-09-01/drivers/net/sfc/Makefile
28===================================================================
29--- head-2008-09-01.orig/drivers/net/sfc/Makefile 2008-07-17 16:18:07.000000000 +0200
30+++ head-2008-09-01/drivers/net/sfc/Makefile 2008-09-12 12:22:05.000000000 +0200
31@@ -1,7 +1,7 @@
32 sfc-y += efx.o falcon.o tx.o rx.o falcon_xmac.o \
33 selftest.o ethtool.o xfp_phy.o \
34- mdio_10g.o tenxpress.o boards.o sfe4001.o \
35- driverlink.o
36+ mdio_10g.o tenxpress.o boards.o sfe4001.o
37+sfc-$(CONFIG_SFC_DRIVERLINK) += driverlink.o
38 obj-$(CONFIG_SFC) += sfc.o
39
40 obj-$(CONFIG_SFC_RESOURCE) += sfc_resource/
41Index: head-2008-09-01/drivers/net/sfc/driverlink.c
42===================================================================
43--- head-2008-09-01.orig/drivers/net/sfc/driverlink.c 2008-08-18 10:16:46.000000000 +0200
44+++ head-2008-09-01/drivers/net/sfc/driverlink.c 2008-09-12 13:57:29.000000000 +0200
45@@ -14,7 +14,6 @@
46 #include <linux/rtnetlink.h>
47 #include "net_driver.h"
48 #include "efx.h"
49-#include "driverlink_api.h"
50 #include "driverlink.h"
51
52 /* Protects @efx_driverlink_lock and @efx_driver_list */
53Index: head-2008-09-01/drivers/net/sfc/driverlink.h
54===================================================================
55--- head-2008-09-01.orig/drivers/net/sfc/driverlink.h 2008-08-18 10:16:46.000000000 +0200
56+++ head-2008-09-01/drivers/net/sfc/driverlink.h 2008-09-12 16:14:04.000000000 +0200
57@@ -15,6 +15,10 @@
58 struct efx_dl_device;
59 struct efx_nic;
60
61+#ifdef CONFIG_SFC_DRIVERLINK
62+
63+#include "driverlink_api.h"
64+
65 /* Efx callback devices
66 *
67 * A list of the devices that own each callback. The partner to
68@@ -40,4 +44,23 @@ extern void efx_dl_unregister_nic(struct
69 extern void efx_dl_reset_suspend(struct efx_nic *efx);
70 extern void efx_dl_reset_resume(struct efx_nic *efx, int ok);
71
72+#define EFX_DL_LOG EFX_LOG
73+
74+#else /* CONFIG_SFC_DRIVERLINK */
75+
76+enum efx_veto { EFX_ALLOW_PACKET = 0 };
77+
78+static inline int efx_nop_callback(struct efx_nic *efx) { return 0; }
79+#define EFX_DL_CALLBACK(port, name, ...) efx_nop_callback(port)
80+
81+static inline int efx_dl_register_nic(struct efx_nic *efx) { return 0; }
82+static inline void efx_dl_unregister_nic(struct efx_nic *efx) {}
83+
84+static inline void efx_dl_reset_suspend(struct efx_nic *efx) {}
85+static inline void efx_dl_reset_resume(struct efx_nic *efx, int ok) {}
86+
87+#define EFX_DL_LOG(efx, fmt, args...) ((void)(efx))
88+
89+#endif /* CONFIG_SFC_DRIVERLINK */
90+
91 #endif /* EFX_DRIVERLINK_H */
92Index: head-2008-09-01/drivers/net/sfc/efx.c
93===================================================================
94--- head-2008-09-01.orig/drivers/net/sfc/efx.c 2008-08-18 10:16:46.000000000 +0200
95+++ head-2008-09-01/drivers/net/sfc/efx.c 2008-09-12 12:42:32.000000000 +0200
96@@ -1596,6 +1596,7 @@ static void efx_unregister_netdev(struct
97 * Device reset and suspend
98 *
99 **************************************************************************/
100+#ifdef CONFIG_SFC_DRIVERLINK
101 /* Serialise access to the driverlink callbacks, by quiescing event processing
102 * (without flushing the descriptor queues), and acquiring the rtnl_lock */
103 void efx_suspend(struct efx_nic *efx)
104@@ -1613,6 +1614,7 @@ void efx_resume(struct efx_nic *efx)
105 efx_start_all(efx);
106 rtnl_unlock();
107 }
108+#endif
109
110 /* The final hardware and software finalisation before reset. */
111 static int efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
112@@ -1899,9 +1901,11 @@ static int efx_init_struct(struct efx_ni
113 mutex_init(&efx->mac_lock);
114 efx->phy_op = &efx_dummy_phy_operations;
115 efx->mii.dev = net_dev;
116+#ifdef CONFIG_SFC_DRIVERLINK
117 INIT_LIST_HEAD(&efx->dl_node);
118 INIT_LIST_HEAD(&efx->dl_device_list);
119 efx->dl_cb = efx_default_callbacks;
120+#endif
121 INIT_WORK(&efx->reconfigure_work, efx_reconfigure_work);
122 atomic_set(&efx->netif_stop_count, 1);
123
124Index: head-2008-09-01/drivers/net/sfc/falcon.c
125===================================================================
126--- head-2008-09-01.orig/drivers/net/sfc/falcon.c 2008-08-18 10:16:46.000000000 +0200
127+++ head-2008-09-01/drivers/net/sfc/falcon.c 2008-09-12 13:51:32.000000000 +0200
128@@ -36,12 +36,17 @@
129
130 /**
131 * struct falcon_nic_data - Falcon NIC state
132+ * @next_buffer_table: First available buffer table id
133 * @resources: Resource information for driverlink client
134 * @pci_dev2: The secondary PCI device if present
135 * @i2c_data: Operations and state for I2C bit-bashing algorithm
136 */
137 struct falcon_nic_data {
138+#ifndef CONFIG_SFC_DRIVERLINK
139+ unsigned next_buffer_table;
140+#else
141 struct efx_dl_falcon_resources resources;
142+#endif
143 struct pci_dev *pci_dev2;
144 struct i2c_algo_bit_data i2c_data;
145 };
146@@ -322,8 +327,13 @@ static int falcon_alloc_special_buffer(s
147 memset(buffer->addr, 0xff, len);
148
149 /* Select new buffer ID */
150+#ifndef CONFIG_SFC_DRIVERLINK
151+ buffer->index = nic_data->next_buffer_table;
152+ nic_data->next_buffer_table += buffer->entries;
153+#else
154 buffer->index = nic_data->resources.buffer_table_min;
155 nic_data->resources.buffer_table_min += buffer->entries;
156+#endif
157
158 EFX_LOG(efx, "allocating special buffers %d-%d at %llx+%x "
159 "(virt %p phys %lx)\n", buffer->index,
160@@ -2382,6 +2392,7 @@ static int falcon_probe_nvconfig(struct
161 * should live. */
162 static int falcon_dimension_resources(struct efx_nic *efx)
163 {
164+#ifdef CONFIG_SFC_DRIVERLINK
165 unsigned internal_dcs_entries;
166 struct falcon_nic_data *nic_data = efx->nic_data;
167 struct efx_dl_falcon_resources *res = &nic_data->resources;
168@@ -2426,6 +2437,7 @@ static int falcon_dimension_resources(st
169
170 if (EFX_INT_MODE_USE_MSI(efx))
171 res->flags |= EFX_DL_FALCON_USE_MSI;
172+#endif
173
174 return 0;
175 }
176@@ -2551,7 +2563,9 @@ int falcon_probe_nic(struct efx_nic *efx
177 return 0;
178
179 fail6:
180+#ifdef CONFIG_SFC_DRIVERLINK
181 efx->dl_info = NULL;
182+#endif
183 fail5:
184 falcon_free_buffer(efx, &efx->irq_status);
185 fail4:
186@@ -2742,7 +2756,9 @@ void falcon_remove_nic(struct efx_nic *e
187 /* Tear down the private nic state */
188 kfree(efx->nic_data);
189 efx->nic_data = NULL;
190+#ifdef CONFIG_SFC_DRIVERLINK
191 efx->dl_info = NULL;
192+#endif
193 }
194
195 void falcon_update_nic_stats(struct efx_nic *efx)
196Index: head-2008-09-01/drivers/net/sfc/net_driver.h
197===================================================================
198--- head-2008-09-01.orig/drivers/net/sfc/net_driver.h 2008-08-18 10:16:46.000000000 +0200
199+++ head-2008-09-01/drivers/net/sfc/net_driver.h 2008-09-12 13:57:19.000000000 +0200
200@@ -30,7 +30,6 @@
201
202 #include "enum.h"
203 #include "bitfield.h"
204-#include "driverlink_api.h"
205 #include "driverlink.h"
206
207 #define EFX_MAX_LRO_DESCRIPTORS 8
208@@ -762,11 +761,13 @@ struct efx_nic {
209 void *loopback_selftest;
210
211 const char *silicon_rev;
212+#ifdef CONFIG_SFC_DRIVERLINK
213 struct efx_dl_device_info *dl_info;
214 struct list_head dl_node;
215 struct list_head dl_device_list;
216 struct efx_dl_callbacks dl_cb;
217 struct efx_dl_cb_devices dl_cb_dev;
218+#endif
219 };
220
221 static inline int efx_dev_registered(struct efx_nic *efx)
222Index: head-2008-09-01/drivers/net/sfc/rx.c
223===================================================================
224--- head-2008-09-01.orig/drivers/net/sfc/rx.c 2008-08-18 10:16:46.000000000 +0200
225+++ head-2008-09-01/drivers/net/sfc/rx.c 2008-09-12 16:13:49.000000000 +0200
226@@ -559,8 +559,8 @@ static inline void efx_rx_packet_lro(str
227 * an obvious interface to this, so veto packets before LRO */
228 veto = EFX_DL_CALLBACK(efx, rx_packet, rx_buf->data, rx_buf->len);
229 if (unlikely(veto)) {
230- EFX_TRACE(efx, "LRO RX vetoed by driverlink %s driver\n",
231- efx->dl_cb_dev.rx_packet->driver->name);
232+ EFX_DL_LOG(efx, "LRO RX vetoed by driverlink %s driver\n",
233+ efx->dl_cb_dev.rx_packet->driver->name);
234 /* Free the buffer now */
235 efx_free_rx_buffer(efx, rx_buf);
236 return;
237@@ -741,8 +741,8 @@ void __efx_rx_packet(struct efx_channel
238 /* Allow callback to veto the packet */
239 veto = EFX_DL_CALLBACK(efx, rx_packet, rx_buf->data, rx_buf->len);
240 if (unlikely(veto)) {
241- EFX_LOG(efx, "RX vetoed by driverlink %s driver\n",
242- efx->dl_cb_dev.rx_packet->driver->name);
243+ EFX_DL_LOG(efx, "RX vetoed by driverlink %s driver\n",
244+ efx->dl_cb_dev.rx_packet->driver->name);
245 /* Free the buffer now */
246 efx_free_rx_buffer(efx, rx_buf);
247 goto done;
248Index: head-2008-09-01/drivers/net/sfc/tx.c
249===================================================================
250--- head-2008-09-01.orig/drivers/net/sfc/tx.c 2008-08-18 10:16:46.000000000 +0200
251+++ head-2008-09-01/drivers/net/sfc/tx.c 2008-09-12 16:13:34.000000000 +0200
252@@ -374,9 +374,9 @@ int efx_hard_start_xmit(struct sk_buff *
253 /* See if driverlink wants to veto the packet. */
254 veto = EFX_DL_CALLBACK(efx, tx_packet, skb);
255 if (unlikely(veto)) {
256- EFX_TRACE(efx, "TX queue %d packet vetoed by "
257- "driverlink %s driver\n", tx_queue->queue,
258- efx->dl_cb_dev.tx_packet->driver->name);
259+ EFX_DL_LOG(efx, "TX queue %d packet vetoed by "
260+ "driverlink %s driver\n", tx_queue->queue,
261+ efx->dl_cb_dev.tx_packet->driver->name);
262 /* Free the skb; nothing else will do it */
263 dev_kfree_skb_any(skb);
264 return NETDEV_TX_OK;