From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59D4945B3A; Mon, 14 Oct 2024 19:41:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3068C402C3; Mon, 14 Oct 2024 19:41:23 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id CA0C74026C for ; Mon, 14 Oct 2024 19:41:21 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-20caccadbeeso30804165ad.2 for ; Mon, 14 Oct 2024 10:41:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728927681; x=1729532481; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=68knNu8k5wDrpXsdmTGCVJl9PP015ImxNOrmTHwoqx0=; b=jZULKbA3vPmRHNYC486BSWLIwjfMjCc7p+LkFXRbveVzNB7ZfHTcUc1UJauIrS2Gno MDBTct2cce9d852XiwfZJQtKhWWvVzUMKPWG+XTnvim7mbrRkpO/KEWL6ULVRY0BGBBA BjBE2uM4j8x0/qTRPopRbEI+Gj/yURh/QbjwN6FTdSqZltr39FHdVhViyH9CVSQNPAEi FeFQCSxPxRWAeS0W7jW8oD5PtL6VI4vqANeYqfGv/msAH9XCVfMRz+JWOG8f6//kJ35p vVtnXnjmv6cuX0obV44shKud1KgfHvz8u7VLpHyn3Gd5Rb02mA5G/kCxFuXiqqbwImw9 OxLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728927681; x=1729532481; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=68knNu8k5wDrpXsdmTGCVJl9PP015ImxNOrmTHwoqx0=; b=PwUkNIQJk79ro8CHPAqADau/TYnUs1Rd0z40QnfppX+Zz5ch73rh5qQCddSLWyRc2A 3Og9hit9O0hcBn422aSlnsnxG6u+cJJvymRx+c5+R0UgkxOxSxveMypvPNxVui9V6Lbo U01QOWgPw0sAgND3E1RI6fsqjXntIZWDl6aVCfuLtEnqKHsISJ/qAR4m95DnH21T+KRS NcOXDF2W1ujZg67LuvhdZYI2KFbw4S1rWeesKBtc2kHpiZhEmjYQCIdOb7Aa8Clx1dLg 3YR+dAv7OlJbQCQcQRLyM8kQYOqIf6RXD8gEeByzp0ryAJgBQitYCMLCvawy//+HHWJU OAPA== X-Gm-Message-State: AOJu0YxI4dS0NwXmFF7UacgRab8OZPiEZmjISvx3Ij8M/9AcyyTw5Hox 0GMnrD+h1U9N/2oWDjm7no0z1RRKp0KR2WMpsY0hQi9C5CzbE8uRFzpLkPS/T/A= X-Google-Smtp-Source: AGHT+IHHui9WYV1S/qgjTc3yY/FrBlue2LUEiPhjjhdeDU1Ct/3m243lNW03/+sOoo6f4U9z7F0xXw== X-Received: by 2002:a17:902:d4cc:b0:20c:db77:a4f0 with SMTP id d9443c01a7336-20cdb77a8b8mr86499155ad.25.1728927680677; Mon, 14 Oct 2024 10:41:20 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8bc0ca42sm69117645ad.98.2024.10.14.10.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 10:41:20 -0700 (PDT) Date: Mon, 14 Oct 2024 10:41:18 -0700 From: Stephen Hemminger To: Gur Stavi Cc: , "John W. Linville" Subject: Re: [PATCH v01] net/af_packet: support link status update Message-ID: <20241014104118.45aaf3cd@hermes.local> In-Reply-To: <330d6b3cea8a28688e9b58ea4a02ca68ac3aab96.1728829107.git.gur.stavi@huawei.com> References: <330d6b3cea8a28688e9b58ea4a02ca68ac3aab96.1728829107.git.gur.stavi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Sun, 13 Oct 2024 17:29:23 +0300 Gur Stavi wrote: > static int > -eth_link_update(struct rte_eth_dev *dev __rte_unused, > +eth_link_update(struct rte_eth_dev *dev, > int wait_to_complete __rte_unused) > { > + const struct pmd_internals *internals = dev->data->dev_private; > + struct rte_eth_link *dev_link = &dev->data->dev_link; > + int sockfd = internals->rx_queue[0].sockfd; > + struct ifreq ifr = { }; > + int ret; > + > + if (sockfd == -1) > + return 0; > + > + strlcpy(ifr.ifr_name, internals->if_name, IFNAMSIZ); > + ret = ioctl(sockfd, SIOCGIFFLAGS, &ifr); > + if (!ret) > + dev_link->link_status = (ifr.ifr_flags & IFF_RUNNING) ? > + RTE_ETH_LINK_UP : RTE_ETH_LINK_DOWN; If ioctl() fails, the function should return an error. something like: if (ioctl(sockfd, SIOCGIFFFLAGS, &ifr) != 0) return -errno;