From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Ferruh Yigit <ferruh.yigit@itnel.com>
Subject: [dpdk-dev] [PATCH 07/19] kni: comparisons should place the constant on the right
Date: Thu, 15 Sep 2016 16:46:33 +0100 [thread overview]
Message-ID: <1473954405-7150-8-git-send-email-ferruh.yigit@intel.com> (raw)
In-Reply-To: <1473954405-7150-1-git-send-email-ferruh.yigit@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
lib/librte_eal/linuxapp/kni/kni_vhost.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index f1345c3..ec39538 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -169,7 +169,7 @@ kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m,
/* free skb to cache */
skb->data = NULL;
- if (unlikely(1 != kni_fifo_put(q->fifo, (void **)&skb, 1)))
+ if (unlikely(kni_fifo_put(q->fifo, (void **)&skb, 1) != 1))
/* Failing should not happen */
KNI_ERR("Fail to enqueue entries into rx cache fifo\n");
@@ -197,8 +197,8 @@ kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m,
kni->stats.rx_packets++;
/* enqueue mbufs into free_q */
- va = (void*)kva - kni->mbuf_kva + kni->mbuf_va;
- if (unlikely(1 != kni_fifo_put(kni->free_q, (void **)&va, 1)))
+ va = (void *)kva - kni->mbuf_kva + kni->mbuf_va;
+ if (unlikely(kni_fifo_put(kni->free_q, (void **)&va, 1) != 1))
/* Failing should not happen */
KNI_ERR("Fail to enqueue entries into free_q\n");
@@ -303,15 +303,13 @@ kni_chk_vhost_rx(struct kni_dev *kni)
nb_backlog = (nb_in & BURST_MASK);
/* enqueue skb_queue per BURST_SIZE bulk */
- if (0 != nb_burst) {
- if (unlikely(RX_BURST_SZ != kni_fifo_get(
- kni->rx_q, (void **)&va,
- RX_BURST_SZ)))
+ if (nb_burst != 0) {
+ if (unlikely(kni_fifo_get(kni->rx_q, (void **)&va, RX_BURST_SZ)
+ != RX_BURST_SZ))
goto except;
- if (unlikely(RX_BURST_SZ != kni_fifo_get(
- q->fifo, (void **)&skb,
- RX_BURST_SZ)))
+ if (unlikely(kni_fifo_get(q->fifo, (void **)&skb, RX_BURST_SZ)
+ != RX_BURST_SZ))
goto except;
kni_vhost_enqueue_burst(kni, q, skb, va);
@@ -319,12 +317,10 @@ kni_chk_vhost_rx(struct kni_dev *kni)
/* all leftover, do one by one */
for (i = 0; i < nb_backlog; ++i) {
- if (unlikely(1 != kni_fifo_get(
- kni->rx_q,(void **)&va, 1)))
+ if (unlikely(kni_fifo_get(kni->rx_q, (void **)&va, 1) != 1))
goto except;
- if (unlikely(1 != kni_fifo_get(
- q->fifo, (void **)&skb, 1)))
+ if (unlikely(kni_fifo_get(q->fifo, (void **)&skb, 1) != 1))
goto except;
kni_vhost_enqueue(kni, q, *skb, *va);
@@ -797,7 +793,7 @@ set_sock_en(struct device *dev, struct device_attribute *attr,
unsigned long en;
int err = 0;
- if (0 != kstrtoul(buf, 0, &en))
+ if (kstrtoul(buf, 0, &en) != 0)
return -EINVAL;
if (en)
--
2.7.4
next prev parent reply other threads:[~2016-09-15 15:48 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 15:46 [dpdk-dev] [PATCH 00/19] KNI checkpatch cleanup Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 01/19] kni: move externs to the header file Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 02/19] kni: uninitialize global variables Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 03/19] kni: make static struct const Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 04/19] kni: whitespace, indentation, long line corrections Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 05/19] kni: prefer unsigned int to unsigned Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 06/19] kni: remove useless return Ferruh Yigit
2016-09-15 15:46 ` Ferruh Yigit [this message]
2016-09-15 15:46 ` [dpdk-dev] [PATCH 08/19] kni: trailing statements should be on next line Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 09/19] kni: do not use assignment in if condition Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 10/19] kni: macros with complex values should be enclosed in parentheses Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 11/19] kni: prefer min_t to min Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 12/19] kni: prefer ether_addr_copy to memcpy Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 13/19] kni: update kernel logging Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 14/19] kni: remove unnecessary 'out of memory' message Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 15/19] kni: move functions to eliminate function declarations Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 16/19] kni: remove compile time debug configuration Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 17/19] kni: updated log messages Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 18/19] kni: prefer uint32_t to unsigned int Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 19/19] kni: move kernel version ifdefs to compat header Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 00/19] KNI checkpatch cleanup Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 " Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 01/19] kni: move externs to the header file Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 02/19] kni: uninitialize global variables Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 03/19] kni: make static struct const Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 04/19] kni: whitespace, indentation, long line corrections Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 05/19] kni: prefer unsigned int to unsigned Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 06/19] kni: remove useless return Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 07/19] kni: comparisons should place the constant on the right Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 08/19] kni: trailing statements should be on next line Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 09/19] kni: do not use assignment in if condition Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 10/19] kni: macros with complex values should be enclosed in parentheses Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 11/19] kni: prefer min_t to min Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 12/19] kni: prefer ether_addr_copy to memcpy Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 13/19] kni: update kernel logging Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 14/19] kni: remove unnecessary 'out of memory' message Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 15/19] kni: move functions to eliminate function declarations Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 16/19] kni: remove compile time debug configuration Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 17/19] kni: updated log messages Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 18/19] kni: prefer uint32_t to unsigned int Ferruh Yigit
2016-09-26 15:39 ` [dpdk-dev] [PATCH v3 19/19] kni: move kernel version ifdefs to compat header Ferruh Yigit
2016-10-13 21:15 ` [dpdk-dev] [PATCH v3 00/19] KNI checkpatch cleanup Thomas Monjalon
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 01/19] kni: move externs to the header file Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 02/19] kni: uninitialize global variables Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 03/19] kni: make static struct const Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 04/19] kni: whitespace, indentation, long line corrections Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 05/19] kni: prefer unsigned int to unsigned Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 06/19] kni: remove useless return Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 07/19] kni: comparisons should place the constant on the right Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 08/19] kni: trailing statements should be on next line Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 09/19] kni: do not use assignment in if condition Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 10/19] kni: macros with complex values should be enclosed in parentheses Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 11/19] kni: prefer min_t to min Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 12/19] kni: prefer ether_addr_copy to memcpy Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 13/19] kni: update kernel logging Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 14/19] kni: remove unnecessary 'out of memory' message Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 15/19] kni: move functions to eliminate function declarations Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 16/19] kni: remove compile time debug configuration Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 17/19] kni: updated log messages Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 18/19] kni: prefer uint32_t to unsigned int Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 19/19] kni: move kernel version ifdefs to compat header Ferruh Yigit
2016-10-05 10:38 ` [dpdk-dev] [PATCH 00/19] KNI checkpatch cleanup Pattan, Reshma
2016-10-10 12:37 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473954405-7150-8-git-send-email-ferruh.yigit@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@itnel.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).