Skip to content

Commit b08866f

Browse files
committed
Merge branch 'net-atlantic-various-non-functional-changes'
Igor Russkikh says: ==================== net: atlantic: various non-functional changes 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. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents e562d08 + 4378b88 commit b08866f

File tree

10 files changed

+80
-33
lines changed

10 files changed

+80
-33
lines changed

drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,21 @@ static const char aq_macsec_stat_names[][ETH_GSTRING_LEN] = {
124124
"MACSec OutUnctrlHitDropRedir",
125125
};
126126

127-
static const char *aq_macsec_txsc_stat_names[] = {
127+
static const char * const aq_macsec_txsc_stat_names[] = {
128128
"MACSecTXSC%d ProtectedPkts",
129129
"MACSecTXSC%d EncryptedPkts",
130130
"MACSecTXSC%d ProtectedOctets",
131131
"MACSecTXSC%d EncryptedOctets",
132132
};
133133

134-
static const char *aq_macsec_txsa_stat_names[] = {
134+
static const char * const aq_macsec_txsa_stat_names[] = {
135135
"MACSecTXSC%dSA%d HitDropRedirect",
136136
"MACSecTXSC%dSA%d Protected2Pkts",
137137
"MACSecTXSC%dSA%d ProtectedPkts",
138138
"MACSecTXSC%dSA%d EncryptedPkts",
139139
};
140140

141-
static const char *aq_macsec_rxsa_stat_names[] = {
141+
static const char * const aq_macsec_rxsa_stat_names[] = {
142142
"MACSecRXSC%dSA%d UntaggedHitPkts",
143143
"MACSecRXSC%dSA%d CtrlHitDrpRedir",
144144
"MACSecRXSC%dSA%d NotUsingSa",
@@ -607,7 +607,9 @@ static int aq_ethtool_get_ts_info(struct net_device *ndev,
607607
BIT(HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
608608
BIT(HWTSTAMP_FILTER_PTP_V2_EVENT);
609609

610+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
610611
info->phc_index = ptp_clock_index(aq_ptp_get_ptp_clock(aq_nic->aq_ptp));
612+
#endif
611613

612614
return 0;
613615
}
@@ -716,13 +718,12 @@ static void aq_ethtool_get_pauseparam(struct net_device *ndev,
716718
struct ethtool_pauseparam *pause)
717719
{
718720
struct aq_nic_s *aq_nic = netdev_priv(ndev);
719-
u32 fc = aq_nic->aq_nic_cfg.fc.req;
721+
int fc = aq_nic->aq_nic_cfg.fc.req;
720722

721723
pause->autoneg = 0;
722724

723725
pause->rx_pause = !!(fc & AQ_NIC_FC_RX);
724726
pause->tx_pause = !!(fc & AQ_NIC_FC_TX);
725-
726727
}
727728

728729
static int aq_ethtool_set_pauseparam(struct net_device *ndev,

drivers/net/ethernet/aquantia/atlantic/aq_main.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0-only
2-
/*
3-
* aQuantia Corporation Network Driver
4-
* Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
2+
/* Atlantic Network Driver
3+
*
4+
* Copyright (C) 2014-2019 aQuantia Corporation
5+
* Copyright (C) 2019-2020 Marvell International Ltd.
56
*/
67

78
/* 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)
9899
{
99100
struct aq_nic_s *aq_nic = netdev_priv(ndev);
100101

102+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
101103
if (unlikely(aq_utils_obj_test(&aq_nic->flags, AQ_NIC_PTP_DPATH_UP))) {
102104
/* Hardware adds the Timestamp for PTPv2 802.AS1
103105
* and PTPv2 IPv4 UDP.
@@ -114,6 +116,7 @@ static int aq_ndev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
114116
unlikely(eth_hdr(skb)->h_proto == htons(ETH_P_1588)))
115117
return aq_ptp_xmit(aq_nic, skb);
116118
}
119+
#endif
117120

118121
skb_tx_timestamp(skb);
119122
return aq_nic_xmit(aq_nic, skb);
@@ -222,6 +225,7 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev)
222225
(void)aq_nic_set_multicast_list(aq_nic, ndev);
223226
}
224227

228+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
225229
static int aq_ndev_config_hwtstamp(struct aq_nic_s *aq_nic,
226230
struct hwtstamp_config *config)
227231
{
@@ -256,26 +260,31 @@ static int aq_ndev_config_hwtstamp(struct aq_nic_s *aq_nic,
256260

257261
return aq_ptp_hwtstamp_config_set(aq_nic->aq_ptp, config);
258262
}
263+
#endif
259264

260265
static int aq_ndev_hwtstamp_set(struct aq_nic_s *aq_nic, struct ifreq *ifr)
261266
{
262267
struct hwtstamp_config config;
268+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
263269
int ret_val;
270+
#endif
264271

265272
if (!aq_nic->aq_ptp)
266273
return -EOPNOTSUPP;
267274

268275
if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
269276
return -EFAULT;
270-
277+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
271278
ret_val = aq_ndev_config_hwtstamp(aq_nic, &config);
272279
if (ret_val)
273280
return ret_val;
281+
#endif
274282

275283
return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
276284
-EFAULT : 0;
277285
}
278286

287+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
279288
static int aq_ndev_hwtstamp_get(struct aq_nic_s *aq_nic, struct ifreq *ifr)
280289
{
281290
struct hwtstamp_config config;
@@ -287,6 +296,7 @@ static int aq_ndev_hwtstamp_get(struct aq_nic_s *aq_nic, struct ifreq *ifr)
287296
return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
288297
-EFAULT : 0;
289298
}
299+
#endif
290300

291301
static int aq_ndev_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
292302
{
@@ -296,8 +306,10 @@ static int aq_ndev_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
296306
case SIOCSHWTSTAMP:
297307
return aq_ndev_hwtstamp_set(aq_nic, ifr);
298308

309+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
299310
case SIOCGHWTSTAMP:
300311
return aq_ndev_hwtstamp_get(aq_nic, ifr);
312+
#endif
301313
}
302314

303315
return -EOPNOTSUPP;

drivers/net/ethernet/aquantia/atlantic/aq_nic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ int aq_nic_set_loopback(struct aq_nic_s *self)
11881188

11891189
if (!self->aq_hw_ops->hw_set_loopback ||
11901190
!self->aq_fw_ops->set_phyloopback)
1191-
return -ENOTSUPP;
1191+
return -EOPNOTSUPP;
11921192

11931193
mutex_lock(&self->fwreq_mutex);
11941194
self->aq_hw_ops->hw_set_loopback(self->aq_hw,

drivers/net/ethernet/aquantia/atlantic/aq_nic.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
2-
/*
3-
* aQuantia Corporation Network Driver
4-
* Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
2+
/* Atlantic Network Driver
3+
*
4+
* Copyright (C) 2014-2019 aQuantia Corporation
5+
* Copyright (C) 2019-2020 Marvell International Ltd.
56
*/
67

78
/* File aq_nic.h: Declaration of common code for NIC. */
@@ -111,7 +112,7 @@ struct aq_hw_rx_fltrs_s {
111112
u16 active_filters;
112113
struct aq_hw_rx_fl2 fl2;
113114
struct aq_hw_rx_fl3l4 fl3l4;
114-
/*filter ether type */
115+
/* filter ether type */
115116
u8 fet_reserved_count;
116117
};
117118

drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0-only
2-
/*
3-
* aQuantia Corporation Network Driver
4-
* Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
2+
/* Atlantic Network Driver
3+
*
4+
* Copyright (C) 2014-2019 aQuantia Corporation
5+
* Copyright (C) 2019-2020 Marvell International Ltd.
56
*/
67

78
/* 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,
114115
return 0;
115116
}
116117

117-
int aq_pci_func_init(struct pci_dev *pdev)
118+
static int aq_pci_func_init(struct pci_dev *pdev)
118119
{
119120
int err;
120121

drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
2-
/*
3-
* aQuantia Corporation Network Driver
4-
* Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
2+
/* Atlantic Network Driver
3+
*
4+
* Copyright (C) 2014-2019 aQuantia Corporation
5+
* Copyright (C) 2019-2020 Marvell International Ltd.
56
*/
67

78
/* File aq_pci_func.h: Declaration of PCI functions. */
@@ -19,7 +20,6 @@ struct aq_board_revision_s {
1920
const struct aq_hw_caps_s *caps;
2021
};
2122

22-
int aq_pci_func_init(struct pci_dev *pdev);
2323
int aq_pci_func_alloc_irq(struct aq_nic_s *self, unsigned int i,
2424
char *name, irq_handler_t irq_handler,
2525
void *irq_arg, cpumask_t *affinity_mask);

drivers/net/ethernet/aquantia/atlantic/aq_ptp.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0-only
2-
/* Aquantia Corporation Network Driver
3-
* Copyright (C) 2014-2019 Aquantia Corporation. All rights reserved
2+
/* Atlantic Network Driver
3+
*
4+
* Copyright (C) 2014-2019 aQuantia Corporation
5+
* Copyright (C) 2019-2020 Marvell International Ltd.
46
*/
57

68
/* File aq_ptp.c:
@@ -18,6 +20,8 @@
1820
#include "aq_phy.h"
1921
#include "aq_filters.h"
2022

23+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
24+
2125
#define AQ_PTP_TX_TIMEOUT (HZ * 10)
2226

2327
#define POLL_SYNC_TIMER_MS 15
@@ -1389,3 +1393,4 @@ static void aq_ptp_poll_sync_work_cb(struct work_struct *w)
13891393
schedule_delayed_work(&aq_ptp->poll_sync, timeout);
13901394
}
13911395
}
1396+
#endif

drivers/net/ethernet/aquantia/atlantic/aq_ring.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0-only
2-
/*
3-
* aQuantia Corporation Network Driver
4-
* Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
2+
/* Atlantic Network Driver
3+
*
4+
* Copyright (C) 2014-2019 aQuantia Corporation
5+
* Copyright (C) 2019-2020 Marvell International Ltd.
56
*/
67

78
/* 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)
279280
}
280281

281282
if (unlikely(buff->is_eop)) {
282-
++self->stats.rx.packets;
283+
++self->stats.tx.packets;
283284
self->stats.tx.bytes += buff->skb->len;
284285

285286
dev_kfree_skb_any(buff->skb);
@@ -489,6 +490,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
489490

490491
void aq_ring_hwts_rx_clean(struct aq_ring_s *self, struct aq_nic_s *aq_nic)
491492
{
493+
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
492494
while (self->sw_head != self->hw_head) {
493495
u64 ns;
494496

@@ -500,6 +502,7 @@ void aq_ring_hwts_rx_clean(struct aq_ring_s *self, struct aq_nic_s *aq_nic)
500502

501503
self->sw_head = aq_ring_next_dx(self, self->sw_head);
502504
}
505+
#endif
503506
}
504507

505508
int aq_ring_rx_fill(struct aq_ring_s *self)

drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static int hw_atl_utils_soft_reset_rbl(struct aq_hw_s *self)
217217

218218
if (rbl_status == 0xF1A7) {
219219
aq_pr_err("No FW detected. Dynamic FW load not implemented\n");
220-
return -ENOTSUPP;
220+
return -EOPNOTSUPP;
221221
}
222222

223223
for (k = 0; k < 1000; k++) {

drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,29 @@
1616
#define AQ_A2_FW_READ_TRY_MAX 1000
1717

1818
#define hw_atl2_shared_buffer_write(HW, ITEM, VARIABLE) \
19+
{\
20+
BUILD_BUG_ON_MSG((offsetof(struct fw_interface_in, ITEM) % \
21+
sizeof(u32)) != 0,\
22+
"Unaligned write " # ITEM);\
23+
BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\
24+
"Unaligned write length " # ITEM);\
1925
hw_atl2_mif_shared_buf_write(HW,\
2026
(offsetof(struct fw_interface_in, ITEM) / sizeof(u32)),\
21-
(u32 *)&(VARIABLE), sizeof(VARIABLE) / sizeof(u32))
27+
(u32 *)&(VARIABLE), sizeof(VARIABLE) / sizeof(u32));\
28+
}
2229

2330
#define hw_atl2_shared_buffer_get(HW, ITEM, VARIABLE) \
31+
{\
32+
BUILD_BUG_ON_MSG((offsetof(struct fw_interface_in, ITEM) % \
33+
sizeof(u32)) != 0,\
34+
"Unaligned get " # ITEM);\
35+
BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\
36+
"Unaligned get length " # ITEM);\
2437
hw_atl2_mif_shared_buf_get(HW, \
2538
(offsetof(struct fw_interface_in, ITEM) / sizeof(u32)),\
2639
(u32 *)&(VARIABLE), \
27-
sizeof(VARIABLE) / sizeof(u32))
40+
sizeof(VARIABLE) / sizeof(u32));\
41+
}
2842

2943
/* This should never be used on non atomic fields,
3044
* treat any > u32 read as non atomic.
@@ -33,7 +47,9 @@
3347
{\
3448
BUILD_BUG_ON_MSG((offsetof(struct fw_interface_out, ITEM) % \
3549
sizeof(u32)) != 0,\
36-
"Non aligned read " # ITEM);\
50+
"Unaligned read " # ITEM);\
51+
BUILD_BUG_ON_MSG((sizeof(VARIABLE) % sizeof(u32)) != 0,\
52+
"Unaligned read length " # ITEM);\
3753
BUILD_BUG_ON_MSG(sizeof(VARIABLE) > sizeof(u32),\
3854
"Non atomic read " # ITEM);\
3955
hw_atl2_mif_shared_buf_read(HW, \
@@ -42,10 +58,18 @@
4258
}
4359

4460
#define hw_atl2_shared_buffer_read_safe(HW, ITEM, DATA) \
61+
({\
62+
BUILD_BUG_ON_MSG((offsetof(struct fw_interface_out, ITEM) % \
63+
sizeof(u32)) != 0,\
64+
"Unaligned read_safe " # ITEM);\
65+
BUILD_BUG_ON_MSG((sizeof(((struct fw_interface_out *)0)->ITEM) % \
66+
sizeof(u32)) != 0,\
67+
"Unaligned read_safe length " # ITEM);\
4568
hw_atl2_shared_buffer_read_block((HW), \
4669
(offsetof(struct fw_interface_out, ITEM) / sizeof(u32)),\
4770
sizeof(((struct fw_interface_out *)0)->ITEM) / sizeof(u32),\
48-
(DATA))
71+
(DATA));\
72+
})
4973

5074
static int hw_atl2_shared_buffer_read_block(struct aq_hw_s *self,
5175
u32 offset, u32 dwords, void *data)

0 commit comments

Comments
 (0)