From patchwork Thu Nov 14 18:44:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 1195053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cPhBmbId"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47DVm03r2vz9sQw for ; Fri, 15 Nov 2019 05:45:20 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1AD4689C95; Thu, 14 Nov 2019 18:45:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yQa2rOnfCDTM; Thu, 14 Nov 2019 18:45:18 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 7214589C8B; Thu, 14 Nov 2019 18:45:18 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 9911F1BF289 for ; Thu, 14 Nov 2019 18:45:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8F6CA882E0 for ; Thu, 14 Nov 2019 18:45:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1e3OU3LievgE for ; Thu, 14 Nov 2019 18:45:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E1A56882BC for ; Thu, 14 Nov 2019 18:45:15 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id j12so3019737plt.9 for ; Thu, 14 Nov 2019 10:45:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y5PpCROqLUVCSPUX0tvoqkWmvSCrAux1rzZqUUXzDoo=; b=cPhBmbIdmtQyfQF5AzbqYAvH2xoRj/40g6d2qV5pdY0c1+x9QJjtVhWv32MQqPBmNc Sk6GtuGCYW8VDpn/EN2UxzavB3UQ97D36VdcOf+oVrOKj8VG6hJUtXZo7kYhh/Y8TFKn E2uKmuVao6l+yWztnczXHEXRQt/NKrdxorFH7K+nk19Obb34h7PhMpC2hk6ewz8CAMxW Oc1q41H87UAMM/EpVkDyJAbTMcE1/bIjmru0tVvXGVBnd/vbvQwcp4UR+DE4Os4Rfq37 fStGwklceIwevHB10wpqPsz8vj6wfNcplYtGBWKOGQiowq1zh9MttEduJM2LX+jcC9Lw 7VUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y5PpCROqLUVCSPUX0tvoqkWmvSCrAux1rzZqUUXzDoo=; b=FA2c7gqqKZYoPq2QS7mj48LSRDU7M6eGFXGrYn4IUzBP8h7ONA3kuXZV9EKYrJ7aPG iXqbnEo2doEJgJvM9uU6JPkv0IQK5zyNTKxaRWXtDTnBjHg/2A3OX14+rQnYMbFvMIfu eoOBBq4AUxnZ0Hv8JPfpIVwKXWKFvdM8oGGrY/F9VZbV7qlDdE8mQ3WovuSasJ95hvhX H38+g6ML9pQUjgLSj9Ff0/bV6du6Cljw8W8lo4CWx4Pzq0Ctoh4M786QYNfTaRZXg0li CRjgPaS9GtJmM1f90JTQwhtQ8Y/zFpnbuIMogCxX9bae+ebjYeUpB3SbzJ5U9c0l+dEw 8w0w== X-Gm-Message-State: APjAAAXf8agxhvE0W5MDMwAQGFRlweG0Is1L8uwg/37zesDoWrjlJfNs iYzL1EnNoHJAJ576jVjdxFE= X-Google-Smtp-Source: APXvYqxwXzvhDmITW4QOWmuk5/jUBwai9RuM5ACXa/w6RYjVf9/qTI18CLm1V501Va+erWE2fXAFHA== X-Received: by 2002:a17:902:6a88:: with SMTP id n8mr637917plk.226.1573757115373; Thu, 14 Nov 2019 10:45:15 -0800 (PST) Received: from localhost.localdomain (c-73-241-114-122.hsd1.ca.comcast.net. [73.241.114.122]) by smtp.gmail.com with ESMTPSA id 23sm6819507pgw.8.2019.11.14.10.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 10:45:14 -0800 (PST) From: Richard Cochran To: netdev@vger.kernel.org Date: Thu, 14 Nov 2019 10:44:58 -0800 Message-Id: <20191114184507.18937-5-richardcochran@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH net 04/13] dp83640: reject unsupported external timestamp flags X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christopher Hall , Brandon Streiff , Sergei Shtylyov , Felipe Balbi , Eugenia Emantayev , Feras Daoud , intel-wired-lan@lists.osuosl.org, David Miller , Stefan Sorensen Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Jacob Keller Fix the dp83640 PTP support to explicitly reject any future flags that get added to the external timestamp request ioctl. In order to maintain currently functioning code, this patch accepts all three current flags. This is because the PTP_RISING_EDGE and PTP_FALLING_EDGE flags have unclear semantics and each driver seems to have interpreted them slightly differently. For the record, the semantics of this driver are: flags Meaning ---------------------------------------------------- -------------------------- PTP_ENABLE_FEATURE Time stamp rising edge PTP_ENABLE_FEATURE|PTP_RISING_EDGE Time stamp rising edge PTP_ENABLE_FEATURE|PTP_FALLING_EDGE Time stamp falling edge PTP_ENABLE_FEATURE|PTP_RISING_EDGE|PTP_FALLING_EDGE Time stamp falling edge Cc: Stefan Sørensen Cc: Richard Cochran Signed-off-by: Jacob Keller Reviewed-by: Richard Cochran --- drivers/net/phy/dp83640.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 04ad77758920..2781b0e2d947 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -469,6 +469,11 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, switch (rq->type) { case PTP_CLK_REQ_EXTTS: + /* Reject requests with unsupported flags */ + if (rq->extts.flags & ~(PTP_ENABLE_FEATURE | + PTP_RISING_EDGE | + PTP_FALLING_EDGE)) + return -EOPNOTSUPP; index = rq->extts.index; if (index >= N_EXT_TS) return -EINVAL;