Commit bbb67a44 authored by Dmitry Bogdanov's avatar Dmitry Bogdanov Committed by David S. Miller

net: aquantia: allow rx checksum offload configuration

RX Checksum offloads could not be configured and ignored netdev features
flag for checksumming.
Signed-off-by: default avatarIgor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: default avatarDmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad703c2b
...@@ -204,6 +204,9 @@ struct aq_hw_ops { ...@@ -204,6 +204,9 @@ struct aq_hw_ops {
int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version); int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version);
int (*hw_set_offload)(struct aq_hw_s *self,
struct aq_nic_cfg_s *aq_nic_cfg);
int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc); int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc);
}; };
......
...@@ -99,8 +99,11 @@ static int aq_ndev_set_features(struct net_device *ndev, ...@@ -99,8 +99,11 @@ static int aq_ndev_set_features(struct net_device *ndev,
struct aq_nic_s *aq_nic = netdev_priv(ndev); struct aq_nic_s *aq_nic = netdev_priv(ndev);
struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic); struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic);
bool is_lro = false; bool is_lro = false;
int err = 0;
aq_cfg->features = features;
if (aq_cfg->hw_features & NETIF_F_LRO) { if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) {
is_lro = features & NETIF_F_LRO; is_lro = features & NETIF_F_LRO;
if (aq_cfg->is_lro != is_lro) { if (aq_cfg->is_lro != is_lro) {
...@@ -112,8 +115,11 @@ static int aq_ndev_set_features(struct net_device *ndev, ...@@ -112,8 +115,11 @@ static int aq_ndev_set_features(struct net_device *ndev,
} }
} }
} }
if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM)
err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw,
aq_cfg);
return 0; return err;
} }
static int aq_ndev_set_mac_address(struct net_device *ndev, void *addr) static int aq_ndev_set_mac_address(struct net_device *ndev, void *addr)
......
...@@ -118,7 +118,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self) ...@@ -118,7 +118,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
} }
cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk;
cfg->hw_features = cfg->aq_hw_caps->hw_features; cfg->features = cfg->aq_hw_caps->hw_features;
} }
static int aq_nic_update_link_status(struct aq_nic_s *self) static int aq_nic_update_link_status(struct aq_nic_s *self)
......
...@@ -23,7 +23,7 @@ struct aq_vec_s; ...@@ -23,7 +23,7 @@ struct aq_vec_s;
struct aq_nic_cfg_s { struct aq_nic_cfg_s {
const struct aq_hw_caps_s *aq_hw_caps; const struct aq_hw_caps_s *aq_hw_caps;
u64 hw_features; u64 features;
u32 rxds; /* rx ring size, descriptors # */ u32 rxds; /* rx ring size, descriptors # */
u32 txds; /* tx ring size, descriptors # */ u32 txds; /* tx ring size, descriptors # */
u32 vecs; /* vecs==allocated irqs */ u32 vecs; /* vecs==allocated irqs */
......
...@@ -234,8 +234,10 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self, ...@@ -234,8 +234,10 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self,
hw_atl_tpo_tcp_udp_crc_offload_en_set(self, 1); hw_atl_tpo_tcp_udp_crc_offload_en_set(self, 1);
/* RX checksums offloads*/ /* RX checksums offloads*/
hw_atl_rpo_ipv4header_crc_offload_en_set(self, 1); hw_atl_rpo_ipv4header_crc_offload_en_set(self, !!(aq_nic_cfg->features &
hw_atl_rpo_tcp_udp_crc_offload_en_set(self, 1); NETIF_F_RXCSUM));
hw_atl_rpo_tcp_udp_crc_offload_en_set(self, !!(aq_nic_cfg->features &
NETIF_F_RXCSUM));
/* LSO offloads*/ /* LSO offloads*/
hw_atl_tdm_large_send_offload_en_set(self, 0xFFFFFFFFU); hw_atl_tdm_large_send_offload_en_set(self, 0xFFFFFFFFU);
...@@ -974,5 +976,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = { ...@@ -974,5 +976,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = {
.hw_get_regs = hw_atl_utils_hw_get_regs, .hw_get_regs = hw_atl_utils_hw_get_regs,
.hw_get_hw_stats = hw_atl_utils_get_hw_stats, .hw_get_hw_stats = hw_atl_utils_get_hw_stats,
.hw_get_fw_version = hw_atl_utils_get_fw_version, .hw_get_fw_version = hw_atl_utils_get_fw_version,
.hw_set_offload = hw_atl_b0_hw_offload_set,
.hw_set_fc = hw_atl_b0_set_fc, .hw_set_fc = hw_atl_b0_set_fc,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment