From patchwork Thu Nov 14 18:45:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 1195068 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="lzBnyKi+"; 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 47DVmJ4hZNz9sQw for ; Fri, 15 Nov 2019 05:45:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 32BB389C94; Thu, 14 Nov 2019 18:45:35 +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 abSIjIm8w8Ks; Thu, 14 Nov 2019 18:45:34 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 86EFC89CA1; Thu, 14 Nov 2019 18:45:34 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id ACB7D1BF289 for ; Thu, 14 Nov 2019 18:45:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A604D89C8C for ; Thu, 14 Nov 2019 18:45:27 +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 K0j-4TyuuJUB for ; Thu, 14 Nov 2019 18:45:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 32A6389C8B for ; Thu, 14 Nov 2019 18:45:27 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id k1so3027739pgg.12 for ; Thu, 14 Nov 2019 10:45:27 -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=FM3VhSbSiafPaH1zDTjChkDXYC3HNrrA8QbibO1hxSM=; b=lzBnyKi+bZrh9wnaaq2maczx3IdNblvCteLtfehTKx3USUsi/YgVJfiyYCoJ8FwIMx jOszlkQOPBv7oUwdNL8Ma5NbuZ+bjI3QDV6px/IrnsL5e6RCuFx3oOsdfp6j1U9CDcR8 h/YeE5zFtvUhJ0VEzErb5aB1q9OoT5cNtWfgII8Y9T8svrTQFXe986Y8VkFnSeALS4Yw lQ6mVbFnm0M0RAwSzmgpheESK+M5m3Umdj90RlC5g40WdFfY23+aM4LzX9upCNousnQB rqiVruVT2CFyYElyNfOqGEjgwV4L3MonyDqs6OSUpLd/Kc4UCnLlshKb05zqAVsUDILM ir/w== 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=FM3VhSbSiafPaH1zDTjChkDXYC3HNrrA8QbibO1hxSM=; b=Juwh7vgF+q8xlrBYKQP8WEhPATQoelUKd1yzdcVEoTKJFXCct9DDlOMnUpZrmSexWL FV4/hkM0JWDNbl90/V3jqVGC3JwICz78jBI1VRkY1nWSt4H34gRd6S0z4dvRmKNvmFGC IyKoTMy0xzjaa2tIWnZW2F1tM9OdHS6g7P02Q5oBb3Nv4Eh9TGhPFlgKhI7mKvdIXlNG ZyFleGWw+AYBG3BUZZTgOWj05qhdo+toJC47MFYGmdsaaCMoPiRttoKdnfyD+Pq3lTSd GXJ2xqci+sQTZSHFsvXSaNtp2X4SErtaRpNyu42oDRgPkUsVsAPTGUPTd/TNh25ktS7h +0Tw== X-Gm-Message-State: APjAAAXV27Zz1j7fAmzkTZAkapszXIVHdVU8/ez0amaI0ivP66mRtP24 1C4Nr/tl/ep50Xt6JUh0EtY= X-Google-Smtp-Source: APXvYqziilQvp1gfUwYWyoR6VkMNhcHXbr/HTWJJBPcj/7VRsUUQYaXZldCvOUmsEfrY2kMf0OUFnw== X-Received: by 2002:a17:90a:9dca:: with SMTP id x10mr13996788pjv.139.1573757126814; Thu, 14 Nov 2019 10:45:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 10:45:26 -0800 (PST) From: Richard Cochran To: netdev@vger.kernel.org Date: Thu, 14 Nov 2019 10:45:06 -0800 Message-Id: <20191114184507.18937-13-richardcochran@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH net 12/13] mlx5: Reject requests to enable time stamping on both edges. 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" This driver enables rising edge or falling edge, but not both, and so this patch validates that the request contains only one of the two edges. Signed-off-by: Richard Cochran Reviewed-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index 819097d9b583..43f97601b500 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -243,6 +243,12 @@ static int mlx5_extts_configure(struct ptp_clock_info *ptp, PTP_STRICT_FLAGS)) return -EOPNOTSUPP; + /* Reject requests to enable time stamping on both edges. */ + if ((rq->extts.flags & PTP_STRICT_FLAGS) && + (rq->extts.flags & PTP_ENABLE_FEATURE) && + (rq->extts.flags & PTP_EXTTS_EDGES) == PTP_EXTTS_EDGES) + return -EOPNOTSUPP; + if (rq->extts.index >= clock->ptp_info.n_pins) return -EINVAL;