From patchwork Wed May 29 14:00:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13678948 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44DD623BB for ; Wed, 29 May 2024 14:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991205; cv=none; b=EAzIZ61XKEkUILSRUNF2we7dVJXSAKPbiv1Os29XIHYJOsxCK06h5c0pACQWlEOXbS0vxC1r5LtDBi6+7V13HN1FTmE0PNZvZVr9rvznIEDvWYvLwRknlxecAj7/DzZaQ63uGq+54TQgQWvTYfMCR7QmtU9uzgks0bL49/FMqv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991205; c=relaxed/simple; bh=82nnaiTy6vzREqI/HeSMB0nPU/2pbuRk8+SJR/Wb9Jo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZKa8WNSn0VgWfBrPpbdpeaIfAlYEYLUgRq613yrQQ8e/9sMgfl+ehr8kVObVsyytjE9E2HgPfQwaCkOG3WVcEYPHg6ikTMdQxH2fITkAAxiJadPhAIhNOXtjjcyUoELjF1kLrWzMeUIXXfNMmpSO49Jw23ZnPhKXfE8oI8koqrs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QoLLUejR; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QoLLUejR" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2e9819a630fso3574071fa.1 for ; Wed, 29 May 2024 07:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716991202; x=1717596002; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=o8kdgVEjSN4FwKB4P9Jpg25FpePknMR4GcGvYFe02oE=; b=QoLLUejRSz1h0VJ2rOkenOhnw4wJQx52fEQ6wmxgjzHPf9v4BRpxKUexw2XlX+t+03 s8rw4EiecK/rEf6+Vcoe2/SpU2RacVaR7MYnLDqanPge8s0UsVh0cgAtrkqXWXi5uikj T6VnGueDPBx6mEZ0iXU/4sy7xFiYoHrjlhHSiLJshhvWEiOACX0wzcvrwPYiEAugWFr+ mRXRB3B6Ve/in0Z+tFxeP2RZkBpQ7X8AY0rJsugg/6PV1Qwa3i0NwqK0vkQav23caR3V uf345VT0SEDSXOdvvzVy33nN51PS1NZg7Q4UOanh0KCZjv7XlbbRsEB4FI2ID9G7DNjb cGVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716991202; x=1717596002; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o8kdgVEjSN4FwKB4P9Jpg25FpePknMR4GcGvYFe02oE=; b=QMN+KCnXI2Aj+iE6HxmjZ92BXcX9td7axlYShjMAlMvDJt6B4C+xa4rTIc7h5dNSv6 RSI9MCVD1DqXUX/8StoGP9onXZENgZ1ojhuG9OoLO/rN6BgpRuLL52bbPM1dwMhYvda+ 9Kg84ykKccRcr65Wi5ditCJgK1Qdq6wHmOPIi+wntdEC7awVSFubDTFGipDewq+iYW3s bAn7JEoClTVH1iBIUvqY/1JR+VOuo//SG6rQ7P4wSBKYUPyjXblHzI2WQ1VMjR4bpzsR ka8e8WxzfB+FdqNP6SUbxOEi/FYrrsh1NXjNB0L4hXGii+isk053SCBZNmsdgM1YpVwT +bYg== X-Gm-Message-State: AOJu0YySdQ3EbPSZjbz+X4tV31b2trUfJBXxiXj52QUjhRm3Htg/qQ8y 2dimQ+OiftlWtE1PDIzn44C2hRXkIqFf9sc2pu7EwTdwAZAqJRxwH9xQQoXqqXM= X-Google-Smtp-Source: AGHT+IHL0+n/zvfAsDqqiAplm1VMN9BCq7MFYoOHLMf5PaPF2ZTH78noqF30/pFsNu25fs3oa1t9dQ== X-Received: by 2002:a2e:9810:0:b0:2ea:7d9f:8f62 with SMTP id 38308e7fff4ca-2ea7d9f917bmr14498251fa.10.1716991202452; Wed, 29 May 2024 07:00:02 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2e95bcc47bfsm25472551fa.20.2024.05.29.07.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 07:00:01 -0700 (PDT) From: Linus Walleij Date: Wed, 29 May 2024 16:00:00 +0200 Subject: [PATCH net-next v4 1/3] net: ethernet: cortina: Rename adjust link callback Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240529-gemini-phylib-fixes-v4-1-16487ca4c2fe@linaro.org> References: <20240529-gemini-phylib-fixes-v4-0-16487ca4c2fe@linaro.org> In-Reply-To: <20240529-gemini-phylib-fixes-v4-0-16487ca4c2fe@linaro.org> To: Hans Ulli Kroll , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn Cc: netdev@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 X-Patchwork-Delegate: kuba@kernel.org The callback passed to of_phy_get_and_connect() in the Cortina Gemini driver is called "gmac_speed_set" which is archaic, rename it to "gmac_adjust_link" following the pattern of most other drivers. Reviewed-by: Andrew Lunn Signed-off-by: Linus Walleij --- drivers/net/ethernet/cortina/gemini.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 5f0c9e1771db..ff3aeee15e5b 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -287,7 +287,7 @@ static void gmac_set_flow_control(struct net_device *netdev, bool tx, bool rx) spin_unlock_irqrestore(&port->config_lock, flags); } -static void gmac_speed_set(struct net_device *netdev) +static void gmac_adjust_link(struct net_device *netdev) { struct gemini_ethernet_port *port = netdev_priv(netdev); struct phy_device *phydev = netdev->phydev; @@ -366,7 +366,7 @@ static int gmac_setup_phy(struct net_device *netdev) phy = of_phy_get_and_connect(netdev, dev->of_node, - gmac_speed_set); + gmac_adjust_link); if (!phy) return -ENODEV; netdev->phydev = phy; From patchwork Wed May 29 14:00:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13678950 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CFFD12B95 for ; Wed, 29 May 2024 14:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991206; cv=none; b=RK1mq3+J6F7AvheBmjtwYgjhOlwXlbMKvDTNHUJIyt42KVgGBbpAhtsDI6VRpQGYzKzMYg2kYbmfi8ZLqHyrPHnizEwmoCagcx5/2R8T9XfhG/bAeOREuZ3Eed2MMDizbnbmIlAp/gzlLhL4yiCp8G9SdLNMe6N1cpu9cSkRhpQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991206; c=relaxed/simple; bh=CoBusJQazCOIEoGV+WMRvkw97W0ipsCQHXYjmrSMWjw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uEggf/JZDN8EnBmhYXCVFTISLCulgO5WhqqHO8LL0v7qAOMBIgU2uGueC4lmIb3e2yOKdPnTPXoFOgqD9ggtVvLwOvY4Fw/Uqyfqs2RGd9m/C1Ls6SMNSmJ1itqy6LO8ixYouvzJcJAG/gHx/cZK1CQNHjAd5ndd3qNEarUby8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OBOCD3Q3; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OBOCD3Q3" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2e3efa18e6aso9718621fa.0 for ; Wed, 29 May 2024 07:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716991203; x=1717596003; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uN7/h6kTo2XnMU/9NM8PFU9mkK1bfHP+69ug5lQnxeo=; b=OBOCD3Q3Ge1juDNfoSFmGK4xNdmj/+LUkYnTf57cPfFHqtSpG9YYobBhyKARDgMoER U7f1JRn3DSEpRekudcVcFfDuoDWi2hulR2zKEKHU20iqKnWK/ouamUv/a+0gXOjxB+N/ IhMJsvVgwJYauR0ul6D2MK1/GeOAGkglH4oaYNg9IdI/ehamXvZUJIzsUFAukyP95Wnm eWcj2T6R0ssXQ9M7QXlQhZyQBnFBMbMgG04/shJKlYftOfGtuxf02Z6oQlNqpVT6LczG pszt86MELsQpmN5rij/ydIrlUnZnhcOrFhB/6bEocEm5C3vxWyGGgejPcC71MfNo45sA OWsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716991203; x=1717596003; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uN7/h6kTo2XnMU/9NM8PFU9mkK1bfHP+69ug5lQnxeo=; b=i++GbHHa2Vuttaw76hqbBeqTy2WZ2q46OduMCE4pj0Nh/AZdYOTqQkuJKHhM3EMQ7s ituzGFa+106C/+9UJhffInLklFiMnm0lu6blHTAXApmlyynaP7ZMlFmw83md7MfHzCq1 eg9j1F0okCG87IWYHkGx8IueNKMz09Co1PKfoub36TKuauT/Xsfjg2euUhs1CDE5o55U HI6PbXI4hjdrHEpDJbYZAmjqu+vRVPn8T2hwLTP8n7Q0/PES2AyMqyXZ5xcRQZ1+/qT6 L79OezF+FbtD2jfgzZoourLoszUnn16iYgnl6eZySYmimceVTZeyd6cm2KqQZJF1yy0O EIPA== X-Gm-Message-State: AOJu0YybXfbSWZ7eBAEzpDzeXOArJhgM3vZJe8T+SnraAWjFZk5cFkth pxuhTk9Pha3tNwWB2q0TDHFn0ltSOPrlUFE2vGmaZcLQF36EMko2oTrshB19y5Y= X-Google-Smtp-Source: AGHT+IF5B2aYwHaoUG9A7wqPZZKFdHmfsG1ZG1/BGCj+rBRr8xBmSrqM2GBUlrQd1YIWaS9f+jQFEw== X-Received: by 2002:a05:651c:3c3:b0:2dc:f188:9945 with SMTP id 38308e7fff4ca-2ea4c8fdba5mr5386311fa.25.1716991203408; Wed, 29 May 2024 07:00:03 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2e95bcc47bfsm25472551fa.20.2024.05.29.07.00.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 07:00:02 -0700 (PDT) From: Linus Walleij Date: Wed, 29 May 2024 16:00:01 +0200 Subject: [PATCH net-next v4 2/3] net: ethernet: cortina: Use negotiated TX/RX pause Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240529-gemini-phylib-fixes-v4-2-16487ca4c2fe@linaro.org> References: <20240529-gemini-phylib-fixes-v4-0-16487ca4c2fe@linaro.org> In-Reply-To: <20240529-gemini-phylib-fixes-v4-0-16487ca4c2fe@linaro.org> To: Hans Ulli Kroll , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn Cc: netdev@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 X-Patchwork-Delegate: kuba@kernel.org Instead of directly poking into registers of the PHY, use the existing function to query phylib about this directly. Suggested-by: Andrew Lunn Reviewed-by: Andrew Lunn Signed-off-by: Linus Walleij --- drivers/net/ethernet/cortina/gemini.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index ff3aeee15e5b..b33f9798471e 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -292,8 +292,8 @@ static void gmac_adjust_link(struct net_device *netdev) struct gemini_ethernet_port *port = netdev_priv(netdev); struct phy_device *phydev = netdev->phydev; union gmac_status status, old_status; - int pause_tx = 0; - int pause_rx = 0; + bool pause_tx = false; + bool pause_rx = false; status.bits32 = readl(port->gmac_base + GMAC_STATUS); old_status.bits32 = status.bits32; @@ -328,14 +328,9 @@ static void gmac_adjust_link(struct net_device *netdev) } if (phydev->duplex == DUPLEX_FULL) { - u16 lcladv = phy_read(phydev, MII_ADVERTISE); - u16 rmtadv = phy_read(phydev, MII_LPA); - u8 cap = mii_resolve_flowctrl_fdx(lcladv, rmtadv); - - if (cap & FLOW_CTRL_RX) - pause_rx = 1; - if (cap & FLOW_CTRL_TX) - pause_tx = 1; + phy_get_pause(phydev, &pause_tx, &pause_rx); + netdev_dbg(netdev, "set negotiated pause params pause TX = %s, pause RX = %s\n", + pause_tx ? "ON" : "OFF", pause_rx ? "ON" : "OFF"); } gmac_set_flow_control(netdev, pause_tx, pause_rx); From patchwork Wed May 29 14:00:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13678951 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58F521C2AF for ; Wed, 29 May 2024 14:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991208; cv=none; b=V2U14ryTgxBsElcO9LezCZGcM2v9QwMot8jQn/ZwKitBT0SN/XsLYJKTwfZhd8bNG38I/ibhoBomUnk1nYfeDV2qvClVHzJiK9QY2unmiRI49We7x4E6AOY+iRppDpkBwrWj/VRz6tiT27HFOJnSE5sIZxYaTx5A9i5HAxn3seQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991208; c=relaxed/simple; bh=TJPbq5B5PYjU4jcKUJT1hZOXh+OR/yO3wdqOI3U1t/s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z7FL6TfMh2rACb2p6p2/nj1skGC4ggqWoNZ3bx2JzlyPmcHJl3+uf2IcPqF/rBjuoGUZFVOJTYwb3S2et8CHnoT+TLqZRBdtkMPNAjGY0I15X0zhAM1wuzcEsUOi3Dx5tmuhi5eG7epqKTS9UV/7nSoXupxawudIrS+AKIbV7wU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pSfkrGDm; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pSfkrGDm" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2e974857588so21995601fa.3 for ; Wed, 29 May 2024 07:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716991204; x=1717596004; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BnVXJx+XKagAI+2d0mf3dDbP/l7i5ROp1lXxEdfr9iU=; b=pSfkrGDmQN+wLD8XV6rTahFNzcL227gBbi1oICe6Zgriq6GzoH1etEScz0Tle5/2gZ IQsaOmKuqOBmmbtKd20u7pDWtAe+KupxWtk/Vc0ABCyhe0AfaKBxsBzwajjmNwsYjXW/ 3yyHl8NMzU61OTsPWTFwXg2JYicrOu+Xj1G8Ae4D0L3azLRE3QEJFZWlJB2EFfKwBumJ 10XKC7TwgM1a02xbAasVD6Tr6qCQF9QS06iAoEoZmt0eiD7fPQkst+f1pr5o1CANsO0a mEDiMZvDM8vU8vgUmUq5SI3GngVAQ2lAR38PuKn1uW1D0JE/19+qa8wjRBpqs2iV7hWZ l1kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716991204; x=1717596004; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BnVXJx+XKagAI+2d0mf3dDbP/l7i5ROp1lXxEdfr9iU=; b=v4MxFVq0o7FRfr1A1bjOKKU5NAPMMGIzxP7ASEk3/QQCoxve3TyZ8RpYMkPZNKaETy LfPOBHY23M/KYqMZpVgvDAtdN3KwzTW7N9vSzSjisLOCGaqPjAZQ5TT3iOv8Dp1UhUZ0 db3dyyabPH9sswaBKe/RkBASqd8HG0Wm8z3iA9+yO1L1qUrSjnOzP1rEQ/sPQI5fJJVX fwDStWCoG6KWvnknQSRf0f4hT1cyluXcP2d08ifIsOquLGnHR6cnsNY4nCEY1tHRTDXs uVKSFyukveWlZsro7fc/4uAY8bwsLzswc5QJEsj4Ab7YeKnZRWEC8mDx4ZqgprYeTBWv LZhQ== X-Gm-Message-State: AOJu0YzfCge32FkAxn26/2S95CVPMwNFTfPtEDq6jp8QtzOH7tLYsllB 56JIzzHu4KERMWF9yl9jFXw8XXJ6tZWOVo5GbAcgDrtVD0t7jkcI+KE4Qew4tr0= X-Google-Smtp-Source: AGHT+IFd/62Te6X6COZOHKjKdhsA9gM4v7qxHasEOJNOk6Yk7jejeBI8TPABcwrxhuo9A3Uu1JBV6w== X-Received: by 2002:a2e:a170:0:b0:2ea:2b91:4f6c with SMTP id 38308e7fff4ca-2ea2b915150mr13454481fa.4.1716991204649; Wed, 29 May 2024 07:00:04 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2e95bcc47bfsm25472551fa.20.2024.05.29.07.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 07:00:03 -0700 (PDT) From: Linus Walleij Date: Wed, 29 May 2024 16:00:02 +0200 Subject: [PATCH net-next v4 3/3] net: ethernet: cortina: Implement .set_pauseparam() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240529-gemini-phylib-fixes-v4-3-16487ca4c2fe@linaro.org> References: <20240529-gemini-phylib-fixes-v4-0-16487ca4c2fe@linaro.org> In-Reply-To: <20240529-gemini-phylib-fixes-v4-0-16487ca4c2fe@linaro.org> To: Hans Ulli Kroll , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn Cc: netdev@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 X-Patchwork-Delegate: kuba@kernel.org The Cortina Gemini ethernet can very well set up TX or RX pausing, so add this functionality to the driver in a .set_pauseparam() callback. Essentially just call down to phylib and let phylib deal with this, .adjust_link() will respect the setting from phylib. Signed-off-by: Linus Walleij Reviewed-by: Andrew Lunn --- drivers/net/ethernet/cortina/gemini.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index b33f9798471e..318c521b135b 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -2111,6 +2111,19 @@ static void gmac_get_pauseparam(struct net_device *netdev, pparam->autoneg = true; } +static int gmac_set_pauseparam(struct net_device *netdev, + struct ethtool_pauseparam *pparam) +{ + struct phy_device *phydev = netdev->phydev; + + if (!pparam->autoneg) + return -EOPNOTSUPP; + + phy_set_asym_pause(phydev, pparam->rx_pause, pparam->tx_pause); + + return 0; +} + static void gmac_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *rp, struct kernel_ethtool_ringparam *kernel_rp, @@ -2231,6 +2244,7 @@ static const struct ethtool_ops gmac_351x_ethtool_ops = { .set_link_ksettings = gmac_set_ksettings, .nway_reset = gmac_nway_reset, .get_pauseparam = gmac_get_pauseparam, + .set_pauseparam = gmac_set_pauseparam, .get_ringparam = gmac_get_ringparam, .set_ringparam = gmac_set_ringparam, .get_coalesce = gmac_get_coalesce,