DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: "Wu, Jingjing" <jingjing.wu@intel.com>
To: "Li, Xiaoyun" <xiaoyun.li@intel.com>,
	"Wiles, Keith" <keith.wiles@intel.com>,
	"Liang, Cunming" <cunming.liang@intel.com>,
	"Maslekar, Omkar" <omkar.maslekar@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v6 1/6] raw/ntb: introduce ntb rawdev driver
Date: Tue, 18 Jun 2019 16:07:34 +0000
Message-ID: <9BB6961774997848B5B42BEC655768F81145FE71@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20190618021055.12709-2-xiaoyun.li@intel.com>

> +
> +static void
> +ntb_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
> +{
> +	struct ntb_hw *hw = dev->dev_private;
> +	struct ntb_attr *ntb_attrs = dev_info;
> +
> +	strncpy(ntb_attrs[NTB_TOPO_ID].name, NTB_TOPO_NAME,
> NTB_ATTR_NAME_LEN);
> +	switch (hw->topo) {
> +	case NTB_TOPO_B2B_DSD:
> +		strncpy(ntb_attrs[NTB_TOPO_ID].value, "B2B DSD",
> +			NTB_ATTR_NAME_LEN);
> +		break;
> +	case NTB_TOPO_B2B_USD:
> +		strncpy(ntb_attrs[NTB_TOPO_ID].value, "B2B USD",
> +			NTB_ATTR_NAME_LEN);
> +		break;
> +	default:
> +		strncpy(ntb_attrs[NTB_TOPO_ID].value, "Unsupported",
> +			NTB_ATTR_NAME_LEN);
> +	}
> +
> +	strncpy(ntb_attrs[NTB_LINK_STATUS_ID].name, NTB_LINK_STATUS_NAME,
> +		NTB_ATTR_NAME_LEN);
> +	snprintf(ntb_attrs[NTB_LINK_STATUS_ID].value, NTB_ATTR_NAME_LEN,
> +		 "%d", hw->link_status);
> +
You are sharing NTB_ATTR_NAME_LEN for both name and value? How about NTB_ATTR_NUM_LEN/NTB_ATTR_VALUE_LEN?

[...]


> +	if (!strncmp(attr_name, NTB_PEER_SPAD_14, NTB_ATTR_NAME_LEN)) {
> +		if (hw->ntb_ops->spad_write == NULL)
> +			return -ENOTSUP;
> +		(*hw->ntb_ops->spad_write)(dev, 14, 1, attr_value);
> +		NTB_LOG(INFO, "Set attribute (%s) Value (%" PRIu64 ")",
> +			attr_name, attr_value);
> +		return 0;
> +	}
> +
> +	if (!strncmp(attr_name, NTB_PEER_SPAD_15, NTB_ATTR_NAME_LEN)) {
> +		if (hw->ntb_ops->spad_write == NULL)
> +			return -ENOTSUP;
> +		(*hw->ntb_ops->spad_write)(dev, 15, 1, attr_value);
> +		NTB_LOG(INFO, "Set attribute (%s) Value (%" PRIu64 ")",
> +			attr_name, attr_value);
> +		return 0;
> +	}
> +
What are 14 and 15 for? Is that generic?


> +static int
> +ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)
> +{
> +	struct ntb_hw *hw = dev->dev_private;
> +	int ret;
> +
> +	hw->pci_dev = pci_dev;
> +	hw->peer_dev_up = 0;
> +	hw->link_status = 0;
> +	hw->link_speed = NTB_SPEED_NONE;
> +	hw->link_width = NTB_WIDTH_NONE;
> +
> +	switch (pci_dev->id.device_id) {
> +	default:
> +		NTB_LOG(ERR, "Not supported device.");
> +		return -EINVAL;
> +	}
> +
> +	if (hw->ntb_ops->ntb_dev_init == NULL)
> +		return -ENOTSUP;
> +	ret = (*hw->ntb_ops->ntb_dev_init)(dev);
> +	if (ret) {
> +		NTB_LOG(ERR, "Unanle to init ntb dev.");
Typo: unanle -> unable
[...]


> +static int
> +ntb_rawdev_create(struct rte_pci_device *pci_dev, int socket_id)
> +{
> +	char name[RTE_RAWDEV_NAME_MAX_LEN];
> +	struct rte_rawdev *rawdev = NULL;
> +	int ret;
> +
> +	if (pci_dev == NULL) {
> +		NTB_LOG(ERR, "Invalid pci_dev.");
> +		ret = -EINVAL;
> +		goto fail;
Is there possibility to release rawdev at fail? Return might be enough.

> +	}
> +
> +	memset(name, 0, sizeof(name));
> +	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "NTB:%x:%02x.%x",
> +		 pci_dev->addr.bus, pci_dev->addr.devid,
> +		 pci_dev->addr.function);
> +
> +	NTB_LOG(INFO, "Init %s on NUMA node %d", name, rte_socket_id());
Why not use the parameter "socket_id"?

> +
> +	/* Allocate device structure. */
> +	rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct ntb_hw),
> +					 socket_id);
> +	if (rawdev == NULL) {
> +		NTB_LOG(ERR, "Unable to allocate rawdev.");
> +		ret = -EINVAL;
> +		goto fail;
No need to goto fail as rawdev in NULL.

[...]


> +enum ntb_link {
> +	NTB_LINK_DOWN = 0,
> +	NTB_LINK_UP,
> +};
> +
You defined the enum, but you used 0 and 1 above.


Thanks
Jingjing

  reply index

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03  8:46 [dpdk-dev] [PATCH 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-03  8:46 ` [dpdk-dev] [PATCH 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-04  2:20   ` Ye Xiaolong
2019-06-03  8:46 ` [dpdk-dev] [PATCH 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-04  3:01   ` Ye Xiaolong
2019-06-03  8:46 ` [dpdk-dev] [PATCH 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-03  8:46 ` [dpdk-dev] [PATCH 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-04  6:48   ` Ye Xiaolong
2019-06-04  8:12     ` Li, Xiaoyun
2019-06-05  8:32       ` Li, Xiaoyun
2019-06-05  9:25         ` Ye Xiaolong
2019-06-05 13:36           ` Li, Xiaoyun
2019-06-06  2:07             ` Ye Xiaolong
2019-06-04  8:48   ` Ye Xiaolong
2019-06-05  3:11     ` Li, Xiaoyun
2019-06-03  8:46 ` [dpdk-dev] [PATCH 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-04  7:53   ` Jerin Jacob Kollanukkaran
2019-06-04  8:16     ` Li, Xiaoyun
2019-06-03  8:46 ` [dpdk-dev] [PATCH 6/6] doc: update docs for ntb pmd Xiaoyun Li
2019-06-06  7:42 ` [dpdk-dev] [PATCH v2 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-06  7:42   ` [dpdk-dev] [PATCH v2 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-06  7:42   ` [dpdk-dev] [PATCH v2 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-06  7:43   ` [dpdk-dev] [PATCH v2 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-06  7:43   ` [dpdk-dev] [PATCH v2 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-06  7:43   ` [dpdk-dev] [PATCH v2 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-06  8:23     ` Bruce Richardson
2019-06-10  1:38       ` Li, Xiaoyun
2019-06-06  7:43   ` [dpdk-dev] [PATCH v2 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-06-11  8:22   ` [dpdk-dev] [PATCH 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-11  8:22     ` [dpdk-dev] [PATCH 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-11  8:22     ` [dpdk-dev] [PATCH 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-11  8:22     ` [dpdk-dev] [PATCH 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-11  8:22     ` [dpdk-dev] [PATCH 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-11  8:22     ` [dpdk-dev] [PATCH 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-11  8:22     ` [dpdk-dev] [PATCH 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-06-11  8:50   ` [dpdk-dev] [PATCH v3 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-11  8:50     ` [dpdk-dev] [PATCH v3 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-11  8:50     ` [dpdk-dev] [PATCH v3 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-11  8:50     ` [dpdk-dev] [PATCH v3 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-11  8:50     ` [dpdk-dev] [PATCH v3 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-11  8:50     ` [dpdk-dev] [PATCH v3 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-11  8:50     ` [dpdk-dev] [PATCH v3 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-06-13  7:56     ` [dpdk-dev] [PATCH v4 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-13  7:56       ` [dpdk-dev] [PATCH v4 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-13  7:56       ` [dpdk-dev] [PATCH v4 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-13  7:56       ` [dpdk-dev] [PATCH v4 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-13  7:56       ` [dpdk-dev] [PATCH v4 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-13  7:56       ` [dpdk-dev] [PATCH v4 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-13  7:56       ` [dpdk-dev] [PATCH v4 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-06-14  2:19       ` [dpdk-dev] [PATCH v5 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-14  2:19         ` [dpdk-dev] [PATCH v5 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-17 12:49           ` Wang, Xiao W
2019-06-18  1:28             ` Li, Xiaoyun
2019-06-14  2:19         ` [dpdk-dev] [PATCH v5 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-14  2:19         ` [dpdk-dev] [PATCH v5 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-14  2:19         ` [dpdk-dev] [PATCH v5 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-14  2:19         ` [dpdk-dev] [PATCH v5 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-14  2:19         ` [dpdk-dev] [PATCH v5 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-06-18  2:10         ` [dpdk-dev] [PATCH v6 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-18  2:10           ` [dpdk-dev] [PATCH v6 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-18 16:07             ` Wu, Jingjing [this message]
2019-06-18  2:10           ` [dpdk-dev] [PATCH v6 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-18 16:07             ` Wu, Jingjing
2019-06-18  2:10           ` [dpdk-dev] [PATCH v6 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-18 16:07             ` Wu, Jingjing
2019-06-20 10:06               ` Li, Xiaoyun
2019-06-18  2:10           ` [dpdk-dev] [PATCH v6 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-18  2:10           ` [dpdk-dev] [PATCH v6 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-18  2:10           ` [dpdk-dev] [PATCH v6 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-06-20 10:21           ` [dpdk-dev] [PATCH v7 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-20 10:21             ` [dpdk-dev] [PATCH v7 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-20 10:21             ` [dpdk-dev] [PATCH v7 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-20 10:21             ` [dpdk-dev] [PATCH v7 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-20 10:21             ` [dpdk-dev] [PATCH v7 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-20 10:21             ` [dpdk-dev] [PATCH v7 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-20 10:21             ` [dpdk-dev] [PATCH v7 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-06-26  7:12             ` [dpdk-dev] [PATCH v8 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-26  7:12               ` [dpdk-dev] [PATCH v8 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-27 16:31                 ` Wu, Jingjing
2019-06-26  7:12               ` [dpdk-dev] [PATCH v8 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-27 17:06                 ` Wu, Jingjing
2019-06-28  1:33                   ` Li, Xiaoyun
2019-06-26  7:12               ` [dpdk-dev] [PATCH v8 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-27 17:19                 ` Wu, Jingjing
2019-06-28  1:33                   ` Li, Xiaoyun
2019-06-26  7:12               ` [dpdk-dev] [PATCH v8 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-27 17:30                 ` Wu, Jingjing
2019-06-28  1:36                   ` Li, Xiaoyun
2019-06-26  7:12               ` [dpdk-dev] [PATCH v8 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-27 17:34                 ` Wu, Jingjing
2019-06-26  7:12               ` [dpdk-dev] [PATCH v8 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-06-27 17:33                 ` Wu, Jingjing
2019-06-28  2:53               ` [dpdk-dev] [PATCH v9 0/6] rawdev driver for ntb Xiaoyun Li
2019-06-28  2:53                 ` [dpdk-dev] [PATCH v9 1/6] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-06-28  2:53                 ` [dpdk-dev] [PATCH v9 2/6] raw/ntb: add intel ntb support Xiaoyun Li
2019-06-28  2:53                 ` [dpdk-dev] [PATCH v9 3/6] raw/ntb: add handshake process Xiaoyun Li
2019-06-28  2:53                 ` [dpdk-dev] [PATCH v9 4/6] examples/ntb: enable an example for ntb Xiaoyun Li
2019-06-28  2:53                 ` [dpdk-dev] [PATCH v9 5/6] usertools/dpdk-devbind.py: add support " Xiaoyun Li
2019-06-28  2:53                 ` [dpdk-dev] [PATCH v9 6/6] doc: update docs for ntb driver Xiaoyun Li
2019-07-01 14:24                   ` Thomas Monjalon
2019-07-02  1:18                     ` Li, Xiaoyun
2019-06-28 10:17                 ` [dpdk-dev] [PATCH v9 0/6] rawdev driver for ntb Wu, Jingjing
2019-07-02  6:17                 ` [dpdk-dev] [PATCH v10 0/5] " Xiaoyun Li
2019-07-02  6:17                   ` [dpdk-dev] [PATCH v10 1/5] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-07-02  6:17                   ` [dpdk-dev] [PATCH v10 2/5] usertools/dpdk-devbind.py: add support for ntb Xiaoyun Li
2019-07-02  6:17                   ` [dpdk-dev] [PATCH v10 3/5] raw/ntb: add intel ntb support Xiaoyun Li
2019-07-02  6:17                   ` [dpdk-dev] [PATCH v10 4/5] raw/ntb: add handshake process Xiaoyun Li
2019-07-02  6:17                   ` [dpdk-dev] [PATCH v10 5/5] examples/ntb: enable an example for ntb Xiaoyun Li
2019-07-02  6:23                 ` [dpdk-dev] [PATCH v10 1/5] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-07-02  6:25                 ` [dpdk-dev] [PATCH v10 0/5] rawdev driver for ntb Xiaoyun Li
2019-07-02  6:25                   ` [dpdk-dev] [PATCH v10 1/5] raw/ntb: introduce ntb rawdev driver Xiaoyun Li
2019-07-04 10:31                     ` Thomas Monjalon
2019-07-04 10:37                       ` Bruce Richardson
2019-07-05  1:21                       ` Li, Xiaoyun
2019-07-05  1:28                       ` Li, Xiaoyun
2019-07-02  6:25                   ` [dpdk-dev] [PATCH v10 2/5] usertools/dpdk-devbind.py: add support for ntb Xiaoyun Li
2019-07-02  6:25                   ` [dpdk-dev] [PATCH v10 3/5] raw/ntb: add intel ntb support Xiaoyun Li
2019-07-02  6:25                   ` [dpdk-dev] [PATCH v10 4/5] raw/ntb: add handshake process Xiaoyun Li
2019-07-02  6:25                   ` [dpdk-dev] [PATCH v10 5/5] examples/ntb: enable an example for ntb Xiaoyun Li
2019-07-02 14:10                   ` [dpdk-dev] [PATCH v10 0/5] rawdev driver " Ye Xiaolong
2019-07-04 12:29                 ` [dpdk-dev] [PATCH v11 0/4] " Thomas Monjalon
2019-07-04 12:29                   ` [dpdk-dev] [PATCH v11 1/4] raw/ntb: introduce NTB raw device driver Thomas Monjalon
2019-07-04 12:29                   ` [dpdk-dev] [PATCH v11 2/4] raw/ntb: support Intel NTB Thomas Monjalon
2019-07-04 12:29                   ` [dpdk-dev] [PATCH v11 3/4] raw/ntb: add handshake process Thomas Monjalon
2019-07-04 12:29                   ` [dpdk-dev] [PATCH v11 4/4] examples/ntb: add example for NTB Thomas Monjalon
2019-07-05  2:41                   ` [dpdk-dev] [PATCH v11 0/4] rawdev driver for ntb Li, Xiaoyun
2019-07-05 10:52                     ` Thomas Monjalon

Reply instructions:

You may reply publically 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=9BB6961774997848B5B42BEC655768F81145FE71@SHSMSX103.ccr.corp.intel.com \
    --to=jingjing.wu@intel.com \
    --cc=cunming.liang@intel.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    --cc=omkar.maslekar@intel.com \
    --cc=xiaoyun.li@intel.com \
    /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

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox