aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2010-10-05 23:17:22 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-06 17:09:24 -0400
commit541a78103f097cd5120e55aaba56d099a64f153c (patch)
treed549c73642ae55c82daa59724bd806961af049fd /drivers/net/cnic.c
parent1420398db4d5e236583d3ab392637df255bd5c6b (diff)
cnic: Fine-tune ring init code.
Initialize the rings only during cnic_uio_open() and shut them down during cnic_uio_close(). Check for the new bit CNIC_LCL_FL_RINGS_INITED before checking for ring interrupt. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 50cded7fff51..4e9d4ae1f303 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -2202,13 +2202,14 @@ static int cnic_l2_completion(struct cnic_local *cp)
2202 2202
2203static void cnic_chk_pkt_rings(struct cnic_local *cp) 2203static void cnic_chk_pkt_rings(struct cnic_local *cp)
2204{ 2204{
2205 u16 rx_cons = *cp->rx_cons_ptr; 2205 u16 rx_cons, tx_cons;
2206 u16 tx_cons = *cp->tx_cons_ptr;
2207 int comp = 0; 2206 int comp = 0;
2208 2207
2209 if (!test_bit(CNIC_F_CNIC_UP, &cp->dev->flags)) 2208 if (!test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags))
2210 return; 2209 return;
2211 2210
2211 rx_cons = *cp->rx_cons_ptr;
2212 tx_cons = *cp->tx_cons_ptr;
2212 if (cp->tx_cons != tx_cons || cp->rx_cons != rx_cons) { 2213 if (cp->tx_cons != tx_cons || cp->rx_cons != rx_cons) {
2213 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags)) 2214 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags))
2214 comp = cnic_l2_completion(cp); 2215 comp = cnic_l2_completion(cp);
@@ -4202,17 +4203,20 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4202 if (ret) 4203 if (ret)
4203 return ret; 4204 return ret;
4204 4205
4205 cnic_init_bnx2x_tx_ring(dev);
4206 cnic_init_bnx2x_rx_ring(dev);
4207
4208 return 0; 4206 return 0;
4209} 4207}
4210 4208
4211static void cnic_init_rings(struct cnic_dev *dev) 4209static void cnic_init_rings(struct cnic_dev *dev)
4212{ 4210{
4211 struct cnic_local *cp = dev->cnic_priv;
4212
4213 if (test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags))
4214 return;
4215
4213 if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) { 4216 if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) {
4214 cnic_init_bnx2_tx_ring(dev); 4217 cnic_init_bnx2_tx_ring(dev);
4215 cnic_init_bnx2_rx_ring(dev); 4218 cnic_init_bnx2_rx_ring(dev);
4219 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags);
4216 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { 4220 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) {
4217 struct cnic_local *cp = dev->cnic_priv; 4221 struct cnic_local *cp = dev->cnic_priv;
4218 u32 cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp)); 4222 u32 cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp));
@@ -4235,6 +4239,8 @@ static void cnic_init_rings(struct cnic_dev *dev)
4235 cnic_init_bnx2x_tx_ring(dev); 4239 cnic_init_bnx2x_tx_ring(dev);
4236 cnic_init_bnx2x_rx_ring(dev); 4240 cnic_init_bnx2x_rx_ring(dev);
4237 4241
4242 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags);
4243
4238 l5_data.phy_address.lo = cli; 4244 l5_data.phy_address.lo = cli;
4239 l5_data.phy_address.hi = 0; 4245 l5_data.phy_address.hi = 0;
4240 cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_ETH_CLIENT_SETUP, 4246 cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_ETH_CLIENT_SETUP,
@@ -4254,6 +4260,11 @@ static void cnic_init_rings(struct cnic_dev *dev)
4254 4260
4255static void cnic_shutdown_rings(struct cnic_dev *dev) 4261static void cnic_shutdown_rings(struct cnic_dev *dev)
4256{ 4262{
4263 struct cnic_local *cp = dev->cnic_priv;
4264
4265 if (!test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags))
4266 return;
4267
4257 if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) { 4268 if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) {
4258 cnic_shutdown_bnx2_rx_ring(dev); 4269 cnic_shutdown_bnx2_rx_ring(dev);
4259 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { 4270 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) {
@@ -4286,6 +4297,7 @@ static void cnic_shutdown_rings(struct cnic_dev *dev)
4286 (1 << SPE_HDR_COMMON_RAMROD_SHIFT), &l5_data); 4297 (1 << SPE_HDR_COMMON_RAMROD_SHIFT), &l5_data);
4287 msleep(10); 4298 msleep(10);
4288 } 4299 }
4300 clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags);
4289} 4301}
4290 4302
4291static int cnic_register_netdev(struct cnic_dev *dev) 4303static int cnic_register_netdev(struct cnic_dev *dev)