diff options
author | Govindarajulu Varadarajan <_govind@gmx.com> | 2014-06-23 06:38:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-23 17:32:19 -0400 |
commit | b6e97c132bbca469d57634622dd7bdacb21f018f (patch) | |
tree | ceeecf30a2d5f662f7f6c68ac90f0fa06d24e5eb | |
parent | 631185273b6e1f8e0b5a00c1aca08650b2d18a57 (diff) |
enic: alloc/free rx_cpu_rmap
rx_cpu_rmap provides the reverse irq cpu affinity. This patch allocates and
sets drivers netdev->rx_cpu_rmap accordingly.
rx_cpu_rmap is set in enic_request_intr() which is called by enic_open and
rx_cpu_rmap is freed in enic_free_intr() which is called by enic_stop.
This is used by Accelerated RFS.
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic_main.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index f32f828b7f3d..151b375337a9 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -39,6 +39,9 @@ | |||
39 | #include <linux/prefetch.h> | 39 | #include <linux/prefetch.h> |
40 | #include <net/ip6_checksum.h> | 40 | #include <net/ip6_checksum.h> |
41 | #include <linux/ktime.h> | 41 | #include <linux/ktime.h> |
42 | #ifdef CONFIG_RFS_ACCEL | ||
43 | #include <linux/cpu_rmap.h> | ||
44 | #endif | ||
42 | 45 | ||
43 | #include "cq_enet_desc.h" | 46 | #include "cq_enet_desc.h" |
44 | #include "vnic_dev.h" | 47 | #include "vnic_dev.h" |
@@ -1192,6 +1195,44 @@ static void enic_calc_int_moderation(struct enic *enic, struct vnic_rq *rq) | |||
1192 | pkt_size_counter->small_pkt_bytes_cnt = 0; | 1195 | pkt_size_counter->small_pkt_bytes_cnt = 0; |
1193 | } | 1196 | } |
1194 | 1197 | ||
1198 | #ifdef CONFIG_RFS_ACCEL | ||
1199 | static void enic_free_rx_cpu_rmap(struct enic *enic) | ||
1200 | { | ||
1201 | free_irq_cpu_rmap(enic->netdev->rx_cpu_rmap); | ||
1202 | enic->netdev->rx_cpu_rmap = NULL; | ||
1203 | } | ||
1204 | |||
1205 | static void enic_set_rx_cpu_rmap(struct enic *enic) | ||
1206 | { | ||
1207 | int i, res; | ||
1208 | |||
1209 | if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX) { | ||
1210 | enic->netdev->rx_cpu_rmap = alloc_irq_cpu_rmap(enic->rq_count); | ||
1211 | if (unlikely(!enic->netdev->rx_cpu_rmap)) | ||
1212 | return; | ||
1213 | for (i = 0; i < enic->rq_count; i++) { | ||
1214 | res = irq_cpu_rmap_add(enic->netdev->rx_cpu_rmap, | ||
1215 | enic->msix_entry[i].vector); | ||
1216 | if (unlikely(res)) { | ||
1217 | enic_free_rx_cpu_rmap(enic); | ||
1218 | return; | ||
1219 | } | ||
1220 | } | ||
1221 | } | ||
1222 | } | ||
1223 | |||
1224 | #else | ||
1225 | |||
1226 | static void enic_free_rx_cpu_rmap(struct enic *enic) | ||
1227 | { | ||
1228 | } | ||
1229 | |||
1230 | static void enic_set_rx_cpu_rmap(struct enic *enic) | ||
1231 | { | ||
1232 | } | ||
1233 | |||
1234 | #endif /* CONFIG_RFS_ACCEL */ | ||
1235 | |||
1195 | static int enic_poll_msix(struct napi_struct *napi, int budget) | 1236 | static int enic_poll_msix(struct napi_struct *napi, int budget) |
1196 | { | 1237 | { |
1197 | struct net_device *netdev = napi->dev; | 1238 | struct net_device *netdev = napi->dev; |
@@ -1267,6 +1308,7 @@ static void enic_free_intr(struct enic *enic) | |||
1267 | struct net_device *netdev = enic->netdev; | 1308 | struct net_device *netdev = enic->netdev; |
1268 | unsigned int i; | 1309 | unsigned int i; |
1269 | 1310 | ||
1311 | enic_free_rx_cpu_rmap(enic); | ||
1270 | switch (vnic_dev_get_intr_mode(enic->vdev)) { | 1312 | switch (vnic_dev_get_intr_mode(enic->vdev)) { |
1271 | case VNIC_DEV_INTR_MODE_INTX: | 1313 | case VNIC_DEV_INTR_MODE_INTX: |
1272 | free_irq(enic->pdev->irq, netdev); | 1314 | free_irq(enic->pdev->irq, netdev); |
@@ -1291,6 +1333,7 @@ static int enic_request_intr(struct enic *enic) | |||
1291 | unsigned int i, intr; | 1333 | unsigned int i, intr; |
1292 | int err = 0; | 1334 | int err = 0; |
1293 | 1335 | ||
1336 | enic_set_rx_cpu_rmap(enic); | ||
1294 | switch (vnic_dev_get_intr_mode(enic->vdev)) { | 1337 | switch (vnic_dev_get_intr_mode(enic->vdev)) { |
1295 | 1338 | ||
1296 | case VNIC_DEV_INTR_MODE_INTX: | 1339 | case VNIC_DEV_INTR_MODE_INTX: |