From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com
 [209.85.192.170]) by dpdk.org (Postfix) with ESMTP id 4337B5A41
 for <dev@dpdk.org>; Thu, 21 May 2015 20:22:30 +0200 (CEST)
Received: by pdbnk13 with SMTP id nk13so116539103pdb.1
 for <dev@dpdk.org>; Thu, 21 May 2015 11:22:29 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-type:content-transfer-encoding;
 bh=xTrnWjqg0z4th5n9CGSR8hshnRVaB6DG+g4GEgUIPNo=;
 b=WvuT4Bk7FC4LtZm+P8+GWECz7iRQU4qFxZIG51y2r9CdQFF0g6uBIagWAyIbT/jMde
 2WQejMVC2LlF7kFmQTNqEKzlaA8jFg7KCbbSx02MHHaQNpZzDMEmdf87RdjC22pleoV7
 IUVYkkPM1KCTkdfiG61PLi7MYOjDHtWA4fp7zR5xzvAvfZ9TumMsgFZ1A0bl1ae2MgyH
 tjoe/MZBJndVsdASyMeiU1ocQMPzqzbvCooSLwCfD8Fi146ZZYDWzm9/AzC3JTSB+yGH
 pRl7WC44HrtrUlnYW7gKgXC8yo//l39mf/GClXBeShxAXQ+zShkdnIrOgFxbQ4SRm8QJ
 rSyQ==
X-Gm-Message-State: ALoCoQmGcRjPUFdf6F/5J9MnA9FVRO0f2+R3tcClhHbiPf7np6kLuaKleJPZATCZon5roz7OguSC
X-Received: by 10.70.133.196 with SMTP id pe4mr7283573pdb.10.1432232549700;
 Thu, 21 May 2015 11:22:29 -0700 (PDT)
Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net.
 [50.53.82.155])
 by mx.google.com with ESMTPSA id gy3sm19876895pbb.42.2015.05.21.11.22.29
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 21 May 2015 11:22:29 -0700 (PDT)
Date: Thu, 21 May 2015 11:22:33 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Cunming Liang <cunming.liang@intel.com>
Message-ID: <20150521112233.3a03a898@urahara>
In-Reply-To: <1432198563-16334-9-git-send-email-cunming.liang@intel.com>
References: <1430804386-28949-1-git-send-email-cunming.liang@intel.com>
 <1432198563-16334-1-git-send-email-cunming.liang@intel.com>
 <1432198563-16334-9-git-send-email-cunming.liang@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Cc: dev@dpdk.org, liang-min.wang@intel.com
Subject: Re: [dpdk-dev] [PATCH v8 08/11] ethdev: add rx intr enable,
 disable and ctl functions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 21 May 2015 18:22:30 -0000

On Thu, 21 May 2015 16:56:00 +0800
Cunming Liang <cunming.liang@intel.com> wrote:

> +int
> +rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
> +			  int epfd, int op, void *data)
> +{
> +	uint32_t vec;
> +	struct rte_eth_dev *dev;
> +	struct rte_intr_handle *intr_handle;
> +	int rc;
> +
> +	if (!rte_eth_dev_is_valid_port(port_id)) {
> +		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);

Use %u when printing unsigned value

> +		return -ENODEV;
> +	}
> +
> +	dev = &rte_eth_devices[port_id];
> +	if (dev == NULL) {
> +		PMD_DEBUG_TRACE("Invalid port device\n");
> +		return -ENODEV;
> +	}
Another unnecessary conditional check, already done in rte_eth_dev_is_valid_port

> +
> +	if (queue_id >= dev->data->nb_rx_queues) {
> +		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
This is wrong, won't build with debug enabled, You meant to use queue_id
here and use %u

> +		return -EINVAL;
> +	}
> +
> +	intr_handle = &dev->pci_dev->intr_handle;
> +	if (!intr_handle->intr_vec) {
> +		PMD_DEBUG_TRACE("RX Intr vector unset\n");
> +		return -EPERM;
> +	}
> +