netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/8] net: atlantic: various non-functional changes
@ 2020-06-26 18:40 Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 1/8] net: atlantic: MACSec offload statistics checkpatch fix Igor Russkikh
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Igor Russkikh

This patchset contains several non-functional changes, which were made in
out of tree driver over the time.
Mostly typos, checkpatch findings and comment fixes.

Dmitry Bezrukov (1):
  net: atlantic: missing space in a comment in aq_nic.h

Igor Russkikh (1):
  net: atlantic: put ptp code under IS_REACHABLE check

Mark Starovoytov (5):
  net: atlantic: MACSec offload statistics checkpatch fix
  net: atlantic: Replace ENOTSUPP usage to EOPNOTSUPP
  net: atlantic: make aq_pci_func_init static
  net: atlantic: fix typo in aq_ring_tx_clean
  net: atlantic: add alignment checks in hw_atl2_utils_fw.c

Nikita Danilov (1):
  net: atlantic: fix variable type in aq_ethtool_get_pauseparam

 .../ethernet/aquantia/atlantic/aq_ethtool.c   | 11 ++++---
 .../net/ethernet/aquantia/atlantic/aq_main.c  | 20 +++++++++---
 .../net/ethernet/aquantia/atlantic/aq_nic.c   |  2 +-
 .../net/ethernet/aquantia/atlantic/aq_nic.h   |  9 +++---
 .../ethernet/aquantia/atlantic/aq_pci_func.c  |  9 +++---
 .../ethernet/aquantia/atlantic/aq_pci_func.h  |  8 ++---
 .../net/ethernet/aquantia/atlantic/aq_ptp.c   |  9 ++++--
 .../net/ethernet/aquantia/atlantic/aq_ring.c  | 11 ++++---
 .../aquantia/atlantic/hw_atl/hw_atl_utils.c   |  2 +-
 .../atlantic/hw_atl2/hw_atl2_utils_fw.c       | 32 ++++++++++++++++---
 10 files changed, 80 insertions(+), 33 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net-next 1/8] net: atlantic: MACSec offload statistics checkpatch fix
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
@ 2020-06-26 18:40 ` Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 2/8] net: atlantic: fix variable type in aq_ethtool_get_pauseparam Igor Russkikh
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Igor Russkikh

From: Mark Starovoytov <mstarovoitov@marvell.com>

This patch fixes a checkpatch warning.

Fixes: aec0f1aac58e ("net: atlantic: MACSec offload statistics implementation")

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
index e53ba7bfaf61..f352b206b5cf 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
@@ -124,21 +124,21 @@ static const char aq_macsec_stat_names[][ETH_GSTRING_LEN] = {
 	"MACSec OutUnctrlHitDropRedir",
 };
 
-static const char *aq_macsec_txsc_stat_names[] = {
+static const char * const aq_macsec_txsc_stat_names[] = {
 	"MACSecTXSC%d ProtectedPkts",
 	"MACSecTXSC%d EncryptedPkts",
 	"MACSecTXSC%d ProtectedOctets",
 	"MACSecTXSC%d EncryptedOctets",
 };
 
-static const char *aq_macsec_txsa_stat_names[] = {
+static const char * const aq_macsec_txsa_stat_names[] = {
 	"MACSecTXSC%dSA%d HitDropRedirect",
 	"MACSecTXSC%dSA%d Protected2Pkts",
 	"MACSecTXSC%dSA%d ProtectedPkts",
 	"MACSecTXSC%dSA%d EncryptedPkts",
 };
 
-static const char *aq_macsec_rxsa_stat_names[] = {
+static const char * const aq_macsec_rxsa_stat_names[] = {
 	"MACSecRXSC%dSA%d UntaggedHitPkts",
 	"MACSecRXSC%dSA%d CtrlHitDrpRedir",
 	"MACSecRXSC%dSA%d NotUsingSa",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 2/8] net: atlantic: fix variable type in aq_ethtool_get_pauseparam
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 1/8] net: atlantic: MACSec offload statistics checkpatch fix Igor Russkikh
@ 2020-06-26 18:40 ` Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 3/8] net: atlantic: Replace ENOTSUPP usage to EOPNOTSUPP Igor Russkikh
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Nikita Danilov, Igor Russkikh

From: Nikita Danilov <ndanilov@marvell.com>

This patch fixes the type for variable which is assigned from enum,
as such it should have been int, not u32.

Signed-off-by: Nikita Danilov <ndanilov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
index f352b206b5cf..51dfc12a44be 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
@@ -716,13 +716,12 @@ static void aq_ethtool_get_pauseparam(struct net_device *ndev,
 				      struct ethtool_pauseparam *pause)
 {
 	struct aq_nic_s *aq_nic = netdev_priv(ndev);
-	u32 fc = aq_nic->aq_nic_cfg.fc.req;
+	int fc = aq_nic->aq_nic_cfg.fc.req;
 
 	pause->autoneg = 0;
 
 	pause->rx_pause = !!(fc & AQ_NIC_FC_RX);
 	pause->tx_pause = !!(fc & AQ_NIC_FC_TX);
-
 }
 
 static int aq_ethtool_set_pauseparam(struct net_device *ndev,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 3/8] net: atlantic: Replace ENOTSUPP usage to EOPNOTSUPP
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 1/8] net: atlantic: MACSec offload statistics checkpatch fix Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 2/8] net: atlantic: fix variable type in aq_ethtool_get_pauseparam Igor Russkikh
@ 2020-06-26 18:40 ` Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 4/8] net: atlantic: make aq_pci_func_init static Igor Russkikh
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Igor Russkikh

From: Mark Starovoytov <mstarovoitov@marvell.com>

This patch replaces ENOTSUPP (where it was used by mistake) with
EOPNOTSUPP.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c              | 2 +-
 drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 647b22d89b1a..43b8914c3ef5 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -1188,7 +1188,7 @@ int aq_nic_set_loopback(struct aq_nic_s *self)
 
 	if (!self->aq_hw_ops->hw_set_loopback ||
 	    !self->aq_fw_ops->set_phyloopback)
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	mutex_lock(&self->fwreq_mutex);
 	self->aq_hw_ops->hw_set_loopback(self->aq_hw,
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 1d9dee4951f9..bf4c41cc312b 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -217,7 +217,7 @@ static int hw_atl_utils_soft_reset_rbl(struct aq_hw_s *self)
 
 	if (rbl_status == 0xF1A7) {
 		aq_pr_err("No FW detected. Dynamic FW load not implemented\n");
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
 	for (k = 0; k < 1000; k++) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 4/8] net: atlantic: make aq_pci_func_init static
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
                   ` (2 preceding siblings ...)
  2020-06-26 18:40 ` [PATCH net-next 3/8] net: atlantic: Replace ENOTSUPP usage to EOPNOTSUPP Igor Russkikh
@ 2020-06-26 18:40 ` Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 5/8] net: atlantic: fix typo in aq_ring_tx_clean Igor Russkikh
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Igor Russkikh

From: Mark Starovoytov <mstarovoitov@marvell.com>

This patch makes aq_pci_func_init() static, because it's not used anywhere
outside the file itself.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 9 +++++----
 drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h | 8 ++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
index 41c0f560f95b..59253846e885 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
@@ -1,7 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/*
- * aQuantia Corporation Network Driver
- * Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
+/* Atlantic Network Driver
+ *
+ * Copyright (C) 2014-2019 aQuantia Corporation
+ * Copyright (C) 2019-2020 Marvell International Ltd.
  */
 
 /* File aq_pci_func.c: Definition of PCI functions. */
@@ -114,7 +115,7 @@ static int aq_pci_probe_get_hw_by_id(struct pci_dev *pdev,
 	return 0;
 }
 
-int aq_pci_func_init(struct pci_dev *pdev)
+static int aq_pci_func_init(struct pci_dev *pdev)
 {
 	int err;
 
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h
index 77be7ee0d7b3..3fa5f7a73680 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h
@@ -1,7 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * aQuantia Corporation Network Driver
- * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
+/* Atlantic Network Driver
+ *
+ * Copyright (C) 2014-2019 aQuantia Corporation
+ * Copyright (C) 2019-2020 Marvell International Ltd.
  */
 
 /* File aq_pci_func.h: Declaration of PCI functions. */
@@ -19,7 +20,6 @@ struct aq_board_revision_s {
 	const struct aq_hw_caps_s *caps;
 };
 
-int aq_pci_func_init(struct pci_dev *pdev);
 int aq_pci_func_alloc_irq(struct aq_nic_s *self, unsigned int i,
 			  char *name, irq_handler_t irq_handler,
 			  void *irq_arg, cpumask_t *affinity_mask);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 5/8] net: atlantic: fix typo in aq_ring_tx_clean
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
                   ` (3 preceding siblings ...)
  2020-06-26 18:40 ` [PATCH net-next 4/8] net: atlantic: make aq_pci_func_init static Igor Russkikh
@ 2020-06-26 18:40 ` Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 6/8] net: atlantic: missing space in a comment in aq_nic.h Igor Russkikh
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Igor Russkikh

From: Mark Starovoytov <mstarovoitov@marvell.com>

This patch fixes a typo in aq_ring_tx_clean.
stats is a union, so the typo doesn't cause any issues, but it's a typo
nonetheless.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
index 68fdb3994088..b67b24a0d9a6 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
@@ -1,7 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/*
- * aQuantia Corporation Network Driver
- * Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
+/* Atlantic Network Driver
+ *
+ * Copyright (C) 2014-2019 aQuantia Corporation
+ * Copyright (C) 2019-2020 Marvell International Ltd.
  */
 
 /* File aq_ring.c: Definition of functions for Rx/Tx rings. */
@@ -279,7 +280,7 @@ bool aq_ring_tx_clean(struct aq_ring_s *self)
 		}
 
 		if (unlikely(buff->is_eop)) {
-			++self->stats.rx.packets;
+			++self->stats.tx.packets;
 			self->stats.tx.bytes += buff->skb->len;
 
 			dev_kfree_skb_any(buff->skb);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 6/8] net: atlantic: missing space in a comment in aq_nic.h
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
                   ` (4 preceding siblings ...)
  2020-06-26 18:40 ` [PATCH net-next 5/8] net: atlantic: fix typo in aq_ring_tx_clean Igor Russkikh
@ 2020-06-26 18:40 ` Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 7/8] net: atlantic: add alignment checks in hw_atl2_utils_fw.c Igor Russkikh
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Dmitry Bezrukov, Igor Russkikh

From: Dmitry Bezrukov <dbezrukov@marvell.com>

This patch add a missing space in the comment in aq_nic.h

Signed-off-by: Dmitry Bezrukov <dbezrukov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
index 2ab003065e62..317bfc646f0a 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
@@ -1,7 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * aQuantia Corporation Network Driver
- * Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
+/* Atlantic Network Driver
+ *
+ * Copyright (C) 2014-2019 aQuantia Corporation
+ * Copyright (C) 2019-2020 Marvell International Ltd.
  */
 
 /* File aq_nic.h: Declaration of common code for NIC. */
@@ -111,7 +112,7 @@ struct aq_hw_rx_fltrs_s {
 	u16                   active_filters;
 	struct aq_hw_rx_fl2   fl2;
 	struct aq_hw_rx_fl3l4 fl3l4;
-	/*filter ether type */
+	/* filter ether type */
 	u8 fet_reserved_count;
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 7/8] net: atlantic: add alignment checks in hw_atl2_utils_fw.c
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
                   ` (5 preceding siblings ...)
  2020-06-26 18:40 ` [PATCH net-next 6/8] net: atlantic: missing space in a comment in aq_nic.h Igor Russkikh
@ 2020-06-26 18:40 ` Igor Russkikh
  2020-06-26 18:40 ` [PATCH net-next 8/8] net: atlantic: put ptp code under IS_REACHABLE check Igor Russkikh
  2020-06-26 23:33 ` [PATCH net-next 0/8] net: atlantic: various non-functional changes David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Igor Russkikh

From: Mark Starovoytov <mstarovoitov@marvell.com>

This patch adds alignment checks in all the helper macros in
hw_atl2_utils_fw.c
These alignment checks are compile-time, so runtime is not affected.

All these helper macros assume the length to be aligned (multiple of 4).
If it's not aligned, then there might be issues, e.g. stack corruption.

Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 .../atlantic/hw_atl2/hw_atl2_utils_fw.c       | 32 ++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
index 3a9352190816..a8ce9a2c1c51 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
@@ -16,15 +16,29 @@
 #define AQ_A2_FW_READ_TRY_MAX 1000
 
 #define hw_atl2_shared_buffer_write(HW, ITEM, VARIABLE) \
+{\
+	BUILD_BUG_ON_MSG((offsetof(struct fw_interface_in, ITEM) % \
+			 sizeof(u32)) != 0,\
+			 "Unaligned write " # ITEM);\
+	BUILD_BUG_ON_MSG((sizeof(VARIABLE) %  sizeof(u32)) != 0,\
+			 "Unaligned write length " # ITEM);\
 	hw_atl2_mif_shared_buf_write(HW,\
 		(offsetof(struct fw_interface_in, ITEM) / sizeof(u32)),\
-		(u32 *)&(VARIABLE), sizeof(VARIABLE) / sizeof(u32))
+		(u32 *)&(VARIABLE), sizeof(VARIABLE) / sizeof(u32));\
+}
 
 #define hw_atl2_shared_buffer_get(HW, ITEM, VARIABLE) \
+{\
+	BUILD_BUG_ON_MSG((offsetof(struct fw_interface_in, ITEM) % \
+			 sizeof(u32)) != 0,\
+			 "Unaligned get " # ITEM);\
+	BUILD_BUG_ON_MSG((sizeof(VARIABLE) %  sizeof(u32)) != 0,\
+			 "Unaligned get length " # ITEM);\
 	hw_atl2_mif_shared_buf_get(HW, \
 		(offsetof(struct fw_interface_in, ITEM) / sizeof(u32)),\
 		(u32 *)&(VARIABLE), \
-		sizeof(VARIABLE) / sizeof(u32))
+		sizeof(VARIABLE) / sizeof(u32));\
+}
 
 /* This should never be used on non atomic fields,
  * treat any > u32 read as non atomic.
@@ -33,7 +47,9 @@
 {\
 	BUILD_BUG_ON_MSG((offsetof(struct fw_interface_out, ITEM) % \
 			 sizeof(u32)) != 0,\
-			 "Non aligned read " # ITEM);\
+			 "Unaligned read " # ITEM);\
+	BUILD_BUG_ON_MSG((sizeof(VARIABLE) %  sizeof(u32)) != 0,\
+			 "Unaligned read length " # ITEM);\
 	BUILD_BUG_ON_MSG(sizeof(VARIABLE) > sizeof(u32),\
 			 "Non atomic read " # ITEM);\
 	hw_atl2_mif_shared_buf_read(HW, \
@@ -42,10 +58,18 @@
 }
 
 #define hw_atl2_shared_buffer_read_safe(HW, ITEM, DATA) \
+({\
+	BUILD_BUG_ON_MSG((offsetof(struct fw_interface_out, ITEM) % \
+			 sizeof(u32)) != 0,\
+			 "Unaligned read_safe " # ITEM);\
+	BUILD_BUG_ON_MSG((sizeof(((struct fw_interface_out *)0)->ITEM) % \
+			 sizeof(u32)) != 0,\
+			 "Unaligned read_safe length " # ITEM);\
 	hw_atl2_shared_buffer_read_block((HW), \
 		(offsetof(struct fw_interface_out, ITEM) / sizeof(u32)),\
 		sizeof(((struct fw_interface_out *)0)->ITEM) / sizeof(u32),\
-		(DATA))
+		(DATA));\
+})
 
 static int hw_atl2_shared_buffer_read_block(struct aq_hw_s *self,
 					    u32 offset, u32 dwords, void *data)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 8/8] net: atlantic: put ptp code under IS_REACHABLE check
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
                   ` (6 preceding siblings ...)
  2020-06-26 18:40 ` [PATCH net-next 7/8] net: atlantic: add alignment checks in hw_atl2_utils_fw.c Igor Russkikh
@ 2020-06-26 18:40 ` Igor Russkikh
  2020-06-26 23:33 ` [PATCH net-next 0/8] net: atlantic: various non-functional changes David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: Igor Russkikh @ 2020-06-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Starovoytov, Igor Russkikh

A1 requires additional processing for both egress and ingress to support
PTP.
And it makes sense to get rid of this processing altogether (via ifdef),
if PTP clock is disabled globally.

This patch puts the PTP code under the corresponding IS_REACHABLE check.

Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
---
 .../ethernet/aquantia/atlantic/aq_ethtool.c   |  2 ++
 .../net/ethernet/aquantia/atlantic/aq_main.c  | 20 +++++++++++++++----
 .../net/ethernet/aquantia/atlantic/aq_ptp.c   |  9 +++++++--
 .../net/ethernet/aquantia/atlantic/aq_ring.c  |  2 ++
 4 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
index 51dfc12a44be..a8f0fbbbd91a 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
@@ -607,7 +607,9 @@ static int aq_ethtool_get_ts_info(struct net_device *ndev,
 			    BIT(HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
 			    BIT(HWTSTAMP_FILTER_PTP_V2_EVENT);
 
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
 	info->phc_index = ptp_clock_index(aq_ptp_get_ptp_clock(aq_nic->aq_ptp));
+#endif
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
index 8a1da044e908..dfb29b933eb7 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
@@ -1,7 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/*
- * aQuantia Corporation Network Driver
- * Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
+/* Atlantic Network Driver
+ *
+ * Copyright (C) 2014-2019 aQuantia Corporation
+ * Copyright (C) 2019-2020 Marvell International Ltd.
  */
 
 /* File aq_main.c: Main file for aQuantia Linux driver. */
@@ -98,6 +99,7 @@ static int aq_ndev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
 	struct aq_nic_s *aq_nic = netdev_priv(ndev);
 
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
 	if (unlikely(aq_utils_obj_test(&aq_nic->flags, AQ_NIC_PTP_DPATH_UP))) {
 		/* Hardware adds the Timestamp for PTPv2 802.AS1
 		 * and PTPv2 IPv4 UDP.
@@ -114,6 +116,7 @@ static int aq_ndev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 		    unlikely(eth_hdr(skb)->h_proto == htons(ETH_P_1588)))
 			return aq_ptp_xmit(aq_nic, skb);
 	}
+#endif
 
 	skb_tx_timestamp(skb);
 	return aq_nic_xmit(aq_nic, skb);
@@ -222,6 +225,7 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev)
 	(void)aq_nic_set_multicast_list(aq_nic, ndev);
 }
 
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
 static int aq_ndev_config_hwtstamp(struct aq_nic_s *aq_nic,
 				   struct hwtstamp_config *config)
 {
@@ -256,26 +260,31 @@ static int aq_ndev_config_hwtstamp(struct aq_nic_s *aq_nic,
 
 	return aq_ptp_hwtstamp_config_set(aq_nic->aq_ptp, config);
 }
+#endif
 
 static int aq_ndev_hwtstamp_set(struct aq_nic_s *aq_nic, struct ifreq *ifr)
 {
 	struct hwtstamp_config config;
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
 	int ret_val;
+#endif
 
 	if (!aq_nic->aq_ptp)
 		return -EOPNOTSUPP;
 
 	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
 		return -EFAULT;
-
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
 	ret_val = aq_ndev_config_hwtstamp(aq_nic, &config);
 	if (ret_val)
 		return ret_val;
+#endif
 
 	return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
 	       -EFAULT : 0;
 }
 
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
 static int aq_ndev_hwtstamp_get(struct aq_nic_s *aq_nic, struct ifreq *ifr)
 {
 	struct hwtstamp_config config;
@@ -287,6 +296,7 @@ static int aq_ndev_hwtstamp_get(struct aq_nic_s *aq_nic, struct ifreq *ifr)
 	return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
 	       -EFAULT : 0;
 }
+#endif
 
 static int aq_ndev_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 {
@@ -296,8 +306,10 @@ static int aq_ndev_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 	case SIOCSHWTSTAMP:
 		return aq_ndev_hwtstamp_set(aq_nic, ifr);
 
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
 	case SIOCGHWTSTAMP:
 		return aq_ndev_hwtstamp_get(aq_nic, ifr);
+#endif
 	}
 
 	return -EOPNOTSUPP;
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
index 599ced261b2a..cb9bf41470fd 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/* Aquantia Corporation Network Driver
- * Copyright (C) 2014-2019 Aquantia Corporation. All rights reserved
+/* Atlantic Network Driver
+ *
+ * Copyright (C) 2014-2019 aQuantia Corporation
+ * Copyright (C) 2019-2020 Marvell International Ltd.
  */
 
 /* File aq_ptp.c:
@@ -18,6 +20,8 @@
 #include "aq_phy.h"
 #include "aq_filters.h"
 
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
+
 #define AQ_PTP_TX_TIMEOUT        (HZ *  10)
 
 #define POLL_SYNC_TIMER_MS 15
@@ -1389,3 +1393,4 @@ static void aq_ptp_poll_sync_work_cb(struct work_struct *w)
 		schedule_delayed_work(&aq_ptp->poll_sync, timeout);
 	}
 }
+#endif
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
index b67b24a0d9a6..8dd59e9fc3aa 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
@@ -490,6 +490,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
 
 void aq_ring_hwts_rx_clean(struct aq_ring_s *self, struct aq_nic_s *aq_nic)
 {
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
 	while (self->sw_head != self->hw_head) {
 		u64 ns;
 
@@ -501,6 +502,7 @@ void aq_ring_hwts_rx_clean(struct aq_ring_s *self, struct aq_nic_s *aq_nic)
 
 		self->sw_head = aq_ring_next_dx(self, self->sw_head);
 	}
+#endif
 }
 
 int aq_ring_rx_fill(struct aq_ring_s *self)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 0/8] net: atlantic: various non-functional changes
  2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
                   ` (7 preceding siblings ...)
  2020-06-26 18:40 ` [PATCH net-next 8/8] net: atlantic: put ptp code under IS_REACHABLE check Igor Russkikh
@ 2020-06-26 23:33 ` David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2020-06-26 23:33 UTC (permalink / raw)
  To: irusskikh; +Cc: netdev, mstarovoitov

From: Igor Russkikh <irusskikh@marvell.com>
Date: Fri, 26 Jun 2020 21:40:30 +0300

> This patchset contains several non-functional changes, which were made in
> out of tree driver over the time.
> Mostly typos, checkpatch findings and comment fixes.

Series applied, thank you.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-26 23:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 18:40 [PATCH net-next 0/8] net: atlantic: various non-functional changes Igor Russkikh
2020-06-26 18:40 ` [PATCH net-next 1/8] net: atlantic: MACSec offload statistics checkpatch fix Igor Russkikh
2020-06-26 18:40 ` [PATCH net-next 2/8] net: atlantic: fix variable type in aq_ethtool_get_pauseparam Igor Russkikh
2020-06-26 18:40 ` [PATCH net-next 3/8] net: atlantic: Replace ENOTSUPP usage to EOPNOTSUPP Igor Russkikh
2020-06-26 18:40 ` [PATCH net-next 4/8] net: atlantic: make aq_pci_func_init static Igor Russkikh
2020-06-26 18:40 ` [PATCH net-next 5/8] net: atlantic: fix typo in aq_ring_tx_clean Igor Russkikh
2020-06-26 18:40 ` [PATCH net-next 6/8] net: atlantic: missing space in a comment in aq_nic.h Igor Russkikh
2020-06-26 18:40 ` [PATCH net-next 7/8] net: atlantic: add alignment checks in hw_atl2_utils_fw.c Igor Russkikh
2020-06-26 18:40 ` [PATCH net-next 8/8] net: atlantic: put ptp code under IS_REACHABLE check Igor Russkikh
2020-06-26 23:33 ` [PATCH net-next 0/8] net: atlantic: various non-functional changes David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).