nvethernet: enable rx frame based interrupt coalescing

Rx frame based coalescing can be enabled only when
Rx timer based coalescing is also enabled. This is to avoid
no rx interrupt issues for applications which send only limited
frames and expects reply.

Bug 200529168

Change-Id: I7b00414bd56935ad8df57c9fa28764feb878213d
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2233503
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Ajay Gupta
2019-11-04 15:05:51 -08:00
committed by Revanth Kumar Uppala
parent 9fec12055d
commit 5a14f39d86
2 changed files with 50 additions and 5 deletions

View File

@@ -3251,6 +3251,29 @@ static int ether_parse_dt(struct ether_priv_data *pdata)
}
osi_dma->use_riwt = OSI_ENABLE;
}
/* rx_frames value to be set */
ret = of_property_read_u32(np, "nvidia,rx_frames",
&osi_dma->rx_frames);
if (ret < 0) {
osi_dma->use_rx_frames = OSI_DISABLE;
} else {
if (osi_dma->rx_frames > RX_DESC_CNT ||
osi_dma->rx_frames < OSI_MIN_RX_COALESCE_FRAMES) {
dev_err(dev,
"invalid rx-frames, must be inrange %d to %d",
OSI_MIN_RX_COALESCE_FRAMES, RX_DESC_CNT);
return -EINVAL;
}
osi_dma->use_rx_frames = OSI_ENABLE;
}
if (osi_dma->use_riwt == OSI_DISABLE &&
osi_dma->use_rx_frames == OSI_ENABLE) {
dev_err(dev, "invalid settings : rx-frames must be enabled"
" along with use_riwt in DT\n");
return -EINVAL;
}
/* Enable VLAN strip by default */
osi_core->strip_vlan_tag = OSI_ENABLE;

View File

@@ -580,11 +580,23 @@ static int ether_set_coalesce(struct net_device *dev,
(ec->tx_max_coalesced_frames_irq) ||
(ec->stats_block_coalesce_usecs) ||
(ec->tx_max_coalesced_frames_high) || (ec->rate_sample_interval) ||
(ec->tx_coalesce_usecs) || (ec->tx_max_coalesced_frames) ||
(ec->rx_max_coalesced_frames)) {
(ec->tx_coalesce_usecs) || (ec->tx_max_coalesced_frames)) {
return -EOPNOTSUPP;
}
if (ec->rx_max_coalesced_frames == OSI_DISABLE) {
osi_dma->use_rx_frames = OSI_DISABLE;
} else if ((ec->rx_max_coalesced_frames > RX_DESC_CNT) ||
(ec->rx_max_coalesced_frames < OSI_MIN_RX_COALESCE_FRAMES)) {
netdev_err(dev,
"invalid rx-frames, must be in the range of"
" %d to %d frames\n", OSI_MIN_RX_COALESCE_FRAMES,
RX_DESC_CNT);
return -EINVAL;
} else {
osi_dma->use_rx_frames = OSI_ENABLE;
}
if (ec->rx_coalesce_usecs == OSI_DISABLE) {
osi_dma->use_riwt = OSI_DISABLE;
} else if ((ec->rx_coalesce_usecs > OSI_MAX_RX_COALESCE_USEC) ||
@@ -598,11 +610,20 @@ static int ether_set_coalesce(struct net_device *dev,
osi_dma->use_riwt = OSI_ENABLE;
}
netdev_err(dev, "RX COALESCING is %s\n", osi_dma->use_riwt ? "ENABLED" :
"DISABLED");
if (osi_dma->use_riwt == OSI_DISABLE &&
osi_dma->use_rx_frames == OSI_ENABLE) {
netdev_err(dev, "invalid settings : rx-frames must be enabled"
" along with rx-usecs\n");
return -EINVAL;
}
netdev_err(dev, "RX COALESCING USECS is %s\n", osi_dma->use_riwt ?
"ENABLED" : "DISABLED");
netdev_err(dev, "RX COALESCING FRAMES is %s\n", osi_dma->use_rx_frames ?
"ENABLED" : "DISABLED");
osi_dma->rx_riwt = ec->rx_coalesce_usecs;
osi_dma->rx_frames = ec->rx_max_coalesced_frames;
return 0;
}
@@ -629,6 +650,7 @@ static int ether_get_coalesce(struct net_device *dev,
memset(ec, 0, sizeof(struct ethtool_coalesce));
ec->rx_coalesce_usecs = osi_dma->rx_riwt;
ec->rx_max_coalesced_frames = osi_dma->rx_frames;
return 0;
}