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 C668FA0547; Thu, 26 Aug 2021 19:15:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 72D7F4123C; Thu, 26 Aug 2021 19:15:41 +0200 (CEST) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mails.dpdk.org (Postfix) with ESMTP id A206741231 for ; Thu, 26 Aug 2021 19:15:39 +0200 (CEST) Received: by mail-pj1-f44.google.com with SMTP id j10-20020a17090a94ca00b00181f17b7ef7so7063732pjw.2 for ; Thu, 26 Aug 2021 10:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=71tzNq/BXSBD7FRAza2t6mjLY07cmL3kvB2p900C/aQ=; b=DYYEFL3rm5AjFbiSKixupJqisE/SFUrH7vvaDS2p3Fyb8tWCO38WSD+DiRdpvIxdRj 4hM79dB0G/DL400rYvXkY2gZSKkmBzHC9YsM/8s6OmlEqbPuzRa1v6HTOOMYU22ha6HD p18PV1DQWKD/n9Dq8uUvgRb2v0ToM4m/fxJLPrD/TQ3Z05CV8Jlju47/3aeVqf+FVbYu tUHtChhdZhwXE+oCGWCSX43NU6+BJ+XtqVGbK0mQlWzuZgLbu1u/+ZEIbjyBVENj0ar4 O7/0RidRKtq7WRn+LdoBCv27napbUdSBhs1o5Evj0AGg8KXW2sO08knD4b47zWnpp1HC yZpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=71tzNq/BXSBD7FRAza2t6mjLY07cmL3kvB2p900C/aQ=; b=IFJ2G4HeSev2FhQ6wZTHWULdrBs0TgdiP4cfsLEY/LwM5WaAH1fBFpJl9fuNJ/bfY/ PRZsAPDK7TlOE8oTlXMdOGa+MmJpm67yIdN3vg5toWWDNqbRNq7S1fR6WBXOdDQHEjHv F1kCE5fId/l0ISHt/pywNghCM6vwgu/CYMhRbBL16cM6iHgoh+xMCa72TRN6YZQYsz0G GfxZlfgKDMhU0+lYlztoulSmyiRQ4KjsAT6SN691CeR7CnOGCpJblvHvMLhfb+Bie3Od gf92HYpWYBpOQoPOfDQ8ODlhhgGYHDGL4/jdppwAMBCFiIMvwXKi41+QeealTdEo3QTE RuXg== X-Gm-Message-State: AOAM531ueP20C6XpvU0Sn6fzUH5fwqJ+WVNzdIKyQnrxDJoS3EEeZV6c PTe6f6/u685ZQo3qzbfJjP6b9w== X-Google-Smtp-Source: ABdhPJypJvv42DriVnzzCvbb5yOkyDDe+94nSJjRortl4Wn8uY2e3L2TKQBSoF0EtspzrDHrDZl7eg== X-Received: by 2002:a17:902:6b8a:b029:12d:3f99:9e5e with SMTP id p10-20020a1709026b8ab029012d3f999e5emr4562732plk.66.1629998138560; Thu, 26 Aug 2021 10:15:38 -0700 (PDT) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id 31sm4138160pgy.26.2021.08.26.10.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 10:15:38 -0700 (PDT) Date: Thu, 26 Aug 2021 10:15:35 -0700 From: Stephen Hemminger To: Igor Ryzhov Cc: dev@dpdk.org, ferruh.yigit@intel.com, Dan Gora Message-ID: <20210826101535.7b9c08c1@hermes.local> In-Reply-To: <20210826151911.15699-1-iryzhov@nfware.com> References: <20210704160610.62682-1-iryzhov@nfware.com> <20210826151911.15699-1-iryzhov@nfware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 1/3] kni: rework rte_kni_update_link using ioctl 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 Sender: "dev" On Thu, 26 Aug 2021 18:19:09 +0300 Igor Ryzhov wrote: > > +static int > +kni_ioctl_link(struct net *net, uint32_t ioctl_num, > + unsigned long ioctl_param) > +{ > + struct kni_net *knet = net_generic(net, kni_net_id); > + int ret = -EINVAL; > + struct kni_dev *dev, *n; > + struct rte_kni_link_info link_info; > + struct net_device *netdev; > + > + if (_IOC_SIZE(ioctl_num) > sizeof(link_info)) > + return -EINVAL; > + > + if (copy_from_user(&link_info, (void *)ioctl_param, sizeof(link_info))) > + return -EFAULT; > + > + if (strlen(link_info.name) == 0) > + return -EINVAL; > + > + down_read(&knet->kni_list_lock); > + list_for_each_entry_safe(dev, n, &knet->kni_list_head, list) { > + if (strncmp(dev->name, link_info.name, RTE_KNI_NAMESIZE) != 0) > + continue; > + > + netdev = dev->net_dev; > + > + if (link_info.status) { > + netif_carrier_on(netdev); > + > + dev->speed = link_info.speed; > + dev->duplex = link_info.duplex; > + dev->autoneg = link_info.autoneg; > + } else { > + netif_carrier_off(netdev); > + } > + > + ret = 0; > + break; > + } > + up_read(&knet->kni_list_lock); > + > + return ret; > +} > + You need to be using the RTNL mutex in KNI here (and probably elsewhere). The use of semaphore for list lock should also be replaced by a mutex. The KNI driver was written long ago and was never reviewed by people knowledgeable about kernel networking. That is one reason IMHO KNI should not be used in production systems.