Skip to content

Commit bbb67a4

Browse files
logostdavem330
authored andcommittedNov 9, 2018
net: aquantia: allow rx checksum offload configuration
RX Checksum offloads could not be configured and ignored netdev features flag for checksumming. Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com> Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ad703c2 commit bbb67a4

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed
 

‎drivers/net/ethernet/aquantia/atlantic/aq_hw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ struct aq_hw_ops {
204204

205205
int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version);
206206

207+
int (*hw_set_offload)(struct aq_hw_s *self,
208+
struct aq_nic_cfg_s *aq_nic_cfg);
209+
207210
int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc);
208211
};
209212

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,11 @@ static int aq_ndev_set_features(struct net_device *ndev,
9999
struct aq_nic_s *aq_nic = netdev_priv(ndev);
100100
struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic);
101101
bool is_lro = false;
102+
int err = 0;
103+
104+
aq_cfg->features = features;
102105

103-
if (aq_cfg->hw_features & NETIF_F_LRO) {
106+
if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) {
104107
is_lro = features & NETIF_F_LRO;
105108

106109
if (aq_cfg->is_lro != is_lro) {
@@ -112,8 +115,11 @@ static int aq_ndev_set_features(struct net_device *ndev,
112115
}
113116
}
114117
}
118+
if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM)
119+
err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw,
120+
aq_cfg);
115121

116-
return 0;
122+
return err;
117123
}
118124

119125
static int aq_ndev_set_mac_address(struct net_device *ndev, void *addr)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
118118
}
119119

120120
cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk;
121-
cfg->hw_features = cfg->aq_hw_caps->hw_features;
121+
cfg->features = cfg->aq_hw_caps->hw_features;
122122
}
123123

124124
static int aq_nic_update_link_status(struct aq_nic_s *self)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct aq_vec_s;
2323

2424
struct aq_nic_cfg_s {
2525
const struct aq_hw_caps_s *aq_hw_caps;
26-
u64 hw_features;
26+
u64 features;
2727
u32 rxds; /* rx ring size, descriptors # */
2828
u32 txds; /* tx ring size, descriptors # */
2929
u32 vecs; /* vecs==allocated irqs */

‎drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,10 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self,
234234
hw_atl_tpo_tcp_udp_crc_offload_en_set(self, 1);
235235

236236
/* RX checksums offloads*/
237-
hw_atl_rpo_ipv4header_crc_offload_en_set(self, 1);
238-
hw_atl_rpo_tcp_udp_crc_offload_en_set(self, 1);
237+
hw_atl_rpo_ipv4header_crc_offload_en_set(self, !!(aq_nic_cfg->features &
238+
NETIF_F_RXCSUM));
239+
hw_atl_rpo_tcp_udp_crc_offload_en_set(self, !!(aq_nic_cfg->features &
240+
NETIF_F_RXCSUM));
239241

240242
/* LSO offloads*/
241243
hw_atl_tdm_large_send_offload_en_set(self, 0xFFFFFFFFU);
@@ -974,5 +976,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = {
974976
.hw_get_regs = hw_atl_utils_hw_get_regs,
975977
.hw_get_hw_stats = hw_atl_utils_get_hw_stats,
976978
.hw_get_fw_version = hw_atl_utils_get_fw_version,
979+
.hw_set_offload = hw_atl_b0_hw_offload_set,
977980
.hw_set_fc = hw_atl_b0_set_fc,
978981
};

0 commit comments

Comments
 (0)