From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00051.outbound.protection.outlook.com [40.107.0.51]) by dpdk.org (Postfix) with ESMTP id 554D9AAA0 for ; Tue, 17 Apr 2018 14:53:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coriant.onmicrosoft.com; s=selector1-coriant-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=peatWp6MSIvnwUQvd5Y3XaMd5dObzIQN1V6+TUFrCaY=; b=bQ442tWK5gOlb+gszUse4slOrNvu6oHF18zpa1425VKp8ZX689dc8teyIiurUs5K70PRH/b+qyadvdp7QZG+uu24gH3UHJUYFB/agIOqucI8lRHpyHVYREw13iFCDFvuGy1mYIh7y6EEF1d3p8tBMHfWuKECItbDa8+dkjJtZnA= Received: from HE1PR0401CA0064.eurprd04.prod.outlook.com (2603:10a6:3:19::32) by DB7PR04MB4298.eurprd04.prod.outlook.com (2603:10a6:5:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.10; Tue, 17 Apr 2018 12:53:32 +0000 Received: from HE1EUR02FT028.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e05::200) by HE1PR0401CA0064.outlook.office365.com (2603:10a6:3:19::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.675.10 via Frontend Transport; Tue, 17 Apr 2018 12:53:32 +0000 Authentication-Results: spf=pass (sender IP is 204.154.131.209) smtp.mailfrom=coriant.com; coriant.com; dkim=none (message not signed) header.d=none;coriant.com; dmarc=bestguesspass action=none header.from=coriant.com; Received-SPF: Pass (protection.outlook.com: domain of coriant.com designates 204.154.131.209 as permitted sender) receiver=protection.outlook.com; client-ip=204.154.131.209; helo=usnapvlsmtp01.coriant.com; Received: from usnapvlsmtp01.coriant.com (204.154.131.209) by HE1EUR02FT028.mail.protection.outlook.com (10.152.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.675.14 via Frontend Transport; Tue, 17 Apr 2018 12:53:31 +0000 Received: from fies1uas61.tellabs.fi (unknown [172.23.229.177]) by usnapvlsmtp01.coriant.com (Postfix) with ESMTP id 6ED8B401FE; Tue, 17 Apr 2018 07:53:29 -0500 (CDT) From: Juhamatti Kuusisaari To: CC: , Juhamatti Kuusisaari Date: Tue, 17 Apr 2018 15:53:10 +0300 Message-ID: <1523969590-40071-2-git-send-email-juhamatti.kuusisaari@coriant.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1523969590-40071-1-git-send-email-juhamatti.kuusisaari@coriant.com> References: <1523969590-40071-1-git-send-email-juhamatti.kuusisaari@coriant.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:204.154.131.209; IPV:CAL; SCL:-1; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(396003)(39380400002)(2980300002)(438002)(199004)(189003)(16586007)(47776003)(81156014)(6666003)(5660300001)(50226002)(86362001)(4326008)(81166006)(69596002)(8676002)(6916009)(36756003)(106466001)(8936002)(53416004)(316002)(426003)(305945005)(2616005)(106002)(54906003)(53936002)(97736004)(2906002)(72206003)(478600001)(77096007)(76176011)(6266002)(446003)(476003)(48376002)(26005)(51416003)(50466002)(107886003)(59450400001)(26826003)(104016004)(68736007)(2351001)(126002)(486006)(336012)(11346002)(356003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR04MB4298; H:usnapvlsmtp01.coriant.com; FPR:; SPF:Pass; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; HE1EUR02FT028; 1:w8KXMDNnM0zUwBAilI8HvNr2befsiR/LoWgkT3yc80hkbG2vQITuWwM/5D2ma9tKcvYd5XRBHLPh0QT3SH936MugmOQ9qMpaQP/Wlt7r7UtMflAhbNjNUuKxgXl5IUno MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4608076)(2017052603328)(7153060); SRVR:DB7PR04MB4298; X-Microsoft-Exchange-Diagnostics: 1; DB7PR04MB4298; 3:Ygg+Uz0uBK0gyR3F4nwM9+sQ/B8GnM7W9Jsmd8uU1CAR/FWnrYdfVnhvnQtOnj1SkiysRn5mvN0clyMCVi3ofVY8Om4sincrAG2R8vb9gIBLv6SDyI+6qLxBI9SPlUeiwEdCt2JC81u/BN4c49fEYTv91aMxCHOkMFPBpHBksqRnus4W2Q42bzOJsCVEpd4zn16NWKtrNEkeZoLE1pA2dZ8fc2n9Xbuq9d6ScZvEhTsbgbRW373G17AAUBLvsg6Kt8uyQ0bU88eYjmGgEjJJWf48UsOa/9JqnKkYnmoNCL3oqTFoSmy//Q+4OY+wqYHKtTI2hjskN8aDZxEKxSuwk0T6jvNvFZe1o1oDbYwEvHk=; 25:5AbKVKewUERDBBkiZzcj5uk5detOAY9JwiRfrEKW2onp2FzFz/zBDSikocTJBhS6x2jt6dqJtHxyUve/L0XFZJ6HxV0/aAfOR1JdUp9WLnTpxTlg+ACZF22t5Mg14eQbWazO2/qIfa7z6oJ3yiLJGeqszMAU4jpSyNs96jUo5siDRgU1itzjc4qiJOjWTN74N8jGsaTMNPqOJijZKWpK3oPp7/9hgVwESc1tMpimFVnnl9az4CA42EOEfZxVsnjt1A80DtA/rIRVfoecLp4DyM/GrtnMGYUZ5u6aX6GVfB09hJ9YEzxiZLcorc4eA5akyyCy6v6GvSqwY2PZsgD64Q== X-MS-TrafficTypeDiagnostic: DB7PR04MB4298: X-Microsoft-Exchange-Diagnostics: 1; DB7PR04MB4298; 31:8MZaM+1OtIxWGBmNsaebSThi39mqRrg6QAh/6a/+ip0JNWsREREygsqWbPZj4POe14sEJAvqolluoeQvWF4hHUMxhaZ0tXJjQW06uaojKjqIoTgNQEUOGpSQ7DkAa8b0fGxtfBnRf4/F+0wOwjkp+Jx1jjeNFqTdt2w3q7skjLMbWwmladMZrI8qcUZ/O49xb0SjaaLrUKTjIYjMrNYCllkiUPklbBN+5BZ6Vm3BRDE=; 20:hCmf4lXMrufV4OF0HBr96P4/VTvvjS1CsWjjm/fC6LZuiTHhbxvdVt17eA9pc7hrFLyezrBCoDFJB5la1WFOIWQOgcPgM/88dv8rNDI4XIr4vXSXXQU9Btqss7AAGUm4nJob9zmgtG0EzHWDoHlS2mVcTFP11PbB14FR8QgF3wX+fqW9u2tlxUn0uIVm6UxlUagJNdWxEy+JFTwFF/kaVLbvfPI0/KkQQCdUIbGQQnWzXniV/a1yWVF/MHKKG5xqXdvkmvh0E6gN3K7So5cJMSZxVYIw2+7Q2etoNm+XklLuC4LKyDwFfPT/L5ABGn+63+7Li9BsoZ19BawCCWP+DRCYPnBGt+tncHQHSISyU+h6eXb5om7yrsRDcxsGiWJLiJ+sMlkyTu+BHWCeNULeJ2LaaZJ5rGzFaYNBjwN1OsSOTN+7mEczQ9x6gTS6KeKCC3LpfVA536YXIuYIEBIRmZh1k0zj91qc5hFkkM7JD24LZ4ku42XIgEYJGYoCruRAWEatuPhlz3/bB2B14nmu7V8HHQY2cp8llQ0CHG1BYRGjQH1xPOxRQUg2JDcsp/CIvhppPN9P+YJl5cL/RwF87ZSkQlDnyMJ+XMDCGih/uWg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(51653755401839); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231232)(944501327)(52105095)(93006095)(93004095)(10201501046)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:DB7PR04MB4298; BCL:0; PCL:0; RULEID:; SRVR:DB7PR04MB4298; X-Microsoft-Exchange-Diagnostics: 1; DB7PR04MB4298; 4:6+zqgiZuVQkivDkzhG5dmqaYp/ZCd+w4+xH5YJdPkl6owquAnLgu2hgcKefPB/gYSC45bHnHdwfq7V6haTvKaWPBYGb7QllHE/V1KiR9v2q96HgH+I2gGe2Rl6kxB9NkKEiGI3KFPt5pMN10ZV7Zikf0/TsWWTfn3Yf6Kove6PQOnn1CSPc4nvY1NMKmGKTw1Rb0AXelWZdbqTpkEib9z2BqDZREIIqkz9FcSqabXiBgKPAWBaCnCC2wU2xR6ih1GvmlNfWg8mswSWruY3HxiTc43hsFTtkheqAw9glkCbW0dfCan/JMLkcig/UaTSUr X-Forefront-PRVS: 0645BEB7AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB7PR04MB4298; 23:8XxHSs2byIv5zET4rBIHSG3+Wx2gSkYGINoVR0OIk?= =?us-ascii?Q?opHBnfpR+SMR9uccmWOOBgtgc/LPE3s08cEgZb8UzWqzXREidV9HD0lMyp+x?= =?us-ascii?Q?va/23aWH8OGFd3uj3+YfqO9l9yaBkXDIlyyhSY76w8heFkLZGagyHkaCcZur?= =?us-ascii?Q?fpV1FVZJUI03dVKvHZX7MKF3uJizJ6NlUB5V5n3h+el4UlVjroqplX7T8zOL?= =?us-ascii?Q?WUQ2mRR0HPXWA4D0cat2GhCh1mStOLMTL6zlfUJ8GvGdCeSn6mXUtBYWULMv?= =?us-ascii?Q?LDcwVLedvQX0LdXVcFGwlqJ/AchzRFCVIAfZAmzaxUQimFB5lfsTCK1kXM/c?= =?us-ascii?Q?I//mlU0GxWVZETqqVdU0ZiWUTSZqt4Hev0iN2tmshzl2xxV1hJ7URSOvUdVR?= =?us-ascii?Q?Omx1C9oUF/t0i/dnDtqt4U9eHtBqvQmftzfnwVyTANlUXJrbHa+Kmxee4+F9?= =?us-ascii?Q?dljqH36Sldjm5Fa9v9UW4ZnAryGnx/zsxw71lO1dQY7Ypbe1PgLWajS6ErKE?= =?us-ascii?Q?Q+LgDVCLInJE6jmtTkE7sRiXmd6ldlzuMgMtrURqeAyAyofnja0knILxsGtU?= =?us-ascii?Q?irRwSxmAq69GnFn376Es8M2PoGDtEY+helg87WHC9xrOGTu/2snS9u+Q0GUe?= =?us-ascii?Q?wnsZaEAvQ9VQqVBsy68mhmFCyGe6Ahk/Il7D3Dh+kNXfOkTjFnS2oqq+/obT?= =?us-ascii?Q?IqtwwScHHIXx/yMajuXhfoXm0wFbb6kqaVkA626nxAtyQxgyqkYjrqCfErZJ?= =?us-ascii?Q?Y6UPFCVGMW5lWL2z8auEd3czONbMWIzO4/WlSKdhaUgtllppAqMboybgRJ5x?= =?us-ascii?Q?O0tHFeNeXmxyTQSH7vEMoYXAQJ5qc7YUZKFXerYlXuThqkUwCZtc0XGvc6i0?= =?us-ascii?Q?99+gqIab/nRIP5NGrNJVw4jYVv1v7mS6+LSplSxvcsYVFRVOeLtYb1Yfv1LX?= =?us-ascii?Q?UwZjZ/wLPwpjpsXqcY68EIarjrblDh+CpmIycHneRksZvDr9xpJUJjcvjWHf?= =?us-ascii?Q?tMRhoE0PIjl1ZMDqmOtNwlk4WItoYNESoE4isimn+NWlod7o465jd56Jbj6O?= =?us-ascii?Q?s7Nwv53x10X4v4LQt48slNqKqgyOi90jGyLDHc3HjJdXh0RQ2bx57jvkX8Ah?= =?us-ascii?Q?pxwMl+kxMdwdp2FqcVitHRva9SdDMknZTqdnpFa0AIw0kuilbKUmRfai6JLT?= =?us-ascii?Q?HcjsQO9PD6xYjdHPuTOy0388UkdsRwGVGg1lHc0KaGpsi60H9ac7l9Ks676+?= =?us-ascii?Q?bsVXQ1ShqQKVhaQeNE=3D?= X-Microsoft-Antispam-Message-Info: Vx+KZ1WkKCcHt2v28PKeKh41tz1dgmIQi1cVOmd24knsUlRfYG0wM86DlX/q02RANUM+pfSggJGYxcv/J6GbgpRTaQ7CQLhQQRPgqpV776uly+USEJ1nCfMyaOq7QCihC4tYHI9SksH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waILqahLQGX8R1W4y4qITNSubTLWnt+aIZuft8Yp1gpbDa0YgR7jYw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB7PR04MB4298; 7:stPH84hM2HICBhumaiyMnNVAelH8fP3+ya4d/O0rAkGuMjRUBslwy+sS0H+BMV6APcC928ZKVDs40uPyepkqvW2iJTaoKUA4yrtiH+I3rgJSCwcL2ZQ+zADtv0yjyJROu0eDx8s2FUapaTELx73j/CkYG9o02dbQs06u4HB0HoP2Mn0S5X9hR9nmwDa+fQSIpc83lFaLcOhwzdLfGtmnnDYN2P6JLgzi8tTjPdxPI9nIi+sQSdTcI1R1pCngu84r X-MS-Office365-Filtering-Correlation-Id: 70c28aef-d336-4a99-8bd1-08d5a462397b X-OriginatorOrg: coriant.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2018 12:53:31.6410 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 70c28aef-d336-4a99-8bd1-08d5a462397b X-MS-Exchange-CrossTenant-Id: 76595477-907e-4695-988b-a6b39087332d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=76595477-907e-4695-988b-a6b39087332d; Ip=[204.154.131.209]; Helo=[usnapvlsmtp01.coriant.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4298 Subject: [dpdk-dev] [PATCH v2 2/2] net/pcap: physical interface MAC support 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: , X-List-Received-Date: Tue, 17 Apr 2018 12:53:36 -0000 Support for PCAP MAC address using physical interface MAC. Support for getting proper link status, speed and duplex. Signed-off-by: Juhamatti Kuusisaari --- v2: * Fix whitespace --- drivers/net/pcap/rte_eth_pcap.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index d2aba1c..4d6db55 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -619,18 +619,22 @@ eth_link_update(struct rte_eth_dev *dev __rte_unused, struct pmd_internals *internals = dev->data->dev_private; if (internals->if_name && (internals->if_fd != -1)) { - /* Get link status, speed and duplex from the underlying interface */ - strncpy(ifr.ifr_name, internals->if_name, sizeof(ifr.ifr_name)-1); - ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0; + /* Get link status, speed and duplex of the interface. */ + strncpy(ifr.ifr_name, internals->if_name, + sizeof(ifr.ifr_name) - 1); + ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = 0; if (!ioctl(internals->if_fd, SIOCGIFFLAGS, &ifr)) - dev->data->dev_link.link_status = (ifr.ifr_flags & IFF_UP) ? 1 : 0; + dev->data->dev_link.link_status = + (ifr.ifr_flags & IFF_UP) ? 1 : 0; cmd.cmd = ETHTOOL_GSET; ifr.ifr_data = (void *)&cmd; if (!ioctl(internals->if_fd, SIOCETHTOOL, &ifr)) { - dev->data->dev_link.link_speed = ethtool_cmd_speed(&cmd); + dev->data->dev_link.link_speed = + ethtool_cmd_speed(&cmd); dev->data->dev_link.link_duplex = - cmd.duplex ? ETH_LINK_FULL_DUPLEX : ETH_LINK_HALF_DUPLEX; + cmd.duplex ? + ETH_LINK_FULL_DUPLEX : ETH_LINK_HALF_DUPLEX; } } #endif /* RTE_LIBRTE_PMD_PCAP_IF_MAC_SUPPORT */ @@ -896,21 +900,30 @@ eth_from_pcaps_common(struct rte_vdev_device *vdev, break; } - if (pair == NULL) + if (pair == NULL) { (*internals)->if_index = 0; - else { + } else { (*internals)->if_index = if_nametoindex(pair->value); #ifdef RTE_LIBRTE_PMD_PCAP_IF_MAC_SUPPORT - /* Use real interface mac addr, save name and fd for eth_link_update() */ + /* + * Use real interface mac addr, save name and + * file descriptor for the update. + */ (*internals)->if_name = strdup(pair->value); (*internals)->if_fd = socket(AF_INET, SOCK_DGRAM, 0); if ((*internals)->if_fd != -1) { struct ifreq ifr; - strncpy(ifr.ifr_name, pair->value, sizeof(ifr.ifr_name)-1); - ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0; + strncpy(ifr.ifr_name, pair->value, + sizeof(ifr.ifr_name) - 1); + ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = 0; if (!ioctl((*internals)->if_fd, SIOCGIFHWADDR, &ifr)) { - (*eth_dev)->data->mac_addrs = rte_zmalloc_socket(NULL, ETHER_ADDR_LEN, 0, vdev->device.numa_node); - rte_memcpy((*eth_dev)->data->mac_addrs, ifr.ifr_addr.sa_data, ETHER_ADDR_LEN); + (*eth_dev)->data->mac_addrs = + rte_zmalloc_socket(NULL, + ETHER_ADDR_LEN, 0, + vdev->device.numa_node); + rte_memcpy((*eth_dev)->data->mac_addrs, + ifr.ifr_addr.sa_data, + ETHER_ADDR_LEN); } } #endif /* RTE_LIBRTE_PMD_PCAP_IF_MAC_SUPPORT */ -- 2.8.1