DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Andrzej Ostruszka <amo@semihalf.com>
Cc: dev@dpdk.org, mw@semihalf.com, zr@semihalf.com, tdu@semihalf.com,
	nadavh@marvell.com
Subject: Re: [dpdk-dev] [PATCH v4 1/8] net/mvneta: add neta PMD skeleton
Date: Wed, 19 Sep 2018 09:28:09 -0700	[thread overview]
Message-ID: <20180919092809.7ccde128@xeon-e3> (raw)
In-Reply-To: <1537369294-17099-2-git-send-email-amo@semihalf.com>

On Wed, 19 Sep 2018 17:01:27 +0200
Andrzej Ostruszka <amo@semihalf.com> wrote:

> +/**
> + * Create private device structure.
> + *
> + * @param dev_name
> + *   Pointer to the port name passed in the initialization parameters.
> + *
> + * @return
> + *   Pointer to the newly allocated private device structure.
> + */
> +static struct mvneta_priv *
> +mvneta_priv_create(const char *dev_name)
> +{
> +	struct mvneta_priv *priv;
> +
> +	priv = rte_zmalloc_socket(dev_name, sizeof(*priv), 0, rte_socket_id());
> +	if (!priv)
> +		return NULL;
> +
> +	return priv;
> +}

Why make this a function, it really doesn't add anything over just doing it inline.


> +static int
> +mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
> +{
> +	int ret, fd = socket(AF_INET, SOCK_DGRAM, 0);
> +	struct rte_eth_dev *eth_dev;
> +	struct mvneta_priv *priv;
> +	struct ifreq req;
> +
> +	eth_dev = rte_eth_dev_allocate(name);
> +	if (!eth_dev)
> +		return -ENOMEM;
> +
> +	priv = mvneta_priv_create(name);
> +
> +	if (!priv) {

nit: no blank line needed.

> +		ret = -ENOMEM;
> +		goto out_free_dev;

You have error goto's backwards.

> +	}
> +
> +	eth_dev->data->mac_addrs =
> +		rte_zmalloc("mac_addrs",
> +			    ETHER_ADDR_LEN * MVNETA_MAC_ADDRS_MAX, 0);
> +	if (!eth_dev->data->mac_addrs) {
> +		MVNETA_LOG(ERR, "Failed to allocate space for eth addrs");
> +		ret = -ENOMEM;
> +		goto out_free_priv;
> +	}
> +
> +	memset(&req, 0, sizeof(req));
> +	strcpy(req.ifr_name, name);



> +out_free_mac:
> +	rte_free(eth_dev->data->mac_addrs);
> +out_free_dev:
> +	rte_eth_dev_release_port(eth_dev);
> +out_free_priv:
> +	rte_free(priv);

These are backwards: out_free_priv is called if ioctl fails and will
leak eth_dev port.

> +	return ret;
> +}

  parent reply	other threads:[~2018-09-19 16:28 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 15:10 [dpdk-dev] [PATCH 0/8] Add Marvell NETA PMD Andrzej Ostruszka
2018-08-28 15:10 ` [dpdk-dev] [PATCH 1/8] net/mvneta: add neta PMD skeleton Andrzej Ostruszka
2018-08-30  8:42   ` Hemant
2018-08-30  9:54     ` Andrzej Ostruszka
2018-08-28 15:10 ` [dpdk-dev] [PATCH 2/8] net/mvneta: add Rx/Tx support Andrzej Ostruszka
2018-08-28 15:10 ` [dpdk-dev] [PATCH 3/8] net/mvneta: support for setting of MTU Andrzej Ostruszka
2018-08-28 15:10 ` [dpdk-dev] [PATCH 4/8] net/mvneta: add link update Andrzej Ostruszka
2018-08-28 15:10 ` [dpdk-dev] [PATCH 5/8] net/mvneta: support for promiscuous Andrzej Ostruszka
2018-08-28 15:10 ` [dpdk-dev] [PATCH 6/8] net/mvneta: add MAC filtering Andrzej Ostruszka
2018-08-28 15:10 ` [dpdk-dev] [PATCH 7/8] net/mvneta: add support for basic stats Andrzej Ostruszka
2018-08-28 15:10 ` [dpdk-dev] [PATCH 8/8] net/mvneta: add reset statistics callback Andrzej Ostruszka
2018-08-31 12:25 ` [dpdk-dev] [PATCH v2 0/8] Add Marvell NETA PMD Andrzej Ostruszka
2018-08-31 12:25   ` [dpdk-dev] [PATCH v2 1/8] net/bonding: fix buf corruption in packets Andrzej Ostruszka
2018-08-31 12:33     ` Andrzej Ostruszka
2018-08-31 12:25   ` [dpdk-dev] [PATCH v2 1/8] net/mvneta: add neta PMD skeleton Andrzej Ostruszka
2018-08-31 12:25   ` [dpdk-dev] [PATCH v2 2/8] " Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 2/8] net/mvneta: add Rx/Tx support Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 3/8] " Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 3/8] net/mvneta: support for setting of MTU Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 4/8] net/mvneta: add link update Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 4/8] net/mvneta: support for setting of MTU Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 5/8] net/mvneta: support for promiscuous Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 6/8] net/mvneta: add MAC filtering Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 7/8] net/mvneta: add support for basic stats Andrzej Ostruszka
2018-08-31 12:26   ` [dpdk-dev] [PATCH v2 8/8] net/mvneta: add reset statistics callback Andrzej Ostruszka
2018-08-31 12:59   ` [dpdk-dev] [PATCH v3 0/8] Add Marvell NETA PMD Andrzej Ostruszka
2018-08-31 12:59     ` [dpdk-dev] [PATCH v3 1/8] net/mvneta: add neta PMD skeleton Andrzej Ostruszka
2018-09-14 16:23       ` Ferruh Yigit
2018-09-19 15:14         ` Andrzej Ostruszka
2018-09-19 17:38           ` Ferruh Yigit
2018-08-31 12:59     ` [dpdk-dev] [PATCH v3 2/8] net/mvneta: add Rx/Tx support Andrzej Ostruszka
2018-09-14 16:24       ` Ferruh Yigit
2018-08-31 12:59     ` [dpdk-dev] [PATCH v3 3/8] net/mvneta: support for setting of MTU Andrzej Ostruszka
2018-08-31 12:59     ` [dpdk-dev] [PATCH v3 4/8] net/mvneta: add link update Andrzej Ostruszka
2018-08-31 12:59     ` [dpdk-dev] [PATCH v3 5/8] net/mvneta: support for promiscuous Andrzej Ostruszka
2018-08-31 12:59     ` [dpdk-dev] [PATCH v3 6/8] net/mvneta: add MAC filtering Andrzej Ostruszka
2018-09-14 16:24       ` Ferruh Yigit
2018-08-31 12:59     ` [dpdk-dev] [PATCH v3 7/8] net/mvneta: add support for basic stats Andrzej Ostruszka
2018-08-31 12:59     ` [dpdk-dev] [PATCH v3 8/8] net/mvneta: add reset statistics callback Andrzej Ostruszka
2018-09-10  6:11     ` [dpdk-dev] [PATCH v3 0/8] Add Marvell NETA PMD Andrzej Ostruszka
2018-09-14 16:20     ` Ferruh Yigit
2018-09-19 15:07       ` Andrzej Ostruszka
2018-09-19 17:39         ` Ferruh Yigit
2018-09-21 11:59           ` Andrzej Ostruszka
2018-09-21 13:37             ` Ferruh Yigit
2018-09-19 15:01     ` [dpdk-dev] [PATCH v4 " Andrzej Ostruszka
2018-09-19 15:01       ` [dpdk-dev] [PATCH v4 1/8] net/mvneta: add neta PMD skeleton Andrzej Ostruszka
2018-09-19 16:19         ` Stephen Hemminger
2018-09-20  7:45           ` Andrzej Ostruszka
2018-09-19 16:28         ` Stephen Hemminger [this message]
2018-09-20  7:57           ` Andrzej Ostruszka
2018-09-19 15:01       ` [dpdk-dev] [PATCH v4 2/8] net/mvneta: add Rx/Tx support Andrzej Ostruszka
2018-09-19 15:01       ` [dpdk-dev] [PATCH v4 3/8] net/mvneta: support for setting of MTU Andrzej Ostruszka
2018-09-19 15:01       ` [dpdk-dev] [PATCH v4 4/8] net/mvneta: add link update Andrzej Ostruszka
2018-09-19 15:01       ` [dpdk-dev] [PATCH v4 5/8] net/mvneta: support for promiscuous Andrzej Ostruszka
2018-09-19 15:01       ` [dpdk-dev] [PATCH v4 6/8] net/mvneta: add MAC filtering Andrzej Ostruszka
2018-09-19 15:01       ` [dpdk-dev] [PATCH v4 7/8] net/mvneta: add support for basic stats Andrzej Ostruszka
2018-09-19 15:01       ` [dpdk-dev] [PATCH v4 8/8] net/mvneta: add reset statistics callback Andrzej Ostruszka
2018-09-20  9:05       ` [dpdk-dev] [PATCH v5 0/8] Add Marvell NETA PMD Andrzej Ostruszka
2018-09-20  9:05         ` [dpdk-dev] [PATCH v5 1/8] net/mvneta: add neta PMD skeleton Andrzej Ostruszka
2018-09-24  9:21           ` Ferruh Yigit
2018-09-24  9:35             ` Ferruh Yigit
2018-09-24  9:38               ` Ferruh Yigit
2018-10-01  9:35                 ` Andrzej Ostruszka
2018-09-24  9:57           ` Ferruh Yigit
2018-09-24 10:03           ` Ferruh Yigit
2018-10-01  9:30             ` Andrzej Ostruszka
2018-09-20  9:05         ` [dpdk-dev] [PATCH v5 2/8] net/mvneta: add Rx/Tx support Andrzej Ostruszka
2018-09-20  9:05         ` [dpdk-dev] [PATCH v5 3/8] net/mvneta: support for setting of MTU Andrzej Ostruszka
2018-09-20  9:05         ` [dpdk-dev] [PATCH v5 4/8] net/mvneta: add link update Andrzej Ostruszka
2018-09-20  9:05         ` [dpdk-dev] [PATCH v5 5/8] net/mvneta: support for promiscuous Andrzej Ostruszka
2018-09-20  9:05         ` [dpdk-dev] [PATCH v5 6/8] net/mvneta: add MAC filtering Andrzej Ostruszka
2018-09-20  9:05         ` [dpdk-dev] [PATCH v5 7/8] net/mvneta: add support for basic stats Andrzej Ostruszka
2018-09-20  9:05         ` [dpdk-dev] [PATCH v5 8/8] net/mvneta: add reset statistics callback Andrzej Ostruszka
2018-10-01  9:26         ` [dpdk-dev] [PATCH v6 0/8] Add Marvell NETA PMD Andrzej Ostruszka
2018-10-01  9:26           ` [dpdk-dev] [PATCH v6 1/8] net/mvneta: add neta PMD skeleton Andrzej Ostruszka
2018-10-02 11:53             ` Ferruh Yigit
2018-10-01  9:26           ` [dpdk-dev] [PATCH v6 2/8] net/mvneta: add Rx/Tx support Andrzej Ostruszka
2018-10-02 11:54             ` Ferruh Yigit
2018-10-01  9:26           ` [dpdk-dev] [PATCH v6 3/8] net/mvneta: support for setting of MTU Andrzej Ostruszka
2018-10-01  9:26           ` [dpdk-dev] [PATCH v6 4/8] net/mvneta: add link update Andrzej Ostruszka
2018-10-01  9:26           ` [dpdk-dev] [PATCH v6 5/8] net/mvneta: support for promiscuous Andrzej Ostruszka
2018-10-01  9:26           ` [dpdk-dev] [PATCH v6 6/8] net/mvneta: add MAC filtering Andrzej Ostruszka
2018-10-01  9:26           ` [dpdk-dev] [PATCH v6 7/8] net/mvneta: add support for basic stats Andrzej Ostruszka
2018-10-01  9:26           ` [dpdk-dev] [PATCH v6 8/8] net/mvneta: add reset statistics callback Andrzej Ostruszka
2018-10-03  7:22           ` [dpdk-dev] [PATCH v7 0/8] Add Marvell NETA PMD Andrzej Ostruszka
2018-10-03  7:22             ` [dpdk-dev] [PATCH v7 1/8] net/mvneta: add neta PMD skeleton Andrzej Ostruszka
2018-10-03  7:22             ` [dpdk-dev] [PATCH v7 2/8] net/mvneta: add Rx/Tx support Andrzej Ostruszka
2018-10-03  7:22             ` [dpdk-dev] [PATCH v7 3/8] net/mvneta: support for setting of MTU Andrzej Ostruszka
2018-10-03  7:22             ` [dpdk-dev] [PATCH v7 4/8] net/mvneta: add link update Andrzej Ostruszka
2018-10-03  7:22             ` [dpdk-dev] [PATCH v7 5/8] net/mvneta: support for promiscuous Andrzej Ostruszka
2018-10-03  7:22             ` [dpdk-dev] [PATCH v7 6/8] net/mvneta: add MAC filtering Andrzej Ostruszka
2018-10-03  7:22             ` [dpdk-dev] [PATCH v7 7/8] net/mvneta: add support for basic stats Andrzej Ostruszka
2018-10-03  7:22             ` [dpdk-dev] [PATCH v7 8/8] net/mvneta: add reset statistics callback Andrzej Ostruszka
2018-10-03 13:25             ` [dpdk-dev] [PATCH v7 0/8] Add Marvell NETA PMD Ferruh Yigit
2018-10-03 19:46               ` 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=20180919092809.7ccde128@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=amo@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=tdu@semihalf.com \
    --cc=zr@semihalf.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
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).