Re: [PATCH] net treewide: Use skb_is_gso

From: Jakub Kicinski
Date: Fri Oct 23 2020 - 16:57:13 EST


On Wed, 21 Oct 2020 18:30:30 +0800 Yi Li wrote:
> This patch introduces the use of the inline func skb_is_gso in place of
> tests for skb_shinfo(skb)->gso_size.
>
> - if (skb_shinfo(skb)->gso_size)
> + if (skb_is_gso(skb))
>
> - if (unlikely(skb_shinfo(skb)->gso_size))
> + if (unlikely(skb_is_gso(skb)))
>
> - if (!skb_shinfo(skb)->gso_size)
> + if (!skb_is_gso(skb))
>
> Signed-off-by: Yi Li <yili@xxxxxxxxxxx>

The places where gso_size is used on the Rx path may be driver
specific, so I'd rather you left those out.

At a quick look - the following ifs ones are on the Rx path:

> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> index 1a6ec1a12d53..af20884cd772 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
> @@ -732,7 +732,7 @@ static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
> struct sk_buff *skb)
> {
> #ifdef CONFIG_INET
> - if (skb_shinfo(skb)->gso_size) {
> + if (skb_is_gso(skb)) {
> switch (be16_to_cpu(skb->protocol)) {
> case ETH_P_IP:
> bnx2x_gro_csum(bp, skb, bnx2x_gro_ip_csum);

> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> index a362516a3185..e694c99ee540 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> @@ -2990,7 +2990,7 @@ static int hns3_set_gro_and_checksum(struct hns3_enet_ring *ring,
> HNS3_RXD_GRO_SIZE_M,
> HNS3_RXD_GRO_SIZE_S);
> /* if there is no HW GRO, do not set gro params */
> - if (!skb_shinfo(skb)->gso_size) {
> + if (!skb_is_gso(skb)) {
> hns3_rx_checksum(ring, skb, l234info, bd_base_info, ol_info);
> return 0;
> }
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index 7ef3369953b6..9c264768f166 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1251,7 +1251,7 @@ static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
> tcph->check = 0;
> }
>
> - if (skb_shinfo(skb)->gso_size) {
> + if (skb_is_gso(skb)) {
> hdr_len = offset + tcph->doff * 4;
> skb_shinfo(skb)->gso_segs =
> DIV_ROUND_UP(skb->len - hdr_len,

> diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c
> index a2494bf85007..092e24893cb9 100644
> --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c
> +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c
> @@ -934,7 +934,7 @@ static void qede_gro_receive(struct qede_dev *edev,
> }
>
> #ifdef CONFIG_INET
> - if (skb_shinfo(skb)->gso_size) {
> + if (skb_is_gso(skb)) {
> skb_reset_network_header(skb);
>
> switch (skb->protocol) {