lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201117193124.9789-3-ceggers@arri.de>
Date:   Tue, 17 Nov 2020 20:31:23 +0100
From:   Christian Eggers <ceggers@...i.de>
To:     Richard Cochran <richardcochran@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Jakub Kicinski <kuba@...nel.org>
CC:     Vladimir Oltean <olteanv@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S . Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, Christian Eggers <ceggers@...i.de>,
        "Ioana Ciornei" <ioana.ciornei@....com>,
        Ioana Radulescu <ruxandra.radulescu@....com>,
        Yangbo Lu <yangbo.lu@....com>
Subject: [PATCH net-next 3/4] dpaa2-eth: use enum ptp_msg_type

Use new return type of ptp_get_msgtype(). Remove usage of magic numbers.

Signed-off-by: Christian Eggers <ceggers@...i.de>
Cc: Ioana Ciornei <ioana.ciornei@....com>
Cc: Ioana Radulescu <ruxandra.radulescu@....com>
Cc: Yangbo Lu <yangbo.lu@....com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index cf9400a9886d..7e6084124f8f 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -617,7 +617,7 @@ static int dpaa2_eth_consume_frames(struct dpaa2_eth_channel *ch,
 }
 
 static int dpaa2_eth_ptp_parse(struct sk_buff *skb,
-			       u8 *msgtype, u8 *twostep, u8 *udp,
+			       enum ptp_msg_type *msgtype, u8 *twostep, u8 *udp,
 			       u16 *correction_offset,
 			       u16 *origintimestamp_offset)
 {
@@ -659,7 +659,7 @@ static void dpaa2_eth_enable_tx_tstamp(struct dpaa2_eth_priv *priv,
 {
 	struct ptp_tstamp origin_timestamp;
 	struct dpni_single_step_cfg cfg;
-	u8 msgtype, twostep, udp;
+	u8 twostep, udp;
 	struct dpaa2_faead *faead;
 	struct dpaa2_fas *fas;
 	struct timespec64 ts;
@@ -684,9 +684,11 @@ static void dpaa2_eth_enable_tx_tstamp(struct dpaa2_eth_priv *priv,
 	faead->ctrl = cpu_to_le32(ctrl);
 
 	if (skb->cb[0] == TX_TSTAMP_ONESTEP_SYNC) {
+		enum ptp_msg_type msgtype;
+
 		if (dpaa2_eth_ptp_parse(skb, &msgtype, &twostep, &udp,
 					&offset1, &offset2) ||
-		    msgtype != 0 || twostep) {
+		    msgtype != PTP_MSGTYPE_SYNC || twostep) {
 			WARN_ONCE(1, "Bad packet for one-step timestamping\n");
 			return;
 		}
@@ -1195,7 +1197,7 @@ static void dpaa2_eth_tx_onestep_tstamp(struct work_struct *work)
 static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
 {
 	struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
-	u8 msgtype, twostep, udp;
+	u8 twostep, udp;
 	u16 offset1, offset2;
 
 	/* Utilize skb->cb[0] for timestamping request per skb */
@@ -1210,9 +1212,11 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
 
 	/* TX for one-step timestamping PTP Sync packet */
 	if (skb->cb[0] == TX_TSTAMP_ONESTEP_SYNC) {
+		enum ptp_msg_type msgtype;
+
 		if (!dpaa2_eth_ptp_parse(skb, &msgtype, &twostep, &udp,
 					 &offset1, &offset2))
-			if (msgtype == 0 && twostep == 0) {
+			if (msgtype == PTP_MSGTYPE_SYNC && twostep == 0) {
 				skb_queue_tail(&priv->tx_skbs, skb);
 				queue_work(priv->dpaa2_ptp_wq,
 					   &priv->tx_onestep_tstamp);
-- 
Christian Eggers
Embedded software developer

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRA 57918
Persoenlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRB 54477
Geschaeftsfuehrer: Dr. Michael Neuhaeuser; Stephan Schenk; Walter Trauninger; Markus Zeiler

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ