Commit 5f43f217 authored by Jiawen Wu's avatar Jiawen Wu Committed by Jakub Kicinski
Browse files

net: wangxun: cleanup the code in wx_set_coalesce()



Cleanup the code for the next patch to add adaptive RX coalesce.

Signed-off-by: default avatarJiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Link: https://patch.msgid.link/20250821023408.53472-4-jiawenwu@trustnetic.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent fd4aa243
Loading
Loading
Loading
Loading
+8 −20
Original line number Diff line number Diff line
@@ -343,13 +343,19 @@ int wx_set_coalesce(struct net_device *netdev,
	switch (wx->mac.type) {
	case wx_mac_sp:
		max_eitr = WX_SP_MAX_EITR;
		rx_itr_param = WX_20K_ITR;
		tx_itr_param = WX_12K_ITR;
		break;
	case wx_mac_aml:
	case wx_mac_aml40:
		max_eitr = WX_AML_MAX_EITR;
		rx_itr_param = WX_20K_ITR;
		tx_itr_param = WX_12K_ITR;
		break;
	default:
		max_eitr = WX_EM_MAX_EITR;
		rx_itr_param = WX_7K_ITR;
		tx_itr_param = WX_7K_ITR;
		break;
	}

@@ -362,34 +368,16 @@ int wx_set_coalesce(struct net_device *netdev,
	else
		wx->rx_itr_setting = ec->rx_coalesce_usecs;

	if (wx->rx_itr_setting == 1) {
		if (wx->mac.type == wx_mac_em)
			rx_itr_param = WX_7K_ITR;
		else
			rx_itr_param = WX_20K_ITR;
	} else {
	if (wx->rx_itr_setting != 1)
		rx_itr_param = wx->rx_itr_setting;
	}

	if (ec->tx_coalesce_usecs > 1)
		wx->tx_itr_setting = ec->tx_coalesce_usecs << 2;
	else
		wx->tx_itr_setting = ec->tx_coalesce_usecs;

	if (wx->tx_itr_setting == 1) {
		switch (wx->mac.type) {
		case wx_mac_sp:
		case wx_mac_aml:
		case wx_mac_aml40:
			tx_itr_param = WX_12K_ITR;
			break;
		default:
			tx_itr_param = WX_7K_ITR;
			break;
		}
	} else {
	if (wx->tx_itr_setting != 1)
		tx_itr_param = wx->tx_itr_setting;
	}

	/* mixed Rx/Tx */
	if (wx->q_vector[0]->tx.count && wx->q_vector[0]->rx.count)