quoted
self->ndev->mtu = aq_nic_cfg->mtu - ETH_HLEN;
+ self->ndev->min_mtu = ETH_MIN_MTU;
This is not required. It will default to ETH_MIN_MTU.
Thanks Andrew, true.
quoted
+ self->ndev->max_mtu = self->aq_hw_caps.mtu - ETH_FCS_LEN - ETH_HLEN;
return 0;
}
@@ -695,7 +696,7 @@ int aq_nic_set_mtu(struct aq_nic_s *self, int new_mtu)
{
int err = 0;
- if (new_mtu > self->aq_hw_caps.mtu) {
+ if (new_mtu + ETH_FCS_LEN > self->aq_hw_caps.mtu) {
If you have set max_mtu correctly, this cannot happen. But it seems
odd you don't have ETH_HLEN here, where as when setting max_mtu you
do.
I agree, thats an extra check. Will remove that.
Regarding ETH_HLEN - the baseline code invokes this function with (new_mtu + ETH_HLEN) - thats why this check does not add it. In general, that extra level of storage (aq_nic_cfg.mtu field) is almost useless, I'll cleanup this under a separate patchset.
--
BR,
Igor