Re: [PATCH V3 net 1/2] net: hns: fix wrong head when modify the tx feature when sending packets

From: Paolo Abeni
Date: Wed Dec 06 2023 - 06:18:56 EST


On Mon, 2023-12-04 at 22:32 +0800, Jijie Shao wrote:
> @@ -2159,16 +2175,9 @@ static void hns_nic_set_priv_ops(struct net_device *netdev)
> priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx;
> } else {
> priv->ops.get_rxd_bnum = get_v2rx_desc_bnum;
> - if ((netdev->features & NETIF_F_TSO) ||
> - (netdev->features & NETIF_F_TSO6)) {
> - priv->ops.fill_desc = fill_tso_desc;
> - priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tso;
> - /* This chip only support 7*4096 */
> - netif_set_tso_max_size(netdev, 7 * 4096);
> - } else {
> - priv->ops.fill_desc = fill_v2_desc;
> - priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx;
> - }
> + priv->ops.fill_desc = fill_desc_v2;
> + priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx_v2;
> + netif_set_tso_max_size(netdev, 7 * 4096);
> /* enable tso when init
> * control tso on/off through TSE bit in bd
> */

Side note: since both 'fill_desc' and 'maybe_stop_tx' have constant
values, for net-next you should really consider replacing the function
pointers with direct-calls.

You currently have at least 2 indirect calls per wire packet, which
hurt performances a lot in case security issues mitigations are in
place.

Cheers,

Paolo