From: Piotr Azarewicz Date: Thu, 14 Apr 2016 09:59:30 +0000 (+0200) Subject: ixgbe: fix bit masking in queue stop X-Git-Tag: spdx-start~6968 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8ea3bacb37f9d19120538f93ff32c389e5e2e2c4;p=dpdk.git ixgbe: fix bit masking in queue stop The masking for the RX/TX enable bit was incorrect in the rx and tx queue stop functions. Instead of using "& MASK" it used "| MASK" which would always return true. This error was found by converity scan. CID 13215 : Wrong operator used (CONSTANT_EXPRESSION_RESULT) operator_confusion: txdctl | 33554432 is always 1/true regardless of the values of its operand. This occurs as the logical second operand of '&&'. CID 13216 : Wrong operator used (CONSTANT_EXPRESSION_RESULT) operator_confusion: rxdctl | 33554432 is always 1/true regardless of the values of its operand. This occurs as the logical second operand of '&&'. Coverity issue: 13215 Coverity issue: 13216 Fixes: 029fd06d40fa ("ixgbe: queue start and stop") Signed-off-by: Piotr Azarewicz Acked-by: Wenzhuo Lu --- diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 35673fc581..ceaf4ab6f4 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4817,12 +4817,12 @@ ixgbe_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) rxdctl &= ~IXGBE_RXDCTL_ENABLE; IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), rxdctl); - /* Wait until RX Enable ready */ + /* Wait until RX Enable bit clear */ poll_ms = RTE_IXGBE_REGISTER_POLL_WAIT_10_MS; do { rte_delay_ms(1); rxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - } while (--poll_ms && (rxdctl | IXGBE_RXDCTL_ENABLE)); + } while (--poll_ms && (rxdctl & IXGBE_RXDCTL_ENABLE)); if (!poll_ms) PMD_INIT_LOG(ERR, "Could not disable Rx Queue %d", rx_queue_id); @@ -4920,14 +4920,14 @@ ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) txdctl &= ~IXGBE_TXDCTL_ENABLE; IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(txq->reg_idx), txdctl); - /* Wait until TX Enable ready */ + /* Wait until TX Enable bit clear */ if (hw->mac.type == ixgbe_mac_82599EB) { poll_ms = RTE_IXGBE_REGISTER_POLL_WAIT_10_MS; do { rte_delay_ms(1); txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(txq->reg_idx)); - } while (--poll_ms && (txdctl | IXGBE_TXDCTL_ENABLE)); + } while (--poll_ms && (txdctl & IXGBE_TXDCTL_ENABLE)); if (!poll_ms) PMD_INIT_LOG(ERR, "Could not disable " "Tx Queue %d", tx_queue_id);