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 8E029A0487 for ; Thu, 4 Jul 2019 16:39:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 705BF1BE4F; Thu, 4 Jul 2019 16:39:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 24DC61BE4E for ; Thu, 4 Jul 2019 16:39:27 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x64EZ4oK031763; Thu, 4 Jul 2019 07:39:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=CQRn04pPW41+NeeeDIwWHz/NRdiyKxQl/N8v3Mo5IA0=; b=svNF+Xu/WX/O+wSGPFVyNzRIjTEnfscChE1yLLPFQ89K0Xje3unYRlHB/diohRhplAkP Z2RrfhdNNsG78A8Xaituaf+LfaxAzGSgMGcdaFTSmTvPYXBrQ1q1RIVZMNRA0TDykBHx bSCblFNOb7KGx/gQAqLl1FCQxtFdAnve0tAhLdhPTX1b8vL2RhtPxHJnOG4LxbF1n3xS VwcAuolc6d1jD27s/+6txxUD0Zd5ETHy0pXmTIqLdoQFSIGSV8etlZbXD2LENdCaUWXg 60j8iy2nyB+DF0LYup/oS0XDCsrrRFJN5hxz5m983uvUTDz0ccYZDbS1LonKP65G80NZ iA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2thjyr82u4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2019 07:39:26 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 4 Jul 2019 07:39:24 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 4 Jul 2019 07:39:24 -0700 Received: from kk-box-0.marvell.com (unknown [10.95.130.145]) by maili.marvell.com (Postfix) with ESMTP id E40F13F7041; Thu, 4 Jul 2019 07:39:22 -0700 (PDT) From: To: , , "John W. Linville" CC: Krzysztof Kanas Date: Thu, 4 Jul 2019 16:39:05 +0200 Message-ID: <20190704143905.8704-1-kkanas@marvell.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-04_07:, , signatures=0 Subject: [dpdk-dev] [PATCH] net/af_packet: append system error to error msgs 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" From: Krzysztof Kanas Print system error to make easier diagnosis of errors with af_packet. Signed-off-by: Krzysztof Kanas --- drivers/net/af_packet/rte_eth_af_packet.c | 47 ++++++++++++----------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index f396f8b22a55..94ae4b13398d 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -13,7 +13,9 @@ #include #include #include +#include +#include #include #include #include @@ -605,8 +607,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, } if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) { PMD_LOG(ERR, - "%s: ioctl failed (SIOCGIFINDEX)", - name); + "%s: ioctl failed (SIOCGIFINDEX):%s", + name, rte_strerror(errno)); return -1; } (*internals)->if_name = strdup(pair->value); @@ -616,8 +618,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) { PMD_LOG(ERR, - "%s: ioctl failed (SIOCGIFHWADDR)", - name); + "%s: ioctl failed (SIOCGIFHWADDR):%s", + name, rte_strerror(errno)); return -1; } memcpy(&(*internals)->eth_addr, ifr.ifr_hwaddr.sa_data, ETH_ALEN); @@ -640,8 +642,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, qsockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); if (qsockfd == -1) { PMD_LOG(ERR, - "%s: could not open AF_PACKET socket", - name); + "%s: could not open AF_PACKET socket: %s", + name, rte_strerror(errno)); return -1; } @@ -650,8 +652,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, &tpver, sizeof(tpver)); if (rc == -1) { PMD_LOG(ERR, - "%s: could not set PACKET_VERSION on AF_PACKET socket for %s", - name, pair->value); + "%s: could not set PACKET_VERSION on AF_PACKET socket for %s:%s", + name, pair->value, rte_strerror(errno)); goto error; } @@ -660,8 +662,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, &discard, sizeof(discard)); if (rc == -1) { PMD_LOG(ERR, - "%s: could not set PACKET_LOSS on AF_PACKET socket for %s", - name, pair->value); + "%s: could not set PACKET_LOSS on AF_PACKET socket for %s:%s", + name, pair->value, rte_strerror(errno)); goto error; } @@ -670,8 +672,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, &qdisc_bypass, sizeof(qdisc_bypass)); if (rc == -1) { PMD_LOG(ERR, - "%s: could not set PACKET_QDISC_BYPASS on AF_PACKET socket for %s", - name, pair->value); + "%s: could not set PACKET_QDISC_BYPASS on AF_PACKET socket for %s:%s", + name, pair->value, rte_strerror(errno)); goto error; } #else @@ -681,8 +683,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, rc = setsockopt(qsockfd, SOL_PACKET, PACKET_RX_RING, req, sizeof(*req)); if (rc == -1) { PMD_LOG(ERR, - "%s: could not set PACKET_RX_RING on AF_PACKET socket for %s", - name, pair->value); + "%s: could not set PACKET_RX_RING on AF_PACKE socket for %s:%s", + name, pair->value, rte_strerror(errno)); goto error; } @@ -690,7 +692,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, if (rc == -1) { PMD_LOG(ERR, "%s: could not set PACKET_TX_RING on AF_PACKET " - "socket for %s", name, pair->value); + "socket for %s:%s", name, pair->value, + rte_strerror(errno)); goto error; } @@ -702,8 +705,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, qsockfd, 0); if (rx_queue->map == MAP_FAILED) { PMD_LOG(ERR, - "%s: call to mmap failed on AF_PACKET socket for %s", - name, pair->value); + "%s: call to mmap failed on AF_PACKET socket for %s:%s", + name, pair->value, rte_strerror(errno)); goto error; } @@ -738,9 +741,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, rc = bind(qsockfd, (const struct sockaddr*)&sockaddr, sizeof(sockaddr)); if (rc == -1) { - PMD_LOG(ERR, - "%s: could not bind AF_PACKET socket to %s", - name, pair->value); + PMD_LOG(ERR, "%s: could not bind AF_PACKET socket to %s:%s", + name, pair->value, rte_strerror(errno)); goto error; } @@ -748,9 +750,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, rc = setsockopt(qsockfd, SOL_PACKET, PACKET_FANOUT, &fanout_arg, sizeof(fanout_arg)); if (rc == -1) { - PMD_LOG(ERR, - "%s: could not set PACKET_FANOUT on AF_PACKET socket " - "for %s", name, pair->value); + PMD_LOG(ERR, "%s: could not set PACKET_FANOUT on AF_PACKET socket for %s:%s", + name, pair->value, rte_strerror(errno)); goto error; } #endif -- 2.21.0