]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
s390/qeth: allocate skb from NAPI cache
authorJulian Wiedmann <jwi@linux.vnet.ibm.com>
Fri, 9 Mar 2018 17:12:57 +0000 (18:12 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Mar 2018 18:10:04 +0000 (13:10 -0500)
napi_alloc_skb() doesn't need to disable IRQs during the allocation,
and thus may save us a few cycles.
Doing so requires a small fix-up in the HiperTransport path, which
currently assumes a fixed NET_SKB_PAD headroom padding. napi_alloc_skb()
adds an additional NET_IP_ALIGN padding, so use the proper helper for
setting up the mac_header offset.

Use this opportunity to convert the non-NAPI path to netdev_alloc_skb(),
which means that skb->dev is now always set-up during allocation and
doesn't need to be assigned manually.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c

index d884b399f92a55a8b7f4997ae0c53c36461f376c..8f427621e6565c41544caa66ff9afd0e87a5ff47 100644 (file)
@@ -2835,7 +2835,8 @@ static int qeth_init_input_buffer(struct qeth_card *card,
        int i;
 
        if ((card->options.cq == QETH_CQ_ENABLED) && (!buf->rx_skb)) {
-               buf->rx_skb = dev_alloc_skb(QETH_RX_PULL_LEN + ETH_HLEN);
+               buf->rx_skb = netdev_alloc_skb(card->dev,
+                                              QETH_RX_PULL_LEN + ETH_HLEN);
                if (!buf->rx_skb)
                        return 1;
        }
@@ -5325,7 +5326,7 @@ struct sk_buff *qeth_core_get_next_skb(struct qeth_card *card,
        } else {
                unsigned int linear = (use_rx_sg) ? QETH_RX_PULL_LEN : skb_len;
 
-               skb = dev_alloc_skb(linear + headroom);
+               skb = napi_alloc_skb(&card->napi, linear + headroom);
        }
        if (!skb)
                goto no_mem;
index c7bc80b3a9797fd4f46d82c03f2134905442a4dd..95bf452fc51b6969a31c005d015d1441f3328a16 100644 (file)
@@ -437,7 +437,6 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
                        *done = 1;
                        break;
                }
-               skb->dev = card->dev;
                switch (hdr->hdr.l2.id) {
                case QETH_HEADER_TYPE_LAYER2:
                        skb->pkt_type = PACKET_HOST;
index 8e8818ea33e2a61798b93634804819cea2fb93c0..283cbdcc5d6b39e77e8f6c1533e1edb5a4b552bf 100644 (file)
@@ -1572,7 +1572,6 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
                        *done = 1;
                        break;
                }
-               skb->dev = card->dev;
                switch (hdr->hdr.l3.id) {
                case QETH_HEADER_TYPE_LAYER3:
                        magic = *(__u16 *)skb->data;
@@ -1580,11 +1579,10 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
                            (magic == ETH_P_AF_IUCV)) {
                                skb->protocol = cpu_to_be16(ETH_P_AF_IUCV);
                                skb->pkt_type = PACKET_HOST;
-                               skb->mac_header = NET_SKB_PAD;
-                               skb->dev = card->dev;
                                len = skb->len;
                                card->dev->header_ops->create(skb, card->dev, 0,
                                        card->dev->dev_addr, "FAKELL", len);
+                               skb_reset_mac_header(skb);
                                netif_receive_skb(skb);
                        } else {
                                qeth_l3_rebuild_skb(card, skb, hdr);