Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -204,6 +204,9 @@ struct aq_hw_ops {

	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);
};

+8 −2
Original line number Diff line number Diff line
@@ -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_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic);
	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;

		if (aq_cfg->is_lro != is_lro) {
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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->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)
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ struct aq_vec_s;

struct aq_nic_cfg_s {
	const struct aq_hw_caps_s *aq_hw_caps;
	u64 hw_features;
	u64 features;
	u32 rxds;		/* rx ring size, descriptors # */
	u32 txds;		/* tx ring size, descriptors # */
	u32 vecs;		/* vecs==allocated irqs */
+5 −2
Original line number Diff line number Diff line
@@ -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);

	/* RX checksums offloads*/
	hw_atl_rpo_ipv4header_crc_offload_en_set(self, 1);
	hw_atl_rpo_tcp_udp_crc_offload_en_set(self, 1);
	hw_atl_rpo_ipv4header_crc_offload_en_set(self, !!(aq_nic_cfg->features &
						 NETIF_F_RXCSUM));
	hw_atl_rpo_tcp_udp_crc_offload_en_set(self, !!(aq_nic_cfg->features &
					      NETIF_F_RXCSUM));

	/* LSO offloads*/
	hw_atl_tdm_large_send_offload_en_set(self, 0xFFFFFFFFU);
@@ -974,5 +976,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = {
	.hw_get_regs                 = hw_atl_utils_hw_get_regs,
	.hw_get_hw_stats             = hw_atl_utils_get_hw_stats,
	.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,
};