Skip to content

Commit

Permalink
net: aquantia: fix warnings on endianness
Browse files Browse the repository at this point in the history
fixes to remove sparse warnings:
sparse: sparse: cast to restricted __be64

Fixes: 04a1839 ("net: aquantia: implement data PTP datapath")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Igor Russkikh authored and David S. Miller committed Oct 26, 2019
1 parent bb1eded commit 5eeb6c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 5eeb6c3

Please sign in to comment.