From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1F859A0A0A;
	Fri, 22 Jan 2021 18:02:21 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id A22ED14101D;
	Fri, 22 Jan 2021 18:02:20 +0100 (CET)
Received: from inbox.dpdk.org (xvm-172-178.dc0.ghst.net [95.142.172.178])
 by mails.dpdk.org (Postfix) with ESMTP id 9924814100C
 for <dev@dpdk.org>; Fri, 22 Jan 2021 18:02:19 +0100 (CET)
Received: by inbox.dpdk.org (Postfix, from userid 33)
 id 677F0A0A0B; Fri, 22 Jan 2021 18:02:19 +0100 (CET)
From: bugzilla@dpdk.org
To: dev@dpdk.org
Date: Fri, 22 Jan 2021 17:02:18 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: DPDK
X-Bugzilla-Component: ethdev
X-Bugzilla-Version: unspecified
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: normal
X-Bugzilla-Who: anatoly.burakov@intel.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: Normal
X-Bugzilla-Assigned-To: dev@dpdk.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform
 op_sys bug_status bug_severity priority component assigned_to reporter
 target_milestone
Message-ID: <bug-624-3@http.bugs.dpdk.org/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.dpdk.org/
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
MIME-Version: 1.0
Subject: [dpdk-dev] [Bug 624] Port close results in "invalid port_id" log
 message
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

https://bugs.dpdk.org/show_bug.cgi?id=3D624

            Bug ID: 624
           Summary: Port close results in "invalid port_id" log message
           Product: DPDK
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: ethdev
          Assignee: dev@dpdk.org
          Reporter: anatoly.burakov@intel.com
  Target Milestone: ---

Closing port leads to an EAL error log message:

```
int
rte_eth_dev_close(uint16_t port_id)
{
        struct rte_eth_dev *dev;
        int firsterr, binerr;
        int *lasterr =3D &firsterr;

        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
        dev =3D &rte_eth_devices[port_id];

        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP);
        *lasterr =3D (*dev->dev_ops->dev_close)(dev);
        if (*lasterr !=3D 0)
                lasterr =3D &binerr;

        rte_ethdev_trace_close(port_id);
        *lasterr =3D rte_eth_dev_release_port(dev);

        return eth_err(port_id, firsterr);
}
```

eth_err() is called after rte_dev_release_port(), so the port_id is no long=
er
valid at that stage. The eth_err() itself calls rte_eth_dev_is_removed(), w=
hich
in turn calls RTE_ETH_VALID_PORTID_OR_ERR_RET(), which outputs a log messag=
e on
invalid port_id.

Offending commit seems to be:

```
commit 8a5a0aad5d3e4f4f75ca81932eb247de94765685
Author: Thomas Monjalon <thomas@monjalon.net>
Date:   Fri Oct 16 15:32:59 2020 +0200

    ethdev: allow close function to return an error

    The API function rte_eth_dev_close() was returning void.
    The return type is changed to int for notifying of errors.

    If an error happens during a close operation,
    the status of the port is undefined,
    a maximum of resources having been freed.

    Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
    Reviewed-by: Liron Himi <lironh@marvell.com>
    Acked-by: Stephen Hemminger <stephen@networkplumber.org>
    Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
    Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
```

--=20
You are receiving this mail because:
You are the assignee for the bug.=