From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 3660358CB for ; Mon, 28 Jan 2019 12:45:48 +0100 (CET) Received: by mail-pl1-f196.google.com with SMTP id a14so7602580plm.12 for ; Mon, 28 Jan 2019 03:45:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nfware-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=N0CWZ95up2bAgbBz++MwOpfgsSys4Afct7/C6uUrT/k=; b=AzxX/BLlJOz3G2r8LMglxlsTQ8gfpzKaJiFCJOxQmfTa5hSaSz5s5WunjPy7qD6MyS RFflnqO7MnwUC2u5j2RuIvNCP+Kxqobbl/R6O9ccRhtKBmi0RUGb7euWUtUdIs0nbw6C NzrbwKDIOU0VMIoWt7eY6M0HLNAAxnVkBbu/NMtbPeK1INlKtqPGIFcq1BsaeE/+GFhS IDI/T1YcKN5Ne5CZxlRIG94G8HD8DXLOvHpqQLpgEuZzTlSAs/2NRl8Y5W0qIvU6fS0r 8p5ZO7Xe1N8nKzyWLsGvRRV1cafeRVjXOQ4yzevl3ObL7s6PzTYgw1DOlxAzGUQfQinp 5MgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=N0CWZ95up2bAgbBz++MwOpfgsSys4Afct7/C6uUrT/k=; b=tz0geHiL3wsipKMbzJfIESj0WKZv9nkxM8Dky72lulocYgLnr3crRjHaRC14+gq0MX Quqiaq50E6WvI2DyDreOmqgbNOUd+QlWvk81wLnNshIXsvFKNApD8+5fVsDtgJjMssJT xM57cHzGWDCt4LL3TRwxor1H8glGK+aOujnECfzsnS19ZjLsqMQK3ufVhqzOZabl8Pi7 II5sIHcd9p47WTyLHsN1ttm9pJnA4L4g1F/fDEPb0oOMW+GB8D11F+SJqoGl6AdNIDeY eI6cqq14Lf2tTDJNT4iwGlwsIZZPNTG1zkzow3CKYPQZ73v2viOY+sGqME0v15bqAgYE hl5A== X-Gm-Message-State: AJcUukfgmC+US0L9UlUpiLxq4q1ZzUvnR89Fy7isUoWBSQ+DylW+LGuh DAuG+vrkKtveFKnNkwCipyqFE4nmIA4srXyaHEJX/751 X-Google-Smtp-Source: ALg8bN5QEDNIUVDLhByKryJw8u0Wy6JFChNYByXOaoTOaEYkyM8D+NZcoWLYKIpkJzxY7C0C7Pmcbl16bZGakVxyz+0= X-Received: by 2002:a17:902:bd4a:: with SMTP id b10mr21587583plx.232.1548675947305; Mon, 28 Jan 2019 03:45:47 -0800 (PST) MIME-Version: 1.0 References: <20190124204749.49912-1-iryzhov@nfware.com> In-Reply-To: <20190124204749.49912-1-iryzhov@nfware.com> From: Igor Ryzhov Date: Mon, 28 Jan 2019 14:45:36 +0300 Message-ID: To: Ferruh Yigit Cc: stable@dpdk.org, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-stable] [PATCH] kni: fix rte_kni_update_link X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 11:45:48 -0000 Hi Ferruh, Can you, please, take a look at this patch? The current implementation is broken, I think the patch should be merged into 19.02 and 18.11.1. Best regards, Igor On Thu, Jan 24, 2019 at 11:47 PM Igor Ryzhov wrote: > After read, file offset must be set to 0 before write. > Otherwise, the third byte will be overwritten instead of the first. > > Fixes: c6fd54f28c24 ("kni: add function to set link state on kernel > interface") > Cc: stable@dpdk.org > > Signed-off-by: Igor Ryzhov > --- > lib/librte_kni/rte_kni.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c > index 73aeccccf..5899bb14a 100644 > --- a/lib/librte_kni/rte_kni.c > +++ b/lib/librte_kni/rte_kni.c > @@ -746,6 +746,12 @@ rte_kni_update_link(struct rte_kni *kni, unsigned int > linkup) > } > old_linkup = (old_carrier[0] == '1'); > > + if (lseek(fd, 0, SEEK_SET) == -1) { > + RTE_LOG(ERR, KNI, "Failed to change file position: %s.\n", > path); > + close(fd); > + return -1; > + } > + > new_carrier = linkup ? "1" : "0"; > ret = write(fd, new_carrier, 1); > if (ret < 1) { > -- > 2.20.1 > >