]> Git Repo - linux.git/commitdiff
ionic: Mark error paths in the data path as unlikely
authorBrett Creeley <[email protected]>
Wed, 29 May 2024 00:02:56 +0000 (17:02 -0700)
committerJakub Kicinski <[email protected]>
Fri, 31 May 2024 01:10:34 +0000 (18:10 -0700)
As the title states, mark unlikely error paths in the data path as
unlikely.

Signed-off-by: Brett Creeley <[email protected]>
Signed-off-by: Shannon Nelson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
drivers/net/ethernet/pensando/ionic/ionic_txrx.c

index c6aa8fb743be0d41aec0278a895d5ca6b704aa49..14aa3844b699958c2eca42e9300e8db2aa318004 100644 (file)
@@ -582,7 +582,7 @@ static bool ionic_run_xdp(struct ionic_rx_stats *stats,
                                           buf_info->page_offset,
                                           true);
                __netif_tx_unlock(nq);
-               if (err) {
+               if (unlikely(err)) {
                        netdev_dbg(netdev, "tx ionic_xdp_post_frame err %d\n", err);
                        goto out_xdp_abort;
                }
@@ -597,7 +597,7 @@ static bool ionic_run_xdp(struct ionic_rx_stats *stats,
                               IONIC_PAGE_SIZE, DMA_FROM_DEVICE);
 
                err = xdp_do_redirect(netdev, &xdp_buf, xdp_prog);
-               if (err) {
+               if (unlikely(err)) {
                        netdev_dbg(netdev, "xdp_do_redirect err %d\n", err);
                        goto out_xdp_abort;
                }
@@ -1058,7 +1058,7 @@ static dma_addr_t ionic_tx_map_single(struct ionic_queue *q,
        dma_addr_t dma_addr;
 
        dma_addr = dma_map_single(dev, data, len, DMA_TO_DEVICE);
-       if (dma_mapping_error(dev, dma_addr)) {
+       if (unlikely(dma_mapping_error(dev, dma_addr))) {
                net_warn_ratelimited("%s: DMA single map failed on %s!\n",
                                     dev_name(dev), q->name);
                q_to_tx_stats(q)->dma_map_err++;
@@ -1075,7 +1075,7 @@ static dma_addr_t ionic_tx_map_frag(struct ionic_queue *q,
        dma_addr_t dma_addr;
 
        dma_addr = skb_frag_dma_map(dev, frag, offset, len, DMA_TO_DEVICE);
-       if (dma_mapping_error(dev, dma_addr)) {
+       if (unlikely(dma_mapping_error(dev, dma_addr))) {
                net_warn_ratelimited("%s: DMA frag map failed on %s!\n",
                                     dev_name(dev), q->name);
                q_to_tx_stats(q)->dma_map_err++;
@@ -1316,7 +1316,7 @@ static int ionic_tx_tcp_inner_pseudo_csum(struct sk_buff *skb)
        int err;
 
        err = skb_cow_head(skb, 0);
-       if (err)
+       if (unlikely(err))
                return err;
 
        if (skb->protocol == cpu_to_be16(ETH_P_IP)) {
@@ -1340,7 +1340,7 @@ static int ionic_tx_tcp_pseudo_csum(struct sk_buff *skb)
        int err;
 
        err = skb_cow_head(skb, 0);
-       if (err)
+       if (unlikely(err))
                return err;
 
        if (skb->protocol == cpu_to_be16(ETH_P_IP)) {
@@ -1444,7 +1444,7 @@ static int ionic_tx_tso(struct net_device *netdev, struct ionic_queue *q,
                err = ionic_tx_tcp_inner_pseudo_csum(skb);
        else
                err = ionic_tx_tcp_pseudo_csum(skb);
-       if (err) {
+       if (unlikely(err)) {
                /* clean up mapping from ionic_tx_map_skb */
                ionic_tx_desc_unmap_bufs(q, desc_info);
                return err;
@@ -1729,7 +1729,7 @@ static int ionic_tx_descs_needed(struct ionic_queue *q, struct sk_buff *skb)
 linearize:
        if (too_many_frags) {
                err = skb_linearize(skb);
-               if (err)
+               if (unlikely(err))
                        return err;
                q_to_tx_stats(q)->linearize++;
        }
@@ -1763,7 +1763,7 @@ static netdev_tx_t ionic_start_hwstamp_xmit(struct sk_buff *skb,
        else
                err = ionic_tx(netdev, q, skb);
 
-       if (err)
+       if (unlikely(err))
                goto err_out_drop;
 
        return NETDEV_TX_OK;
@@ -1809,7 +1809,7 @@ netdev_tx_t ionic_start_xmit(struct sk_buff *skb, struct net_device *netdev)
        else
                err = ionic_tx(netdev, q, skb);
 
-       if (err)
+       if (unlikely(err))
                goto err_out_drop;
 
        return NETDEV_TX_OK;
This page took 0.06903 seconds and 4 git commands to generate.