* drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
@ 2022-02-12 18:17 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-02-12 18:17 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 9815 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Íñigo Huguet" <ihuguet@redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 83e396641110663d3c7bb25b9bc0c6a750359ecf
commit: 52bfcdd87e83d9e69d22da5f26b1512ffc81deed net:CXGB4: fix leak if sk_buff is not used
date: 9 months ago
:::::: branch date: 19 hours ago
:::::: commit date: 9 months ago
config: s390-randconfig-m031-20220212 (https://download.01.org/0day-ci/archive/20220213/202202130145.Kxy8vUqm-lkp(a)intel.com/config)
compiler: s390-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
Old smatch warnings:
drivers/net/ethernet/chelsio/cxgb4/sge.c:4169 process_intrq() warn: potential spectre issue 'adap->sge.ingr_map' [w]
drivers/net/ethernet/chelsio/cxgb4/sge.c:4484 t4_sge_alloc_rxq() warn: potential spectre issue 'adap->sge.ingr_map' [w]
drivers/net/ethernet/chelsio/cxgb4/sge.c:4491 t4_sge_alloc_rxq() warn: potential spectre issue 'adap->sge.egr_map' [w]
vim +/ret +2566 drivers/net/ethernet/chelsio/cxgb4/sge.c
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2524
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2525 /**
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2526 * cxgb4_ethofld_send_flowc - Send ETHOFLD flowc request to bind eotid to tc.
29bbf5d7f5efe8 Rahul Lakkireddy 2020-06-24 2527 * @dev: netdevice
29bbf5d7f5efe8 Rahul Lakkireddy 2020-06-24 2528 * @eotid: ETHOFLD tid to bind/unbind
29bbf5d7f5efe8 Rahul Lakkireddy 2020-06-24 2529 * @tc: traffic class. If set to FW_SCHED_CLS_NONE, then unbinds the @eotid
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2530 *
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2531 * Send a FLOWC work request to bind an ETHOFLD TID to a traffic class.
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2532 * If @tc is set to FW_SCHED_CLS_NONE, then the @eotid is unbound from
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2533 * a traffic class.
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2534 */
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2535 int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2536 {
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2537 struct port_info *pi = netdev2pinfo(dev);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2538 struct adapter *adap = netdev2adap(dev);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2539 enum sge_eosw_state next_state;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2540 struct sge_eosw_txq *eosw_txq;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2541 u32 len, len16, nparams = 6;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2542 struct fw_flowc_wr *flowc;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2543 struct eotid_entry *entry;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2544 struct sge_ofld_rxq *rxq;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2545 struct sk_buff *skb;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2546 int ret = 0;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2547
a422d5ff6defb1 Gustavo A. R. Silva 2020-06-19 2548 len = struct_size(flowc, mnemval, nparams);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2549 len16 = DIV_ROUND_UP(len, 16);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2550
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2551 entry = cxgb4_lookup_eotid(&adap->tids, eotid);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2552 if (!entry)
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2553 return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2554
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2555 eosw_txq = (struct sge_eosw_txq *)entry->data;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2556 if (!eosw_txq)
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2557 return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2558
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2559 skb = alloc_skb(len, GFP_KERNEL);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2560 if (!skb)
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2561 return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2562
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2563 spin_lock_bh(&eosw_txq->lock);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2564 if (tc != FW_SCHED_CLS_NONE) {
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2565 if (eosw_txq->state != CXGB4_EO_STATE_CLOSED)
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 @2566 goto out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2567
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2568 next_state = CXGB4_EO_STATE_FLOWC_OPEN_SEND;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2569 } else {
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2570 if (eosw_txq->state != CXGB4_EO_STATE_ACTIVE)
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2571 goto out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2572
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2573 next_state = CXGB4_EO_STATE_FLOWC_CLOSE_SEND;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2574 }
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2575
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2576 flowc = __skb_put(skb, len);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2577 memset(flowc, 0, len);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2578
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2579 rxq = &adap->sge.eohw_rxq[eosw_txq->hwqid];
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2580 flowc->flowid_len16 = cpu_to_be32(FW_WR_LEN16_V(len16) |
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2581 FW_WR_FLOWID_V(eosw_txq->hwtid));
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2582 flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2583 FW_FLOWC_WR_NPARAMS_V(nparams) |
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2584 FW_WR_COMPL_V(1));
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2585 flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2586 flowc->mnemval[0].val = cpu_to_be32(FW_PFVF_CMD_PFN_V(adap->pf));
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2587 flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2588 flowc->mnemval[1].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2589 flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2590 flowc->mnemval[2].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2591 flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2592 flowc->mnemval[3].val = cpu_to_be32(rxq->rspq.abs_id);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2593 flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SCHEDCLASS;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2594 flowc->mnemval[4].val = cpu_to_be32(tc);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2595 flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_EOSTATE;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2596 flowc->mnemval[5].val = cpu_to_be32(tc == FW_SCHED_CLS_NONE ?
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2597 FW_FLOWC_MNEM_EOSTATE_CLOSING :
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2598 FW_FLOWC_MNEM_EOSTATE_ESTABLISHED);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2599
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2600 /* Free up any pending skbs to ensure there's room for
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2601 * termination FLOWC.
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2602 */
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2603 if (tc == FW_SCHED_CLS_NONE)
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2604 eosw_txq_flush_pending_skbs(eosw_txq);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2605
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2606 ret = eosw_txq_enqueue(eosw_txq, skb);
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2607 if (ret)
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2608 goto out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2609
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2610 eosw_txq->state = next_state;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2611 eosw_txq->flowc_idx = eosw_txq->pidx;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2612 eosw_txq_advance(eosw_txq, 1);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2613 ethofld_xmit(dev, eosw_txq);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2614
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2615 spin_unlock_bh(&eosw_txq->lock);
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2616 return 0;
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2617
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2618 out_free_skb:
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2619 dev_consume_skb_any(skb);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2620 spin_unlock_bh(&eosw_txq->lock);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2621 return ret;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2622 }
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2623
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
@ 2022-03-10 7:49 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-03-09 15:27 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 10053 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: "Íñigo Huguet" <ihuguet@redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 330f4c53d3c2d8b11d86ec03a964b86dc81452f5
commit: 52bfcdd87e83d9e69d22da5f26b1512ffc81deed net:CXGB4: fix leak if sk_buff is not used
date: 10 months ago
:::::: branch date: 18 hours ago
:::::: commit date: 10 months ago
config: microblaze-randconfig-m031-20220308 (https://download.01.org/0day-ci/archive/20220309/202203092354.8QMmp2o7-lkp(a)intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
Old smatch warnings:
arch/microblaze/include/asm/thread_info.h:91 current_thread_info() error: uninitialized symbol 'sp'.
drivers/net/ethernet/chelsio/cxgb4/sge.c:4169 process_intrq() warn: potential spectre issue 'adap->sge.ingr_map' [w]
drivers/net/ethernet/chelsio/cxgb4/sge.c:4484 t4_sge_alloc_rxq() warn: potential spectre issue 'adap->sge.ingr_map' [w]
drivers/net/ethernet/chelsio/cxgb4/sge.c:4491 t4_sge_alloc_rxq() warn: potential spectre issue 'adap->sge.egr_map' [w]
vim +/ret +2566 drivers/net/ethernet/chelsio/cxgb4/sge.c
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2524
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2525 /**
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2526 * cxgb4_ethofld_send_flowc - Send ETHOFLD flowc request to bind eotid to tc.
29bbf5d7f5efe84 Rahul Lakkireddy 2020-06-24 2527 * @dev: netdevice
29bbf5d7f5efe84 Rahul Lakkireddy 2020-06-24 2528 * @eotid: ETHOFLD tid to bind/unbind
29bbf5d7f5efe84 Rahul Lakkireddy 2020-06-24 2529 * @tc: traffic class. If set to FW_SCHED_CLS_NONE, then unbinds the @eotid
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2530 *
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2531 * Send a FLOWC work request to bind an ETHOFLD TID to a traffic class.
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2532 * If @tc is set to FW_SCHED_CLS_NONE, then the @eotid is unbound from
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2533 * a traffic class.
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2534 */
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2535 int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2536 {
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2537 struct port_info *pi = netdev2pinfo(dev);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2538 struct adapter *adap = netdev2adap(dev);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2539 enum sge_eosw_state next_state;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2540 struct sge_eosw_txq *eosw_txq;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2541 u32 len, len16, nparams = 6;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2542 struct fw_flowc_wr *flowc;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2543 struct eotid_entry *entry;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2544 struct sge_ofld_rxq *rxq;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2545 struct sk_buff *skb;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2546 int ret = 0;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2547
a422d5ff6defb1c Gustavo A. R. Silva 2020-06-19 2548 len = struct_size(flowc, mnemval, nparams);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2549 len16 = DIV_ROUND_UP(len, 16);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2550
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2551 entry = cxgb4_lookup_eotid(&adap->tids, eotid);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2552 if (!entry)
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2553 return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2554
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2555 eosw_txq = (struct sge_eosw_txq *)entry->data;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2556 if (!eosw_txq)
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2557 return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2558
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2559 skb = alloc_skb(len, GFP_KERNEL);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2560 if (!skb)
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2561 return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2562
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2563 spin_lock_bh(&eosw_txq->lock);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2564 if (tc != FW_SCHED_CLS_NONE) {
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2565 if (eosw_txq->state != CXGB4_EO_STATE_CLOSED)
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 @2566 goto out_free_skb;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2567
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2568 next_state = CXGB4_EO_STATE_FLOWC_OPEN_SEND;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2569 } else {
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2570 if (eosw_txq->state != CXGB4_EO_STATE_ACTIVE)
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2571 goto out_free_skb;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2572
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2573 next_state = CXGB4_EO_STATE_FLOWC_CLOSE_SEND;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2574 }
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2575
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2576 flowc = __skb_put(skb, len);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2577 memset(flowc, 0, len);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2578
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2579 rxq = &adap->sge.eohw_rxq[eosw_txq->hwqid];
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2580 flowc->flowid_len16 = cpu_to_be32(FW_WR_LEN16_V(len16) |
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2581 FW_WR_FLOWID_V(eosw_txq->hwtid));
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2582 flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2583 FW_FLOWC_WR_NPARAMS_V(nparams) |
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2584 FW_WR_COMPL_V(1));
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2585 flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2586 flowc->mnemval[0].val = cpu_to_be32(FW_PFVF_CMD_PFN_V(adap->pf));
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2587 flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2588 flowc->mnemval[1].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2589 flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2590 flowc->mnemval[2].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2591 flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2592 flowc->mnemval[3].val = cpu_to_be32(rxq->rspq.abs_id);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2593 flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SCHEDCLASS;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2594 flowc->mnemval[4].val = cpu_to_be32(tc);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2595 flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_EOSTATE;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2596 flowc->mnemval[5].val = cpu_to_be32(tc == FW_SCHED_CLS_NONE ?
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2597 FW_FLOWC_MNEM_EOSTATE_CLOSING :
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2598 FW_FLOWC_MNEM_EOSTATE_ESTABLISHED);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2599
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2600 /* Free up any pending skbs to ensure there's room for
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2601 * termination FLOWC.
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2602 */
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2603 if (tc == FW_SCHED_CLS_NONE)
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2604 eosw_txq_flush_pending_skbs(eosw_txq);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2605
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2606 ret = eosw_txq_enqueue(eosw_txq, skb);
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2607 if (ret)
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2608 goto out_free_skb;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2609
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2610 eosw_txq->state = next_state;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2611 eosw_txq->flowc_idx = eosw_txq->pidx;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2612 eosw_txq_advance(eosw_txq, 1);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2613 ethofld_xmit(dev, eosw_txq);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2614
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2615 spin_unlock_bh(&eosw_txq->lock);
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2616 return 0;
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2617
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2618 out_free_skb:
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2619 dev_consume_skb_any(skb);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2620 spin_unlock_bh(&eosw_txq->lock);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2621 return ret;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2622 }
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2623
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
@ 2022-03-10 7:49 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-03-10 7:49 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8556 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 330f4c53d3c2d8b11d86ec03a964b86dc81452f5
commit: 52bfcdd87e83d9e69d22da5f26b1512ffc81deed net:CXGB4: fix leak if sk_buff is not used
config: microblaze-randconfig-m031-20220308 (https://download.01.org/0day-ci/archive/20220309/202203092354.8QMmp2o7-lkp(a)intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
vim +/ret +2566 drivers/net/ethernet/chelsio/cxgb4/sge.c
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2535 int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2536 {
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2537 struct port_info *pi = netdev2pinfo(dev);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2538 struct adapter *adap = netdev2adap(dev);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2539 enum sge_eosw_state next_state;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2540 struct sge_eosw_txq *eosw_txq;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2541 u32 len, len16, nparams = 6;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2542 struct fw_flowc_wr *flowc;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2543 struct eotid_entry *entry;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2544 struct sge_ofld_rxq *rxq;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2545 struct sk_buff *skb;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2546 int ret = 0;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2547
a422d5ff6defb1c Gustavo A. R. Silva 2020-06-19 2548 len = struct_size(flowc, mnemval, nparams);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2549 len16 = DIV_ROUND_UP(len, 16);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2550
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2551 entry = cxgb4_lookup_eotid(&adap->tids, eotid);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2552 if (!entry)
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2553 return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2554
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2555 eosw_txq = (struct sge_eosw_txq *)entry->data;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2556 if (!eosw_txq)
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2557 return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2558
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2559 skb = alloc_skb(len, GFP_KERNEL);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2560 if (!skb)
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2561 return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2562
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2563 spin_lock_bh(&eosw_txq->lock);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2564 if (tc != FW_SCHED_CLS_NONE) {
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2565 if (eosw_txq->state != CXGB4_EO_STATE_CLOSED)
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 @2566 goto out_free_skb;
^^^^^^^^^^^^^^^^^^
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2567
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2568 next_state = CXGB4_EO_STATE_FLOWC_OPEN_SEND;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2569 } else {
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2570 if (eosw_txq->state != CXGB4_EO_STATE_ACTIVE)
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2571 goto out_free_skb;
^^^^^^^^^^^^^^^^^
No error code. Are these errors? It's hard to tell from the context.
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2572
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2573 next_state = CXGB4_EO_STATE_FLOWC_CLOSE_SEND;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2574 }
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2575
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2576 flowc = __skb_put(skb, len);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2577 memset(flowc, 0, len);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2578
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2579 rxq = &adap->sge.eohw_rxq[eosw_txq->hwqid];
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2580 flowc->flowid_len16 = cpu_to_be32(FW_WR_LEN16_V(len16) |
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2581 FW_WR_FLOWID_V(eosw_txq->hwtid));
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2582 flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2583 FW_FLOWC_WR_NPARAMS_V(nparams) |
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2584 FW_WR_COMPL_V(1));
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2585 flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2586 flowc->mnemval[0].val = cpu_to_be32(FW_PFVF_CMD_PFN_V(adap->pf));
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2587 flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2588 flowc->mnemval[1].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2589 flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2590 flowc->mnemval[2].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2591 flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2592 flowc->mnemval[3].val = cpu_to_be32(rxq->rspq.abs_id);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2593 flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SCHEDCLASS;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2594 flowc->mnemval[4].val = cpu_to_be32(tc);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2595 flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_EOSTATE;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2596 flowc->mnemval[5].val = cpu_to_be32(tc == FW_SCHED_CLS_NONE ?
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2597 FW_FLOWC_MNEM_EOSTATE_CLOSING :
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2598 FW_FLOWC_MNEM_EOSTATE_ESTABLISHED);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2599
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2600 /* Free up any pending skbs to ensure there's room for
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2601 * termination FLOWC.
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2602 */
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2603 if (tc == FW_SCHED_CLS_NONE)
69422a7e5d578aa Rahul Lakkireddy 2020-04-30 2604 eosw_txq_flush_pending_skbs(eosw_txq);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2605
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2606 ret = eosw_txq_enqueue(eosw_txq, skb);
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2607 if (ret)
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2608 goto out_free_skb;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2609
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2610 eosw_txq->state = next_state;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2611 eosw_txq->flowc_idx = eosw_txq->pidx;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2612 eosw_txq_advance(eosw_txq, 1);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2613 ethofld_xmit(dev, eosw_txq);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2614
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2615 spin_unlock_bh(&eosw_txq->lock);
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2616 return 0;
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2617
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2618 out_free_skb:
52bfcdd87e83d9e Íñigo Huguet 2021-05-05 2619 dev_consume_skb_any(skb);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2620 spin_unlock_bh(&eosw_txq->lock);
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2621 return ret;
0e395b3cb1fb82f Rahul Lakkireddy 2019-11-07 2622 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
@ 2022-03-24 23:20 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-03-24 23:20 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 9779 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: "Íñigo Huguet" <ihuguet@redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 52deda9551a01879b3562e7b41748e85c591f14c
commit: 52bfcdd87e83d9e69d22da5f26b1512ffc81deed net:CXGB4: fix leak if sk_buff is not used
date: 11 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 11 months ago
config: riscv-randconfig-m031-20220324 (https://download.01.org/0day-ci/archive/20220325/202203250702.DyxwnTwp-lkp(a)intel.com/config)
compiler: riscv32-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
Old smatch warnings:
drivers/net/ethernet/chelsio/cxgb4/sge.c:4169 process_intrq() warn: potential spectre issue 'adap->sge.ingr_map' [w]
drivers/net/ethernet/chelsio/cxgb4/sge.c:4484 t4_sge_alloc_rxq() warn: potential spectre issue 'adap->sge.ingr_map' [w]
drivers/net/ethernet/chelsio/cxgb4/sge.c:4491 t4_sge_alloc_rxq() warn: potential spectre issue 'adap->sge.egr_map' [w]
vim +/ret +2566 drivers/net/ethernet/chelsio/cxgb4/sge.c
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2524
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2525 /**
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2526 * cxgb4_ethofld_send_flowc - Send ETHOFLD flowc request to bind eotid to tc.
29bbf5d7f5efe8 Rahul Lakkireddy 2020-06-24 2527 * @dev: netdevice
29bbf5d7f5efe8 Rahul Lakkireddy 2020-06-24 2528 * @eotid: ETHOFLD tid to bind/unbind
29bbf5d7f5efe8 Rahul Lakkireddy 2020-06-24 2529 * @tc: traffic class. If set to FW_SCHED_CLS_NONE, then unbinds the @eotid
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2530 *
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2531 * Send a FLOWC work request to bind an ETHOFLD TID to a traffic class.
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2532 * If @tc is set to FW_SCHED_CLS_NONE, then the @eotid is unbound from
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2533 * a traffic class.
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2534 */
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2535 int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2536 {
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2537 struct port_info *pi = netdev2pinfo(dev);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2538 struct adapter *adap = netdev2adap(dev);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2539 enum sge_eosw_state next_state;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2540 struct sge_eosw_txq *eosw_txq;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2541 u32 len, len16, nparams = 6;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2542 struct fw_flowc_wr *flowc;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2543 struct eotid_entry *entry;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2544 struct sge_ofld_rxq *rxq;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2545 struct sk_buff *skb;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2546 int ret = 0;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2547
a422d5ff6defb1 Gustavo A. R. Silva 2020-06-19 2548 len = struct_size(flowc, mnemval, nparams);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2549 len16 = DIV_ROUND_UP(len, 16);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2550
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2551 entry = cxgb4_lookup_eotid(&adap->tids, eotid);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2552 if (!entry)
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2553 return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2554
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2555 eosw_txq = (struct sge_eosw_txq *)entry->data;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2556 if (!eosw_txq)
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2557 return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2558
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2559 skb = alloc_skb(len, GFP_KERNEL);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2560 if (!skb)
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2561 return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2562
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2563 spin_lock_bh(&eosw_txq->lock);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2564 if (tc != FW_SCHED_CLS_NONE) {
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2565 if (eosw_txq->state != CXGB4_EO_STATE_CLOSED)
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 @2566 goto out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2567
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2568 next_state = CXGB4_EO_STATE_FLOWC_OPEN_SEND;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2569 } else {
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2570 if (eosw_txq->state != CXGB4_EO_STATE_ACTIVE)
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2571 goto out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2572
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2573 next_state = CXGB4_EO_STATE_FLOWC_CLOSE_SEND;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2574 }
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2575
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2576 flowc = __skb_put(skb, len);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2577 memset(flowc, 0, len);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2578
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2579 rxq = &adap->sge.eohw_rxq[eosw_txq->hwqid];
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2580 flowc->flowid_len16 = cpu_to_be32(FW_WR_LEN16_V(len16) |
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2581 FW_WR_FLOWID_V(eosw_txq->hwtid));
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2582 flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2583 FW_FLOWC_WR_NPARAMS_V(nparams) |
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2584 FW_WR_COMPL_V(1));
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2585 flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2586 flowc->mnemval[0].val = cpu_to_be32(FW_PFVF_CMD_PFN_V(adap->pf));
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2587 flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2588 flowc->mnemval[1].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2589 flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2590 flowc->mnemval[2].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2591 flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2592 flowc->mnemval[3].val = cpu_to_be32(rxq->rspq.abs_id);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2593 flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SCHEDCLASS;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2594 flowc->mnemval[4].val = cpu_to_be32(tc);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2595 flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_EOSTATE;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2596 flowc->mnemval[5].val = cpu_to_be32(tc == FW_SCHED_CLS_NONE ?
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2597 FW_FLOWC_MNEM_EOSTATE_CLOSING :
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2598 FW_FLOWC_MNEM_EOSTATE_ESTABLISHED);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2599
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2600 /* Free up any pending skbs to ensure there's room for
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2601 * termination FLOWC.
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2602 */
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2603 if (tc == FW_SCHED_CLS_NONE)
69422a7e5d578a Rahul Lakkireddy 2020-04-30 2604 eosw_txq_flush_pending_skbs(eosw_txq);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2605
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2606 ret = eosw_txq_enqueue(eosw_txq, skb);
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2607 if (ret)
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2608 goto out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2609
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2610 eosw_txq->state = next_state;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2611 eosw_txq->flowc_idx = eosw_txq->pidx;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2612 eosw_txq_advance(eosw_txq, 1);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2613 ethofld_xmit(dev, eosw_txq);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2614
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2615 spin_unlock_bh(&eosw_txq->lock);
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2616 return 0;
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2617
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2618 out_free_skb:
52bfcdd87e83d9 Íñigo Huguet 2021-05-05 2619 dev_consume_skb_any(skb);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2620 spin_unlock_bh(&eosw_txq->lock);
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2621 return ret;
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2622 }
0e395b3cb1fb82 Rahul Lakkireddy 2019-11-07 2623
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-24 23:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-09 15:27 drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret' kernel test robot
2022-03-10 7:49 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2022-03-24 23:20 kernel test robot
2022-02-12 18:17 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.