From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D15D1A0471 for ; Wed, 14 Aug 2019 12:38:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 47C2D375B; Wed, 14 Aug 2019 12:38:56 +0200 (CEST) Received: from inbox.dpdk.org (xvm-172-178.dc0.ghst.net [95.142.172.178]) by dpdk.org (Postfix) with ESMTP id 9E9251D7 for ; Wed, 14 Aug 2019 12:38:54 +0200 (CEST) Received: by inbox.dpdk.org (Postfix, from userid 33) id 82742A10DA; Wed, 14 Aug 2019 12:38:54 +0200 (CEST) From: bugzilla@dpdk.org To: dev@dpdk.org Date: Wed, 14 Aug 2019 10:38:54 +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: 18.02 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: abhishek.sachan@altran.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 cc target_milestone Message-ID: 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 339] net/af_packet: af_packet driver is leaving stale socket after device is removed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" https://bugs.dpdk.org/show_bug.cgi?id=3D339 Bug ID: 339 Summary: net/af_packet: af_packet driver is leaving stale socket after device is removed Product: DPDK Version: 18.02 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: Normal Component: ethdev Assignee: dev@dpdk.org Reporter: abhishek.sachan@altran.com CC: linville@tuxdriver.com Target Milestone: --- I am trying to use af_packet dpdk pmd driver in "ovs with dpdk". Looks like af_packet driver is leaving stale sockets after device is remove= d. The stale sockets can be confirmed by the output of "ss -0" command. Kindly let me know if this is known/valid issue. Have suggested a code change in dpdk net/af_packet to fix the issue, please suggest if this is appropriate fix so that i can submit a patch. Below is the output of "ss -0" after addition and deletion of port in ovs : [1] Add port in ovs using command "ovs-vsctl add-port br0 wan -- set Interf= ace wan type=3Ddpdk options:dpdk-devargs=3Deth_af_packet0,iface=3Dveth0" #ss -0 Netid Recv-Q Send-Q Local Address:Port=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 Peer Address:Port p_raw 0 0 *:veth0=20=20=20= =20=20=20=20=20=20=20=20=20=20 * [2] Delete port in ovs using command "ovs-vsctl del-port br0 wan" #ss -0 Netid Recv-Q Send-Q Local Address:Port=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 Peer Address:Port p_raw 0 0 *:veth0=20=20=20= =20=20=20=20=20=20=20=20=20=20 * "ss -0" output keeps showing stale entry , and the stale entries keeps pili= ng up with multiple add/del triggered for same port in ovs. All the entries gets removed only when ovs process is exited. Went through dpdk net/af_packet code and below are the findings:- [1] Ring buffers are memory mapped when device is added using rte_dev_probe [2] There is no corresponding munmap call when device is removed/closed [3] The issue is fixed by calling munmap from rte_pmd_af_packet_remove()=20 Patch for changes done to fix the issue :- --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -972,6 +972,7 @@ { struct rte_eth_dev *eth_dev =3D NULL; struct pmd_internals *internals; + struct tpacket_req *req; unsigned q; PMD_LOG(INFO, "Closing AF_PACKET ethdev on numa socket %u", @@ -992,7 +993,10 @@ return rte_eth_dev_release_port(eth_dev); internals =3D eth_dev->data->dev_private; + req =3D &(internals->req); for (q =3D 0; q < internals->nb_queues; q++) { + munmap(internals->rx_queue[q].map, + 2 * req->tp_block_size * req->tp_block_nr); rte_free(internals->rx_queue[q].rd); rte_free(internals->tx_queue[q].rd); } --=20 You are receiving this mail because: You are the assignee for the bug.=