aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bna/bna_txrx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bna/bna_txrx.c')
-rw-r--r--drivers/net/bna/bna_txrx.c149
1 files changed, 56 insertions, 93 deletions
diff --git a/drivers/net/bna/bna_txrx.c b/drivers/net/bna/bna_txrx.c
index 890846d55502..ad93fdb0f427 100644
--- a/drivers/net/bna/bna_txrx.c
+++ b/drivers/net/bna/bna_txrx.c
@@ -195,7 +195,7 @@ bna_ib_mod_uninit(struct bna_ib_mod *ib_mod)
195 ib_mod->bna = NULL; 195 ib_mod->bna = NULL;
196} 196}
197 197
198struct bna_ib * 198static struct bna_ib *
199bna_ib_get(struct bna_ib_mod *ib_mod, 199bna_ib_get(struct bna_ib_mod *ib_mod,
200 enum bna_intr_type intr_type, 200 enum bna_intr_type intr_type,
201 int vector) 201 int vector)
@@ -240,7 +240,7 @@ bna_ib_get(struct bna_ib_mod *ib_mod,
240 return ib; 240 return ib;
241} 241}
242 242
243void 243static void
244bna_ib_put(struct bna_ib_mod *ib_mod, struct bna_ib *ib) 244bna_ib_put(struct bna_ib_mod *ib_mod, struct bna_ib *ib)
245{ 245{
246 bna_intr_put(ib_mod, ib->intr); 246 bna_intr_put(ib_mod, ib->intr);
@@ -255,7 +255,7 @@ bna_ib_put(struct bna_ib_mod *ib_mod, struct bna_ib *ib)
255} 255}
256 256
257/* Returns index offset - starting from 0 */ 257/* Returns index offset - starting from 0 */
258int 258static int
259bna_ib_reserve_idx(struct bna_ib *ib) 259bna_ib_reserve_idx(struct bna_ib *ib)
260{ 260{
261 struct bna_ib_mod *ib_mod = &ib->bna->ib_mod; 261 struct bna_ib_mod *ib_mod = &ib->bna->ib_mod;
@@ -309,7 +309,7 @@ bna_ib_reserve_idx(struct bna_ib *ib)
309 return idx; 309 return idx;
310} 310}
311 311
312void 312static void
313bna_ib_release_idx(struct bna_ib *ib, int idx) 313bna_ib_release_idx(struct bna_ib *ib, int idx)
314{ 314{
315 struct bna_ib_mod *ib_mod = &ib->bna->ib_mod; 315 struct bna_ib_mod *ib_mod = &ib->bna->ib_mod;
@@ -356,7 +356,7 @@ bna_ib_release_idx(struct bna_ib *ib, int idx)
356 } 356 }
357} 357}
358 358
359int 359static int
360bna_ib_config(struct bna_ib *ib, struct bna_ib_config *ib_config) 360bna_ib_config(struct bna_ib *ib, struct bna_ib_config *ib_config)
361{ 361{
362 if (ib->start_count) 362 if (ib->start_count)
@@ -374,7 +374,7 @@ bna_ib_config(struct bna_ib *ib, struct bna_ib_config *ib_config)
374 return 0; 374 return 0;
375} 375}
376 376
377void 377static void
378bna_ib_start(struct bna_ib *ib) 378bna_ib_start(struct bna_ib *ib)
379{ 379{
380 struct bna_ib_blk_mem ib_cfg; 380 struct bna_ib_blk_mem ib_cfg;
@@ -450,7 +450,7 @@ bna_ib_start(struct bna_ib *ib)
450 } 450 }
451} 451}
452 452
453void 453static void
454bna_ib_stop(struct bna_ib *ib) 454bna_ib_stop(struct bna_ib *ib)
455{ 455{
456 u32 intx_mask; 456 u32 intx_mask;
@@ -468,7 +468,7 @@ bna_ib_stop(struct bna_ib *ib)
468 } 468 }
469} 469}
470 470
471void 471static void
472bna_ib_fail(struct bna_ib *ib) 472bna_ib_fail(struct bna_ib *ib)
473{ 473{
474 ib->start_count = 0; 474 ib->start_count = 0;
@@ -1394,7 +1394,7 @@ rxf_reset_packet_filter(struct bna_rxf *rxf)
1394 rxf_reset_packet_filter_allmulti(rxf); 1394 rxf_reset_packet_filter_allmulti(rxf);
1395} 1395}
1396 1396
1397void 1397static void
1398bna_rxf_init(struct bna_rxf *rxf, 1398bna_rxf_init(struct bna_rxf *rxf,
1399 struct bna_rx *rx, 1399 struct bna_rx *rx,
1400 struct bna_rx_config *q_config) 1400 struct bna_rx_config *q_config)
@@ -1444,7 +1444,7 @@ bna_rxf_init(struct bna_rxf *rxf,
1444 bfa_fsm_set_state(rxf, bna_rxf_sm_stopped); 1444 bfa_fsm_set_state(rxf, bna_rxf_sm_stopped);
1445} 1445}
1446 1446
1447void 1447static void
1448bna_rxf_uninit(struct bna_rxf *rxf) 1448bna_rxf_uninit(struct bna_rxf *rxf)
1449{ 1449{
1450 struct bna_mac *mac; 1450 struct bna_mac *mac;
@@ -1476,7 +1476,18 @@ bna_rxf_uninit(struct bna_rxf *rxf)
1476 rxf->rx = NULL; 1476 rxf->rx = NULL;
1477} 1477}
1478 1478
1479void 1479static void
1480bna_rx_cb_rxf_started(struct bna_rx *rx, enum bna_cb_status status)
1481{
1482 bfa_fsm_send_event(rx, RX_E_RXF_STARTED);
1483 if (rx->rxf.rxf_id < 32)
1484 rx->bna->rx_mod.rxf_bmap[0] |= ((u32)1 << rx->rxf.rxf_id);
1485 else
1486 rx->bna->rx_mod.rxf_bmap[1] |= ((u32)
1487 1 << (rx->rxf.rxf_id - 32));
1488}
1489
1490static void
1480bna_rxf_start(struct bna_rxf *rxf) 1491bna_rxf_start(struct bna_rxf *rxf)
1481{ 1492{
1482 rxf->start_cbfn = bna_rx_cb_rxf_started; 1493 rxf->start_cbfn = bna_rx_cb_rxf_started;
@@ -1485,7 +1496,18 @@ bna_rxf_start(struct bna_rxf *rxf)
1485 bfa_fsm_send_event(rxf, RXF_E_START); 1496 bfa_fsm_send_event(rxf, RXF_E_START);
1486} 1497}
1487 1498
1488void 1499static void
1500bna_rx_cb_rxf_stopped(struct bna_rx *rx, enum bna_cb_status status)
1501{
1502 bfa_fsm_send_event(rx, RX_E_RXF_STOPPED);
1503 if (rx->rxf.rxf_id < 32)
1504 rx->bna->rx_mod.rxf_bmap[0] &= ~(u32)1 << rx->rxf.rxf_id;
1505 else
1506 rx->bna->rx_mod.rxf_bmap[1] &= ~(u32)
1507 1 << (rx->rxf.rxf_id - 32);
1508}
1509
1510static void
1489bna_rxf_stop(struct bna_rxf *rxf) 1511bna_rxf_stop(struct bna_rxf *rxf)
1490{ 1512{
1491 rxf->stop_cbfn = bna_rx_cb_rxf_stopped; 1513 rxf->stop_cbfn = bna_rx_cb_rxf_stopped;
@@ -1493,7 +1515,7 @@ bna_rxf_stop(struct bna_rxf *rxf)
1493 bfa_fsm_send_event(rxf, RXF_E_STOP); 1515 bfa_fsm_send_event(rxf, RXF_E_STOP);
1494} 1516}
1495 1517
1496void 1518static void
1497bna_rxf_fail(struct bna_rxf *rxf) 1519bna_rxf_fail(struct bna_rxf *rxf)
1498{ 1520{
1499 rxf->rxf_flags |= BNA_RXF_FL_FAILED; 1521 rxf->rxf_flags |= BNA_RXF_FL_FAILED;
@@ -1576,43 +1598,6 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr,
1576} 1598}
1577 1599
1578enum bna_cb_status 1600enum bna_cb_status
1579bna_rx_mcast_del(struct bna_rx *rx, u8 *addr,
1580 void (*cbfn)(struct bnad *, struct bna_rx *,
1581 enum bna_cb_status))
1582{
1583 struct bna_rxf *rxf = &rx->rxf;
1584 struct list_head *qe;
1585 struct bna_mac *mac;
1586
1587 list_for_each(qe, &rxf->mcast_pending_add_q) {
1588 mac = (struct bna_mac *)qe;
1589 if (BNA_MAC_IS_EQUAL(mac->addr, addr)) {
1590 list_del(qe);
1591 bfa_q_qe_init(qe);
1592 bna_mcam_mod_mac_put(&rxf->rx->bna->mcam_mod, mac);
1593 if (cbfn)
1594 (*cbfn)(rx->bna->bnad, rx, BNA_CB_SUCCESS);
1595 return BNA_CB_SUCCESS;
1596 }
1597 }
1598
1599 list_for_each(qe, &rxf->mcast_active_q) {
1600 mac = (struct bna_mac *)qe;
1601 if (BNA_MAC_IS_EQUAL(mac->addr, addr)) {
1602 list_del(qe);
1603 bfa_q_qe_init(qe);
1604 list_add_tail(qe, &rxf->mcast_pending_del_q);
1605 rxf->cam_fltr_cbfn = cbfn;
1606 rxf->cam_fltr_cbarg = rx->bna->bnad;
1607 bfa_fsm_send_event(rxf, RXF_E_CAM_FLTR_MOD);
1608 return BNA_CB_SUCCESS;
1609 }
1610 }
1611
1612 return BNA_CB_INVALID_MAC;
1613}
1614
1615enum bna_cb_status
1616bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mclist, 1601bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mclist,
1617 void (*cbfn)(struct bnad *, struct bna_rx *, 1602 void (*cbfn)(struct bnad *, struct bna_rx *,
1618 enum bna_cb_status)) 1603 enum bna_cb_status))
@@ -1862,7 +1847,7 @@ bfa_fsm_state_decl(bna_rx, rxf_stop_wait,
1862bfa_fsm_state_decl(bna_rx, rxq_stop_wait, 1847bfa_fsm_state_decl(bna_rx, rxq_stop_wait,
1863 struct bna_rx, enum bna_rx_event); 1848 struct bna_rx, enum bna_rx_event);
1864 1849
1865static struct bfa_sm_table rx_sm_table[] = { 1850static const struct bfa_sm_table rx_sm_table[] = {
1866 {BFA_SM(bna_rx_sm_stopped), BNA_RX_STOPPED}, 1851 {BFA_SM(bna_rx_sm_stopped), BNA_RX_STOPPED},
1867 {BFA_SM(bna_rx_sm_rxf_start_wait), BNA_RX_RXF_START_WAIT}, 1852 {BFA_SM(bna_rx_sm_rxf_start_wait), BNA_RX_RXF_START_WAIT},
1868 {BFA_SM(bna_rx_sm_started), BNA_RX_STARTED}, 1853 {BFA_SM(bna_rx_sm_started), BNA_RX_STARTED},
@@ -2247,7 +2232,7 @@ bna_rit_create(struct bna_rx *rx)
2247 } 2232 }
2248} 2233}
2249 2234
2250int 2235static int
2251_rx_can_satisfy(struct bna_rx_mod *rx_mod, 2236_rx_can_satisfy(struct bna_rx_mod *rx_mod,
2252 struct bna_rx_config *rx_cfg) 2237 struct bna_rx_config *rx_cfg)
2253{ 2238{
@@ -2272,7 +2257,7 @@ _rx_can_satisfy(struct bna_rx_mod *rx_mod,
2272 return 1; 2257 return 1;
2273} 2258}
2274 2259
2275struct bna_rxq * 2260static struct bna_rxq *
2276_get_free_rxq(struct bna_rx_mod *rx_mod) 2261_get_free_rxq(struct bna_rx_mod *rx_mod)
2277{ 2262{
2278 struct bna_rxq *rxq = NULL; 2263 struct bna_rxq *rxq = NULL;
@@ -2286,7 +2271,7 @@ _get_free_rxq(struct bna_rx_mod *rx_mod)
2286 return rxq; 2271 return rxq;
2287} 2272}
2288 2273
2289void 2274static void
2290_put_free_rxq(struct bna_rx_mod *rx_mod, struct bna_rxq *rxq) 2275_put_free_rxq(struct bna_rx_mod *rx_mod, struct bna_rxq *rxq)
2291{ 2276{
2292 bfa_q_qe_init(&rxq->qe); 2277 bfa_q_qe_init(&rxq->qe);
@@ -2294,7 +2279,7 @@ _put_free_rxq(struct bna_rx_mod *rx_mod, struct bna_rxq *rxq)
2294 rx_mod->rxq_free_count++; 2279 rx_mod->rxq_free_count++;
2295} 2280}
2296 2281
2297struct bna_rxp * 2282static struct bna_rxp *
2298_get_free_rxp(struct bna_rx_mod *rx_mod) 2283_get_free_rxp(struct bna_rx_mod *rx_mod)
2299{ 2284{
2300 struct list_head *qe = NULL; 2285 struct list_head *qe = NULL;
@@ -2310,7 +2295,7 @@ _get_free_rxp(struct bna_rx_mod *rx_mod)
2310 return rxp; 2295 return rxp;
2311} 2296}
2312 2297
2313void 2298static void
2314_put_free_rxp(struct bna_rx_mod *rx_mod, struct bna_rxp *rxp) 2299_put_free_rxp(struct bna_rx_mod *rx_mod, struct bna_rxp *rxp)
2315{ 2300{
2316 bfa_q_qe_init(&rxp->qe); 2301 bfa_q_qe_init(&rxp->qe);
@@ -2318,7 +2303,7 @@ _put_free_rxp(struct bna_rx_mod *rx_mod, struct bna_rxp *rxp)
2318 rx_mod->rxp_free_count++; 2303 rx_mod->rxp_free_count++;
2319} 2304}
2320 2305
2321struct bna_rx * 2306static struct bna_rx *
2322_get_free_rx(struct bna_rx_mod *rx_mod) 2307_get_free_rx(struct bna_rx_mod *rx_mod)
2323{ 2308{
2324 struct list_head *qe = NULL; 2309 struct list_head *qe = NULL;
@@ -2336,7 +2321,7 @@ _get_free_rx(struct bna_rx_mod *rx_mod)
2336 return rx; 2321 return rx;
2337} 2322}
2338 2323
2339void 2324static void
2340_put_free_rx(struct bna_rx_mod *rx_mod, struct bna_rx *rx) 2325_put_free_rx(struct bna_rx_mod *rx_mod, struct bna_rx *rx)
2341{ 2326{
2342 bfa_q_qe_init(&rx->qe); 2327 bfa_q_qe_init(&rx->qe);
@@ -2344,7 +2329,7 @@ _put_free_rx(struct bna_rx_mod *rx_mod, struct bna_rx *rx)
2344 rx_mod->rx_free_count++; 2329 rx_mod->rx_free_count++;
2345} 2330}
2346 2331
2347void 2332static void
2348_rx_init(struct bna_rx *rx, struct bna *bna) 2333_rx_init(struct bna_rx *rx, struct bna *bna)
2349{ 2334{
2350 rx->bna = bna; 2335 rx->bna = bna;
@@ -2360,7 +2345,7 @@ _rx_init(struct bna_rx *rx, struct bna *bna)
2360 rx->stop_cbarg = NULL; 2345 rx->stop_cbarg = NULL;
2361} 2346}
2362 2347
2363void 2348static void
2364_rxp_add_rxqs(struct bna_rxp *rxp, 2349_rxp_add_rxqs(struct bna_rxp *rxp,
2365 struct bna_rxq *q0, 2350 struct bna_rxq *q0,
2366 struct bna_rxq *q1) 2351 struct bna_rxq *q1)
@@ -2383,7 +2368,7 @@ _rxp_add_rxqs(struct bna_rxp *rxp,
2383 } 2368 }
2384} 2369}
2385 2370
2386void 2371static void
2387_rxq_qpt_init(struct bna_rxq *rxq, 2372_rxq_qpt_init(struct bna_rxq *rxq,
2388 struct bna_rxp *rxp, 2373 struct bna_rxp *rxp,
2389 u32 page_count, 2374 u32 page_count,
@@ -2412,7 +2397,7 @@ _rxq_qpt_init(struct bna_rxq *rxq,
2412 } 2397 }
2413} 2398}
2414 2399
2415void 2400static void
2416_rxp_cqpt_setup(struct bna_rxp *rxp, 2401_rxp_cqpt_setup(struct bna_rxp *rxp,
2417 u32 page_count, 2402 u32 page_count,
2418 u32 page_size, 2403 u32 page_size,
@@ -2441,13 +2426,13 @@ _rxp_cqpt_setup(struct bna_rxp *rxp,
2441 } 2426 }
2442} 2427}
2443 2428
2444void 2429static void
2445_rx_add_rxp(struct bna_rx *rx, struct bna_rxp *rxp) 2430_rx_add_rxp(struct bna_rx *rx, struct bna_rxp *rxp)
2446{ 2431{
2447 list_add_tail(&rxp->qe, &rx->rxp_q); 2432 list_add_tail(&rxp->qe, &rx->rxp_q);
2448} 2433}
2449 2434
2450void 2435static void
2451_init_rxmod_queues(struct bna_rx_mod *rx_mod) 2436_init_rxmod_queues(struct bna_rx_mod *rx_mod)
2452{ 2437{
2453 INIT_LIST_HEAD(&rx_mod->rx_free_q); 2438 INIT_LIST_HEAD(&rx_mod->rx_free_q);
@@ -2460,7 +2445,7 @@ _init_rxmod_queues(struct bna_rx_mod *rx_mod)
2460 rx_mod->rxp_free_count = 0; 2445 rx_mod->rxp_free_count = 0;
2461} 2446}
2462 2447
2463void 2448static void
2464_rx_ctor(struct bna_rx *rx, int id) 2449_rx_ctor(struct bna_rx *rx, int id)
2465{ 2450{
2466 bfa_q_qe_init(&rx->qe); 2451 bfa_q_qe_init(&rx->qe);
@@ -2492,7 +2477,7 @@ bna_rx_cb_rxq_stopped_all(void *arg)
2492 bfa_fsm_send_event(rx, RX_E_RXQ_STOPPED); 2477 bfa_fsm_send_event(rx, RX_E_RXQ_STOPPED);
2493} 2478}
2494 2479
2495void 2480static void
2496bna_rx_mod_cb_rx_stopped(void *arg, struct bna_rx *rx, 2481bna_rx_mod_cb_rx_stopped(void *arg, struct bna_rx *rx,
2497 enum bna_cb_status status) 2482 enum bna_cb_status status)
2498{ 2483{
@@ -2501,7 +2486,7 @@ bna_rx_mod_cb_rx_stopped(void *arg, struct bna_rx *rx,
2501 bfa_wc_down(&rx_mod->rx_stop_wc); 2486 bfa_wc_down(&rx_mod->rx_stop_wc);
2502} 2487}
2503 2488
2504void 2489static void
2505bna_rx_mod_cb_rx_stopped_all(void *arg) 2490bna_rx_mod_cb_rx_stopped_all(void *arg)
2506{ 2491{
2507 struct bna_rx_mod *rx_mod = (struct bna_rx_mod *)arg; 2492 struct bna_rx_mod *rx_mod = (struct bna_rx_mod *)arg;
@@ -2511,7 +2496,7 @@ bna_rx_mod_cb_rx_stopped_all(void *arg)
2511 rx_mod->stop_cbfn = NULL; 2496 rx_mod->stop_cbfn = NULL;
2512} 2497}
2513 2498
2514void 2499static void
2515bna_rx_start(struct bna_rx *rx) 2500bna_rx_start(struct bna_rx *rx)
2516{ 2501{
2517 rx->rx_flags |= BNA_RX_F_PORT_ENABLED; 2502 rx->rx_flags |= BNA_RX_F_PORT_ENABLED;
@@ -2519,7 +2504,7 @@ bna_rx_start(struct bna_rx *rx)
2519 bfa_fsm_send_event(rx, RX_E_START); 2504 bfa_fsm_send_event(rx, RX_E_START);
2520} 2505}
2521 2506
2522void 2507static void
2523bna_rx_stop(struct bna_rx *rx) 2508bna_rx_stop(struct bna_rx *rx)
2524{ 2509{
2525 rx->rx_flags &= ~BNA_RX_F_PORT_ENABLED; 2510 rx->rx_flags &= ~BNA_RX_F_PORT_ENABLED;
@@ -2532,7 +2517,7 @@ bna_rx_stop(struct bna_rx *rx)
2532 } 2517 }
2533} 2518}
2534 2519
2535void 2520static void
2536bna_rx_fail(struct bna_rx *rx) 2521bna_rx_fail(struct bna_rx *rx)
2537{ 2522{
2538 /* Indicate port is not enabled, and failed */ 2523 /* Indicate port is not enabled, and failed */
@@ -2542,28 +2527,6 @@ bna_rx_fail(struct bna_rx *rx)
2542} 2527}
2543 2528
2544void 2529void
2545bna_rx_cb_rxf_started(struct bna_rx *rx, enum bna_cb_status status)
2546{
2547 bfa_fsm_send_event(rx, RX_E_RXF_STARTED);
2548 if (rx->rxf.rxf_id < 32)
2549 rx->bna->rx_mod.rxf_bmap[0] |= ((u32)1 << rx->rxf.rxf_id);
2550 else
2551 rx->bna->rx_mod.rxf_bmap[1] |= ((u32)
2552 1 << (rx->rxf.rxf_id - 32));
2553}
2554
2555void
2556bna_rx_cb_rxf_stopped(struct bna_rx *rx, enum bna_cb_status status)
2557{
2558 bfa_fsm_send_event(rx, RX_E_RXF_STOPPED);
2559 if (rx->rxf.rxf_id < 32)
2560 rx->bna->rx_mod.rxf_bmap[0] &= ~(u32)1 << rx->rxf.rxf_id;
2561 else
2562 rx->bna->rx_mod.rxf_bmap[1] &= ~(u32)
2563 1 << (rx->rxf.rxf_id - 32);
2564}
2565
2566void
2567bna_rx_mod_start(struct bna_rx_mod *rx_mod, enum bna_rx_type type) 2530bna_rx_mod_start(struct bna_rx_mod *rx_mod, enum bna_rx_type type)
2568{ 2531{
2569 struct bna_rx *rx; 2532 struct bna_rx *rx;
@@ -3731,7 +3694,7 @@ bna_tx_fail(struct bna_tx *tx)
3731 bfa_fsm_send_event(tx, TX_E_FAIL); 3694 bfa_fsm_send_event(tx, TX_E_FAIL);
3732} 3695}
3733 3696
3734void 3697static void
3735bna_tx_prio_changed(struct bna_tx *tx, int prio) 3698bna_tx_prio_changed(struct bna_tx *tx, int prio)
3736{ 3699{
3737 struct bna_txq *txq; 3700 struct bna_txq *txq;