netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: aquantia: ptp followup fixes
@ 2019-10-26 11:05 Igor Russkikh
  2019-10-26 11:05 ` [PATCH net-next 1/3] net: aquantia: fix var initialization warning Igor Russkikh
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Igor Russkikh @ 2019-10-26 11:05 UTC (permalink / raw)
  To: netdev@vger.kernel.org; +Cc: David S . Miller, Igor Russkikh

Hello David,

Here are two sparse warnings, third patch is a fix for
scaled_ppm_to_ppb missing. Eventually I reworked this
to exclude ptp module from build. Please consider it instead
of this patch: https://patchwork.ozlabs.org/patch/1184171/

Igor Russkikh (3):
  net: aquantia: fix var initialization warning
  net: aquantia: fix warnings on endianness
  net: aquantia: disable ptp object build if no config

 .../net/ethernet/aquantia/atlantic/Makefile   |  3 +-
 .../net/ethernet/aquantia/atlantic/aq_ptp.c   |  2 +-
 .../net/ethernet/aquantia/atlantic/aq_ptp.h   | 84 +++++++++++++++++++
 .../aquantia/atlantic/hw_atl/hw_atl_b0.c      |  9 +-
 .../aquantia/atlantic/hw_atl/hw_atl_utils.h   |  2 +-
 5 files changed, 92 insertions(+), 8 deletions(-)

-- 
2.17.1


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

* [PATCH net-next 1/3] net: aquantia: fix var initialization warning
  2019-10-26 11:05 [PATCH net-next 0/3] net: aquantia: ptp followup fixes Igor Russkikh
@ 2019-10-26 11:05 ` Igor Russkikh
  2019-10-26 11:05 ` [PATCH net-next 2/3] net: aquantia: fix warnings on endianness Igor Russkikh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Igor Russkikh @ 2019-10-26 11:05 UTC (permalink / raw)
  To: netdev@vger.kernel.org; +Cc: David S . Miller, Igor Russkikh

found by sparse, simply useless local initialization with zero.

Fixes: 94ad94558b0f ("net: aquantia: add PTP rings infrastructure")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
index 3ec08415e53e..bb6fbbadfd47 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
@@ -947,7 +947,7 @@ int aq_ptp_ring_alloc(struct aq_nic_s *aq_nic)
 {
 	struct aq_ptp_s *aq_ptp = aq_nic->aq_ptp;
 	unsigned int tx_ring_idx, rx_ring_idx;
-	struct aq_ring_s *hwts = 0;
+	struct aq_ring_s *hwts;
 	u32 tx_tc_mode, rx_tc_mode;
 	struct aq_ring_s *ring;
 	int err;
-- 
2.17.1


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

* [PATCH net-next 2/3] net: aquantia: fix warnings on endianness
  2019-10-26 11:05 [PATCH net-next 0/3] net: aquantia: ptp followup fixes Igor Russkikh
  2019-10-26 11:05 ` [PATCH net-next 1/3] net: aquantia: fix var initialization warning Igor Russkikh
@ 2019-10-26 11:05 ` Igor Russkikh
  2019-10-26 11:05 ` [PATCH net-next 3/3] net: aquantia: disable ptp object build if no config Igor Russkikh
  2019-10-26 18:28 ` [PATCH net-next 0/3] net: aquantia: ptp followup fixes David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: Igor Russkikh @ 2019-10-26 11:05 UTC (permalink / raw)
  To: netdev@vger.kernel.org; +Cc: David S . Miller, Igor Russkikh

fixes to remove sparse warnings:
sparse: sparse: cast to restricted __be64

Fixes: 04a1839950d9 ("net: aquantia: implement data PTP datapath")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 .../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c    | 9 ++++-----
 .../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index 51ecf87e0198..abee561ea54e 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -1236,9 +1236,9 @@ static u16 hw_atl_b0_rx_extract_ts(struct aq_hw_s *self, u8 *p,
 {
 	unsigned int offset = 14;
 	struct ethhdr *eth;
-	u64 sec;
+	__be64 sec;
+	__be32 ns;
 	u8 *ptr;
-	u32 ns;
 
 	if (len <= offset || !timestamp)
 		return 0;
@@ -1256,9 +1256,8 @@ static u16 hw_atl_b0_rx_extract_ts(struct aq_hw_s *self, u8 *p,
 	ptr += sizeof(sec);
 	memcpy(&ns, ptr, sizeof(ns));
 
-	sec = be64_to_cpu(sec) & 0xffffffffffffllu;
-	ns = be32_to_cpu(ns);
-	*timestamp = sec * NSEC_PER_SEC + ns + self->ptp_clk_offset;
+	*timestamp = (be64_to_cpu(sec) & 0xffffffffffffllu) * NSEC_PER_SEC +
+		     be32_to_cpu(ns) + self->ptp_clk_offset;
 
 	eth = (struct ethhdr *)p;
 
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h
index 37e6b696009d..ee11b107f0a5 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h
@@ -41,7 +41,7 @@ struct __packed hw_atl_rxd_wb_s {
 	u16 status;
 	u16 pkt_len;
 	u16 next_desc_ptr;
-	u16 vlan;
+	__le16 vlan;
 };
 
 /* Hardware rx HW TIMESTAMP writeback */
-- 
2.17.1


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

* [PATCH net-next 3/3] net: aquantia: disable ptp object build if no config
  2019-10-26 11:05 [PATCH net-next 0/3] net: aquantia: ptp followup fixes Igor Russkikh
  2019-10-26 11:05 ` [PATCH net-next 1/3] net: aquantia: fix var initialization warning Igor Russkikh
  2019-10-26 11:05 ` [PATCH net-next 2/3] net: aquantia: fix warnings on endianness Igor Russkikh
@ 2019-10-26 11:05 ` Igor Russkikh
  2019-10-26 17:44   ` Richard Cochran
  2019-10-26 18:28 ` [PATCH net-next 0/3] net: aquantia: ptp followup fixes David Miller
  3 siblings, 1 reply; 6+ messages in thread
From: Igor Russkikh @ 2019-10-26 11:05 UTC (permalink / raw)
  To: netdev@vger.kernel.org; +Cc: David S . Miller, Igor Russkikh

We do disable aq_ptp module build using inline
stubs when CONFIG_PTP_1588_CLOCK is not declared.

This reduces module size and removes unnecessary code.

Reported-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 .../net/ethernet/aquantia/atlantic/Makefile   |  3 +-
 .../net/ethernet/aquantia/atlantic/aq_ptp.h   | 84 +++++++++++++++++++
 2 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/Makefile b/drivers/net/ethernet/aquantia/atlantic/Makefile
index 68c41141ede2..0020726db204 100644
--- a/drivers/net/ethernet/aquantia/atlantic/Makefile
+++ b/drivers/net/ethernet/aquantia/atlantic/Makefile
@@ -24,10 +24,11 @@ atlantic-objs := aq_main.o \
 	aq_ethtool.o \
 	aq_drvinfo.o \
 	aq_filters.o \
-	aq_ptp.o \
 	aq_phy.o \
 	hw_atl/hw_atl_a0.o \
 	hw_atl/hw_atl_b0.o \
 	hw_atl/hw_atl_utils.o \
 	hw_atl/hw_atl_utils_fw2x.o \
 	hw_atl/hw_atl_llh.o
+
+atlantic-$(CONFIG_PTP_1588_CLOCK) += aq_ptp.o
\ No newline at end of file
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.h b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.h
index 3de4682f7c06..bf503a40b6a4 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.h
@@ -11,6 +11,8 @@
 #include <linux/net_tstamp.h>
 #include <linux/version.h>
 
+#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
+
 /* Common functions */
 int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec);
 
@@ -54,4 +56,86 @@ struct ptp_clock *aq_ptp_get_ptp_clock(struct aq_ptp_s *aq_ptp);
 
 int aq_ptp_link_change(struct aq_nic_s *aq_nic);
 
+#else
+
+static inline int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec)
+{
+	return 0;
+}
+
+static inline void aq_ptp_unregister(struct aq_nic_s *aq_nic) {}
+
+static inline void aq_ptp_free(struct aq_nic_s *aq_nic)
+{
+}
+
+static inline int aq_ptp_irq_alloc(struct aq_nic_s *aq_nic)
+{
+	return 0;
+}
+
+static inline void aq_ptp_irq_free(struct aq_nic_s *aq_nic)
+{
+}
+
+static inline int aq_ptp_ring_alloc(struct aq_nic_s *aq_nic)
+{
+	return 0;
+}
+
+static inline void aq_ptp_ring_free(struct aq_nic_s *aq_nic) {}
+
+static inline int aq_ptp_ring_init(struct aq_nic_s *aq_nic)
+{
+	return 0;
+}
+
+static inline int aq_ptp_ring_start(struct aq_nic_s *aq_nic)
+{
+	return 0;
+}
+
+static inline void aq_ptp_ring_stop(struct aq_nic_s *aq_nic) {}
+static inline void aq_ptp_ring_deinit(struct aq_nic_s *aq_nic) {}
+static inline void aq_ptp_service_task(struct aq_nic_s *aq_nic) {}
+static inline void aq_ptp_tm_offset_set(struct aq_nic_s *aq_nic,
+					unsigned int mbps) {}
+static inline void aq_ptp_clock_init(struct aq_nic_s *aq_nic) {}
+static inline int aq_ptp_xmit(struct aq_nic_s *aq_nic, struct sk_buff *skb)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline void aq_ptp_tx_hwtstamp(struct aq_nic_s *aq_nic, u64 timestamp) {}
+static inline void aq_ptp_hwtstamp_config_get(struct aq_ptp_s *aq_ptp,
+					      struct hwtstamp_config *config) {}
+static inline int aq_ptp_hwtstamp_config_set(struct aq_ptp_s *aq_ptp,
+					     struct hwtstamp_config *config)
+{
+	return 0;
+}
+
+static inline bool aq_ptp_ring(struct aq_nic_s *aq_nic, struct aq_ring_s *ring)
+{
+	return false;
+}
+
+static inline u16 aq_ptp_extract_ts(struct aq_nic_s *aq_nic,
+				    struct sk_buff *skb, u8 *p,
+				    unsigned int len)
+{
+	return 0;
+}
+
+static inline struct ptp_clock *aq_ptp_get_ptp_clock(struct aq_ptp_s *aq_ptp)
+{
+	return NULL;
+}
+
+static inline int aq_ptp_link_change(struct aq_nic_s *aq_nic)
+{
+	return 0;
+}
+#endif
+
 #endif /* AQ_PTP_H */
-- 
2.17.1


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

* Re: [PATCH net-next 3/3] net: aquantia: disable ptp object build if no config
  2019-10-26 11:05 ` [PATCH net-next 3/3] net: aquantia: disable ptp object build if no config Igor Russkikh
@ 2019-10-26 17:44   ` Richard Cochran
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2019-10-26 17:44 UTC (permalink / raw)
  To: Igor Russkikh; +Cc: netdev@vger.kernel.org, David S . Miller

On Sat, Oct 26, 2019 at 11:05:34AM +0000, Igor Russkikh wrote:
> We do disable aq_ptp module build using inline
> stubs when CONFIG_PTP_1588_CLOCK is not declared.
> 
> This reduces module size and removes unnecessary code.
> 
> Reported-by: YueHaibing <yuehaibing@huawei.com>
> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>

Acked-by: Richard Cochran <richardcochran@gmail.com>

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

* Re: [PATCH net-next 0/3] net: aquantia: ptp followup fixes
  2019-10-26 11:05 [PATCH net-next 0/3] net: aquantia: ptp followup fixes Igor Russkikh
                   ` (2 preceding siblings ...)
  2019-10-26 11:05 ` [PATCH net-next 3/3] net: aquantia: disable ptp object build if no config Igor Russkikh
@ 2019-10-26 18:28 ` David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-10-26 18:28 UTC (permalink / raw)
  To: Igor.Russkikh; +Cc: netdev

From: Igor Russkikh <Igor.Russkikh@aquantia.com>
Date: Sat, 26 Oct 2019 11:05:30 +0000

> Here are two sparse warnings, third patch is a fix for
> scaled_ppm_to_ppb missing. Eventually I reworked this
> to exclude ptp module from build. Please consider it instead
> of this patch: https://patchwork.ozlabs.org/patch/1184171/

Series applied, thanks Igor.

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

end of thread, other threads:[~2019-10-26 18:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-26 11:05 [PATCH net-next 0/3] net: aquantia: ptp followup fixes Igor Russkikh
2019-10-26 11:05 ` [PATCH net-next 1/3] net: aquantia: fix var initialization warning Igor Russkikh
2019-10-26 11:05 ` [PATCH net-next 2/3] net: aquantia: fix warnings on endianness Igor Russkikh
2019-10-26 11:05 ` [PATCH net-next 3/3] net: aquantia: disable ptp object build if no config Igor Russkikh
2019-10-26 17:44   ` Richard Cochran
2019-10-26 18:28 ` [PATCH net-next 0/3] net: aquantia: ptp followup fixes 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).