diff options
author | Dmitry Bogdanov <dmitry.bogdanov@aquantia.com> | 2018-11-09 06:54:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-09 18:38:10 -0500 |
commit | bbb67a44baf973da734b9fd61cba4211da240751 (patch) | |
tree | a48500a31fcc26540dd0594866a8ca4a00c10b1e /drivers/net | |
parent | ad703c2b9127f9acdef697ec4755f6da4beaa266 (diff) |
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>
Diffstat (limited to 'drivers/net')
5 files changed, 18 insertions, 6 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h index 7ec8d24b2b0b..a1e70da358ca 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h | |||
@@ -204,6 +204,9 @@ struct aq_hw_ops { | |||
204 | 204 | ||
205 | int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version); | 205 | int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version); |
206 | 206 | ||
207 | int (*hw_set_offload)(struct aq_hw_s *self, | ||
208 | struct aq_nic_cfg_s *aq_nic_cfg); | ||
209 | |||
207 | int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc); | 210 | int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc); |
208 | }; | 211 | }; |
209 | 212 | ||
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c index e3ae29e523f0..7c07eef275eb 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c | |||
@@ -99,8 +99,11 @@ static int aq_ndev_set_features(struct net_device *ndev, | |||
99 | struct aq_nic_s *aq_nic = netdev_priv(ndev); | 99 | struct aq_nic_s *aq_nic = netdev_priv(ndev); |
100 | struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic); | 100 | struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic); |
101 | bool is_lro = false; | 101 | bool is_lro = false; |
102 | int err = 0; | ||
103 | |||
104 | aq_cfg->features = features; | ||
102 | 105 | ||
103 | if (aq_cfg->hw_features & NETIF_F_LRO) { | 106 | if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) { |
104 | is_lro = features & NETIF_F_LRO; | 107 | is_lro = features & NETIF_F_LRO; |
105 | 108 | ||
106 | if (aq_cfg->is_lro != is_lro) { | 109 | if (aq_cfg->is_lro != is_lro) { |
@@ -112,8 +115,11 @@ static int aq_ndev_set_features(struct net_device *ndev, | |||
112 | } | 115 | } |
113 | } | 116 | } |
114 | } | 117 | } |
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); | ||
115 | 121 | ||
116 | return 0; | 122 | return err; |
117 | } | 123 | } |
118 | 124 | ||
119 | static int aq_ndev_set_mac_address(struct net_device *ndev, void *addr) | 125 | static int aq_ndev_set_mac_address(struct net_device *ndev, void *addr) |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index b5e7c98f424c..7abdc0952425 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c | |||
@@ -118,7 +118,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; | 120 | 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; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int aq_nic_update_link_status(struct aq_nic_s *self) | 124 | static int aq_nic_update_link_status(struct aq_nic_s *self) |
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h index c1582f4e8e1b..44ec47a3d60a 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h | |||
@@ -23,7 +23,7 @@ struct aq_vec_s; | |||
23 | 23 | ||
24 | struct aq_nic_cfg_s { | 24 | struct aq_nic_cfg_s { |
25 | const struct aq_hw_caps_s *aq_hw_caps; | 25 | const struct aq_hw_caps_s *aq_hw_caps; |
26 | u64 hw_features; | 26 | u64 features; |
27 | u32 rxds; /* rx ring size, descriptors # */ | 27 | u32 rxds; /* rx ring size, descriptors # */ |
28 | u32 txds; /* tx ring size, descriptors # */ | 28 | u32 txds; /* tx ring size, descriptors # */ |
29 | u32 vecs; /* vecs==allocated irqs */ | 29 | u32 vecs; /* vecs==allocated irqs */ |
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 179ce12fe4d8..f02592f43fe3 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 | |||
@@ -234,8 +234,10 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self, | |||
234 | hw_atl_tpo_tcp_udp_crc_offload_en_set(self, 1); | 234 | hw_atl_tpo_tcp_udp_crc_offload_en_set(self, 1); |
235 | 235 | ||
236 | /* RX checksums offloads*/ | 236 | /* RX checksums offloads*/ |
237 | hw_atl_rpo_ipv4header_crc_offload_en_set(self, 1); | 237 | hw_atl_rpo_ipv4header_crc_offload_en_set(self, !!(aq_nic_cfg->features & |
238 | hw_atl_rpo_tcp_udp_crc_offload_en_set(self, 1); | 238 | NETIF_F_RXCSUM)); |
239 | hw_atl_rpo_tcp_udp_crc_offload_en_set(self, !!(aq_nic_cfg->features & | ||
240 | NETIF_F_RXCSUM)); | ||
239 | 241 | ||
240 | /* LSO offloads*/ | 242 | /* LSO offloads*/ |
241 | hw_atl_tdm_large_send_offload_en_set(self, 0xFFFFFFFFU); | 243 | hw_atl_tdm_large_send_offload_en_set(self, 0xFFFFFFFFU); |
@@ -974,5 +976,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = { | |||
974 | .hw_get_regs = hw_atl_utils_hw_get_regs, | 976 | .hw_get_regs = hw_atl_utils_hw_get_regs, |
975 | .hw_get_hw_stats = hw_atl_utils_get_hw_stats, | 977 | .hw_get_hw_stats = hw_atl_utils_get_hw_stats, |
976 | .hw_get_fw_version = hw_atl_utils_get_fw_version, | 978 | .hw_get_fw_version = hw_atl_utils_get_fw_version, |
979 | .hw_set_offload = hw_atl_b0_hw_offload_set, | ||
977 | .hw_set_fc = hw_atl_b0_set_fc, | 980 | .hw_set_fc = hw_atl_b0_set_fc, |
978 | }; | 981 | }; |