aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRon Mercer <ron.mercer@qlogic.com>2009-02-23 05:42:15 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-25 02:50:01 -0500
commit8587ea35ca6b4add4353b8a18b67d358aed0389e (patch)
treeffd510b1290f5e3bd3fb8a345c00a1af041a58ff /drivers/net
parentcc288f54bbace136c08742da84712add54e4acfa (diff)
qlge: Change frame route hw semaphore granularity.
Instead of taking/giving the hw semaphore repeatedly when iterating over several frame to queue route settings, we have the caller hold it until all are done. This reduces PCI bus chatter and possible waits. Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/qlge/qlge_main.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index d316e508d06e..16c056a62fc1 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -418,10 +418,6 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value)
418{ 418{
419 int status = 0; 419 int status = 0;
420 420
421 status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
422 if (status)
423 goto exit;
424
425 status = ql_wait_reg_rdy(qdev, RT_IDX, RT_IDX_MW, 0); 421 status = ql_wait_reg_rdy(qdev, RT_IDX, RT_IDX_MW, 0);
426 if (status) 422 if (status)
427 goto exit; 423 goto exit;
@@ -433,7 +429,6 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value)
433 goto exit; 429 goto exit;
434 *value = ql_read32(qdev, RT_DATA); 430 *value = ql_read32(qdev, RT_DATA);
435exit: 431exit:
436 ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
437 return status; 432 return status;
438} 433}
439 434
@@ -445,13 +440,9 @@ exit:
445static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask, 440static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask,
446 int enable) 441 int enable)
447{ 442{
448 int status; 443 int status = -EINVAL; /* Return error if no mask match. */
449 u32 value = 0; 444 u32 value = 0;
450 445
451 status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
452 if (status)
453 return status;
454
455 QPRINTK(qdev, IFUP, DEBUG, 446 QPRINTK(qdev, IFUP, DEBUG,
456 "%s %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s mask %s the routing reg.\n", 447 "%s %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s mask %s the routing reg.\n",
457 (enable ? "Adding" : "Removing"), 448 (enable ? "Adding" : "Removing"),
@@ -547,7 +538,6 @@ static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask,
547 ql_write32(qdev, RT_DATA, enable ? mask : 0); 538 ql_write32(qdev, RT_DATA, enable ? mask : 0);
548 } 539 }
549exit: 540exit:
550 ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
551 return status; 541 return status;
552} 542}
553 543
@@ -2916,13 +2906,17 @@ static int ql_route_initialize(struct ql_adapter *qdev)
2916 int status = 0; 2906 int status = 0;
2917 int i; 2907 int i;
2918 2908
2909 status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
2910 if (status)
2911 return status;
2912
2919 /* Clear all the entries in the routing table. */ 2913 /* Clear all the entries in the routing table. */
2920 for (i = 0; i < 16; i++) { 2914 for (i = 0; i < 16; i++) {
2921 status = ql_set_routing_reg(qdev, i, 0, 0); 2915 status = ql_set_routing_reg(qdev, i, 0, 0);
2922 if (status) { 2916 if (status) {
2923 QPRINTK(qdev, IFUP, ERR, 2917 QPRINTK(qdev, IFUP, ERR,
2924 "Failed to init routing register for CAM packets.\n"); 2918 "Failed to init routing register for CAM packets.\n");
2925 return status; 2919 goto exit;
2926 } 2920 }
2927 } 2921 }
2928 2922
@@ -2930,13 +2924,13 @@ static int ql_route_initialize(struct ql_adapter *qdev)
2930 if (status) { 2924 if (status) {
2931 QPRINTK(qdev, IFUP, ERR, 2925 QPRINTK(qdev, IFUP, ERR,
2932 "Failed to init routing register for error packets.\n"); 2926 "Failed to init routing register for error packets.\n");
2933 return status; 2927 goto exit;
2934 } 2928 }
2935 status = ql_set_routing_reg(qdev, RT_IDX_BCAST_SLOT, RT_IDX_BCAST, 1); 2929 status = ql_set_routing_reg(qdev, RT_IDX_BCAST_SLOT, RT_IDX_BCAST, 1);
2936 if (status) { 2930 if (status) {
2937 QPRINTK(qdev, IFUP, ERR, 2931 QPRINTK(qdev, IFUP, ERR,
2938 "Failed to init routing register for broadcast packets.\n"); 2932 "Failed to init routing register for broadcast packets.\n");
2939 return status; 2933 goto exit;
2940 } 2934 }
2941 /* If we have more than one inbound queue, then turn on RSS in the 2935 /* If we have more than one inbound queue, then turn on RSS in the
2942 * routing block. 2936 * routing block.
@@ -2947,17 +2941,17 @@ static int ql_route_initialize(struct ql_adapter *qdev)
2947 if (status) { 2941 if (status) {
2948 QPRINTK(qdev, IFUP, ERR, 2942 QPRINTK(qdev, IFUP, ERR,
2949 "Failed to init routing register for MATCH RSS packets.\n"); 2943 "Failed to init routing register for MATCH RSS packets.\n");
2950 return status; 2944 goto exit;
2951 } 2945 }
2952 } 2946 }
2953 2947
2954 status = ql_set_routing_reg(qdev, RT_IDX_CAM_HIT_SLOT, 2948 status = ql_set_routing_reg(qdev, RT_IDX_CAM_HIT_SLOT,
2955 RT_IDX_CAM_HIT, 1); 2949 RT_IDX_CAM_HIT, 1);
2956 if (status) { 2950 if (status)
2957 QPRINTK(qdev, IFUP, ERR, 2951 QPRINTK(qdev, IFUP, ERR,
2958 "Failed to init routing register for CAM packets.\n"); 2952 "Failed to init routing register for CAM packets.\n");
2959 return status; 2953exit:
2960 } 2954 ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
2961 return status; 2955 return status;
2962} 2956}
2963 2957
@@ -3518,6 +3512,7 @@ static void qlge_set_multicast_list(struct net_device *ndev)
3518 } 3512 }
3519exit: 3513exit:
3520 spin_unlock(&qdev->hw_lock); 3514 spin_unlock(&qdev->hw_lock);
3515 ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
3521} 3516}
3522 3517
3523static int qlge_set_mac_address(struct net_device *ndev, void *p) 3518static int qlge_set_mac_address(struct net_device *ndev, void *p)