aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge/qlge_main.c
diff options
context:
space:
mode:
authorRon Mercer <ron.mercer@qlogic.com>2009-07-02 02:06:07 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-03 22:10:21 -0400
commita5f59dc926844bf95be2261c1bb0a24597b7a8c5 (patch)
tree15d445f2952d7774a8f4737a6e95e8768ecb5d17 /drivers/net/qlge/qlge_main.c
parent4322c5bee85ed58042ec04235ec7086065ad5074 (diff)
qlge: Clear frame to queue routing before reset.
Not clearing the routing bits can cause frames to erroneously get routed to management processor. Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge/qlge_main.c')
-rw-r--r--drivers/net/qlge/qlge_main.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 7f372672ac4e..1da831e99422 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -3040,25 +3040,40 @@ static int ql_start_rss(struct ql_adapter *qdev)
3040 return status; 3040 return status;
3041} 3041}
3042 3042
3043/* Initialize the frame-to-queue routing. */ 3043static int ql_clear_routing_entries(struct ql_adapter *qdev)
3044static int ql_route_initialize(struct ql_adapter *qdev)
3045{ 3044{
3046 int status = 0; 3045 int i, status = 0;
3047 int i;
3048 3046
3049 status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); 3047 status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
3050 if (status) 3048 if (status)
3051 return status; 3049 return status;
3052
3053 /* Clear all the entries in the routing table. */ 3050 /* Clear all the entries in the routing table. */
3054 for (i = 0; i < 16; i++) { 3051 for (i = 0; i < 16; i++) {
3055 status = ql_set_routing_reg(qdev, i, 0, 0); 3052 status = ql_set_routing_reg(qdev, i, 0, 0);
3056 if (status) { 3053 if (status) {
3057 QPRINTK(qdev, IFUP, ERR, 3054 QPRINTK(qdev, IFUP, ERR,
3058 "Failed to init routing register for CAM packets.\n"); 3055 "Failed to init routing register for CAM "
3059 goto exit; 3056 "packets.\n");
3057 break;
3060 } 3058 }
3061 } 3059 }
3060 ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
3061 return status;
3062}
3063
3064/* Initialize the frame-to-queue routing. */
3065static int ql_route_initialize(struct ql_adapter *qdev)
3066{
3067 int status = 0;
3068
3069 status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK);
3070 if (status)
3071 return status;
3072
3073 /* Clear all the entries in the routing table. */
3074 status = ql_clear_routing_entries(qdev);
3075 if (status)
3076 goto exit;
3062 3077
3063 status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); 3078 status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1);
3064 if (status) { 3079 if (status) {
@@ -3211,9 +3226,17 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
3211{ 3226{
3212 u32 value; 3227 u32 value;
3213 int status = 0; 3228 int status = 0;
3214 unsigned long end_jiffies = jiffies + 3229 unsigned long end_jiffies;
3215 max((unsigned long)1, usecs_to_jiffies(30));
3216 3230
3231 /* Clear all the entries in the routing table. */
3232 status = ql_clear_routing_entries(qdev);
3233 if (status) {
3234 QPRINTK(qdev, IFUP, ERR, "Failed to clear routing bits.\n");
3235 return status;
3236 }
3237
3238 end_jiffies = jiffies +
3239 max((unsigned long)1, usecs_to_jiffies(30));
3217 ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); 3240 ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR);
3218 3241
3219 do { 3242 do {