Commit 8587ea35 authored by Ron Mercer's avatar Ron Mercer Committed by David S. Miller

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: default avatarRon Mercer <ron.mercer@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cc288f54
...@@ -418,10 +418,6 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value) ...@@ -418,10 +418,6 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value)
{ {
int status = 0; int status = 0;
status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
if (status)
goto exit;
status = ql_wait_reg_rdy(qdev, RT_IDX, RT_IDX_MW, 0); status = ql_wait_reg_rdy(qdev, RT_IDX, RT_IDX_MW, 0);
if (status) if (status)
goto exit; goto exit;
...@@ -433,7 +429,6 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value) ...@@ -433,7 +429,6 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value)
goto exit; goto exit;
*value = ql_read32(qdev, RT_DATA); *value = ql_read32(qdev, RT_DATA);
exit: exit:
ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
return status; return status;
} }
...@@ -445,13 +440,9 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value) ...@@ -445,13 +440,9 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value)
static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask, static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask,
int enable) int enable)
{ {
int status; int status = -EINVAL; /* Return error if no mask match. */
u32 value = 0; u32 value = 0;
status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
if (status)
return status;
QPRINTK(qdev, IFUP, DEBUG, QPRINTK(qdev, IFUP, DEBUG,
"%s %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s mask %s the routing reg.\n", "%s %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s mask %s the routing reg.\n",
(enable ? "Adding" : "Removing"), (enable ? "Adding" : "Removing"),
...@@ -547,7 +538,6 @@ static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask, ...@@ -547,7 +538,6 @@ static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask,
ql_write32(qdev, RT_DATA, enable ? mask : 0); ql_write32(qdev, RT_DATA, enable ? mask : 0);
} }
exit: exit:
ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
return status; return status;
} }
...@@ -2916,13 +2906,17 @@ static int ql_route_initialize(struct ql_adapter *qdev) ...@@ -2916,13 +2906,17 @@ static int ql_route_initialize(struct ql_adapter *qdev)
int status = 0; int status = 0;
int i; int i;
status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
if (status)
return status;
/* Clear all the entries in the routing table. */ /* Clear all the entries in the routing table. */
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
status = ql_set_routing_reg(qdev, i, 0, 0); status = ql_set_routing_reg(qdev, i, 0, 0);
if (status) { if (status) {
QPRINTK(qdev, IFUP, ERR, QPRINTK(qdev, IFUP, ERR,
"Failed to init routing register for CAM packets.\n"); "Failed to init routing register for CAM packets.\n");
return status; goto exit;
} }
} }
...@@ -2930,13 +2924,13 @@ static int ql_route_initialize(struct ql_adapter *qdev) ...@@ -2930,13 +2924,13 @@ static int ql_route_initialize(struct ql_adapter *qdev)
if (status) { if (status) {
QPRINTK(qdev, IFUP, ERR, QPRINTK(qdev, IFUP, ERR,
"Failed to init routing register for error packets.\n"); "Failed to init routing register for error packets.\n");
return status; goto exit;
} }
status = ql_set_routing_reg(qdev, RT_IDX_BCAST_SLOT, RT_IDX_BCAST, 1); status = ql_set_routing_reg(qdev, RT_IDX_BCAST_SLOT, RT_IDX_BCAST, 1);
if (status) { if (status) {
QPRINTK(qdev, IFUP, ERR, QPRINTK(qdev, IFUP, ERR,
"Failed to init routing register for broadcast packets.\n"); "Failed to init routing register for broadcast packets.\n");
return status; goto exit;
} }
/* If we have more than one inbound queue, then turn on RSS in the /* If we have more than one inbound queue, then turn on RSS in the
* routing block. * routing block.
...@@ -2947,17 +2941,17 @@ static int ql_route_initialize(struct ql_adapter *qdev) ...@@ -2947,17 +2941,17 @@ static int ql_route_initialize(struct ql_adapter *qdev)
if (status) { if (status) {
QPRINTK(qdev, IFUP, ERR, QPRINTK(qdev, IFUP, ERR,
"Failed to init routing register for MATCH RSS packets.\n"); "Failed to init routing register for MATCH RSS packets.\n");
return status; goto exit;
} }
} }
status = ql_set_routing_reg(qdev, RT_IDX_CAM_HIT_SLOT, status = ql_set_routing_reg(qdev, RT_IDX_CAM_HIT_SLOT,
RT_IDX_CAM_HIT, 1); RT_IDX_CAM_HIT, 1);
if (status) { if (status)
QPRINTK(qdev, IFUP, ERR, QPRINTK(qdev, IFUP, ERR,
"Failed to init routing register for CAM packets.\n"); "Failed to init routing register for CAM packets.\n");
return status; exit:
} ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
return status; return status;
} }
...@@ -3518,6 +3512,7 @@ static void qlge_set_multicast_list(struct net_device *ndev) ...@@ -3518,6 +3512,7 @@ static void qlge_set_multicast_list(struct net_device *ndev)
} }
exit: exit:
spin_unlock(&qdev->hw_lock); spin_unlock(&qdev->hw_lock);
ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
} }
static int qlge_set_mac_address(struct net_device *ndev, void *p) static int qlge_set_mac_address(struct net_device *ndev, void *p)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment