Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

qeth: rework fast path

Remove unnecessary traces. Remove unnecessary wrappers for skb
functions.

Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

Frank Blaschka and committed by
Jeff Garzik
f90b744e 3f9975aa

+13 -98
+6 -25
drivers/s390/net/qeth_core.h
··· 758 758 return (int) (get_clock() >> 12); 759 759 } 760 760 761 - static inline void *qeth_push_skb(struct qeth_card *card, struct sk_buff *skb, 762 - int size) 763 - { 764 - void *hdr; 765 - 766 - hdr = (void *) skb_push(skb, size); 767 - /* 768 - * sanity check, the Linux memory allocation scheme should 769 - * never present us cases like this one (the qdio header size plus 770 - * the first 40 bytes of the paket cross a 4k boundary) 771 - */ 772 - if ((((unsigned long) hdr) & (~(PAGE_SIZE - 1))) != 773 - (((unsigned long) hdr + size + 774 - QETH_IP_HEADER_SIZE) & (~(PAGE_SIZE - 1)))) { 775 - PRINT_ERR("Misaligned packet on interface %s. Discarded.", 776 - QETH_CARD_IFNAME(card)); 777 - return NULL; 778 - } 779 - return hdr; 780 - } 781 - 782 761 static inline int qeth_get_ip_version(struct sk_buff *skb) 783 762 { 784 763 switch (skb->protocol) { ··· 768 789 default: 769 790 return 0; 770 791 } 792 + } 793 + 794 + static inline void qeth_put_buffer_pool_entry(struct qeth_card *card, 795 + struct qeth_buffer_pool_entry *entry) 796 + { 797 + list_add_tail(&entry->list, &card->qdio.in_buf_pool.entry_list); 771 798 } 772 799 773 800 struct qeth_eddp_context; ··· 813 828 int qeth_query_setadapterparms(struct qeth_card *); 814 829 int qeth_check_qdio_errors(struct qdio_buffer *, unsigned int, 815 830 unsigned int, const char *); 816 - void qeth_put_buffer_pool_entry(struct qeth_card *, 817 - struct qeth_buffer_pool_entry *); 818 831 void qeth_queue_input_buffer(struct qeth_card *, int); 819 832 struct sk_buff *qeth_core_get_next_skb(struct qeth_card *, 820 833 struct qdio_buffer *, struct qdio_buffer_element **, int *, ··· 848 865 void *reply_param); 849 866 int qeth_get_cast_type(struct qeth_card *, struct sk_buff *); 850 867 int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); 851 - struct sk_buff *qeth_prepare_skb(struct qeth_card *, struct sk_buff *, 852 - struct qeth_hdr **); 853 868 int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); 854 869 int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, 855 870 struct sk_buff *, struct qeth_hdr *, int,
+3 -64
drivers/s390/net/qeth_core_main.c
··· 2252 2252 } 2253 2253 EXPORT_SYMBOL_GPL(qeth_print_status_message); 2254 2254 2255 - void qeth_put_buffer_pool_entry(struct qeth_card *card, 2256 - struct qeth_buffer_pool_entry *entry) 2257 - { 2258 - QETH_DBF_TEXT(TRACE, 6, "ptbfplen"); 2259 - list_add_tail(&entry->list, &card->qdio.in_buf_pool.entry_list); 2260 - } 2261 - EXPORT_SYMBOL_GPL(qeth_put_buffer_pool_entry); 2262 - 2263 2255 static void qeth_initialize_working_pool_list(struct qeth_card *card) 2264 2256 { 2265 2257 struct qeth_buffer_pool_entry *entry; ··· 2592 2600 int rc; 2593 2601 int newcount = 0; 2594 2602 2595 - QETH_DBF_TEXT(TRACE, 6, "queinbuf"); 2596 2603 count = (index < queue->next_buf_to_init)? 2597 2604 card->qdio.in_buf_pool.buf_count - 2598 2605 (queue->next_buf_to_init - index) : ··· 2779 2788 int rc; 2780 2789 int i; 2781 2790 unsigned int qdio_flags; 2782 - 2783 - QETH_DBF_TEXT(TRACE, 6, "flushbuf"); 2784 2791 2785 2792 for (i = index; i < index + count; ++i) { 2786 2793 buf = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; ··· 3023 3034 } 3024 3035 EXPORT_SYMBOL_GPL(qeth_get_priority_queue); 3025 3036 3026 - static void __qeth_free_new_skb(struct sk_buff *orig_skb, 3027 - struct sk_buff *new_skb) 3028 - { 3029 - if (orig_skb != new_skb) 3030 - dev_kfree_skb_any(new_skb); 3031 - } 3032 - 3033 - static inline struct sk_buff *qeth_realloc_headroom(struct qeth_card *card, 3034 - struct sk_buff *skb, int size) 3035 - { 3036 - struct sk_buff *new_skb = skb; 3037 - 3038 - if (skb_headroom(skb) >= size) 3039 - return skb; 3040 - new_skb = skb_realloc_headroom(skb, size); 3041 - if (!new_skb) 3042 - PRINT_ERR("Could not realloc headroom for qeth_hdr " 3043 - "on interface %s", QETH_CARD_IFNAME(card)); 3044 - return new_skb; 3045 - } 3046 - 3047 - struct sk_buff *qeth_prepare_skb(struct qeth_card *card, struct sk_buff *skb, 3048 - struct qeth_hdr **hdr) 3049 - { 3050 - struct sk_buff *new_skb; 3051 - 3052 - QETH_DBF_TEXT(TRACE, 6, "prepskb"); 3053 - 3054 - new_skb = qeth_realloc_headroom(card, skb, 3055 - sizeof(struct qeth_hdr)); 3056 - if (!new_skb) 3057 - return NULL; 3058 - 3059 - *hdr = ((struct qeth_hdr *)qeth_push_skb(card, new_skb, 3060 - sizeof(struct qeth_hdr))); 3061 - if (*hdr == NULL) { 3062 - __qeth_free_new_skb(skb, new_skb); 3063 - return NULL; 3064 - } 3065 - return new_skb; 3066 - } 3067 - EXPORT_SYMBOL_GPL(qeth_prepare_skb); 3068 - 3069 3037 int qeth_get_elements_no(struct qeth_card *card, void *hdr, 3070 3038 struct sk_buff *skb, int elems) 3071 3039 { ··· 3043 3097 } 3044 3098 EXPORT_SYMBOL_GPL(qeth_get_elements_no); 3045 3099 3046 - static void __qeth_fill_buffer(struct sk_buff *skb, struct qdio_buffer *buffer, 3047 - int is_tso, int *next_element_to_fill) 3100 + static inline void __qeth_fill_buffer(struct sk_buff *skb, 3101 + struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill) 3048 3102 { 3049 3103 int length = skb->len; 3050 3104 int length_here; ··· 3086 3140 *next_element_to_fill = element; 3087 3141 } 3088 3142 3089 - static int qeth_fill_buffer(struct qeth_qdio_out_q *queue, 3143 + static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue, 3090 3144 struct qeth_qdio_out_buffer *buf, struct sk_buff *skb) 3091 3145 { 3092 3146 struct qdio_buffer *buffer; 3093 3147 struct qeth_hdr_tso *hdr; 3094 3148 int flush_cnt = 0, hdr_len, large_send = 0; 3095 - 3096 - QETH_DBF_TEXT(TRACE, 6, "qdfillbf"); 3097 3149 3098 3150 buffer = buf->buffer; 3099 3151 atomic_inc(&skb->users); ··· 3151 3207 int flush_cnt = 0; 3152 3208 int index; 3153 3209 3154 - QETH_DBF_TEXT(TRACE, 6, "dosndpfa"); 3155 - 3156 3210 /* spin until we get the queue ... */ 3157 3211 while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, 3158 3212 QETH_OUT_Q_LOCKED) != QETH_OUT_Q_UNLOCKED); ··· 3201 3259 int do_pack = 0; 3202 3260 int tmp; 3203 3261 int rc = 0; 3204 - 3205 - QETH_DBF_TEXT(TRACE, 6, "dosndpkt"); 3206 3262 3207 3263 /* spin until we get the queue ... */ 3208 3264 while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, ··· 3898 3958 int use_rx_sg = 0; 3899 3959 int frag = 0; 3900 3960 3901 - QETH_DBF_TEXT(TRACE, 6, "nextskb"); 3902 3961 /* qeth_hdr must not cross element boundaries */ 3903 3962 if (element->length < offset + sizeof(struct qeth_hdr)) { 3904 3963 if (qeth_is_last_sbale(element))
+4 -4
drivers/s390/net/qeth_l2_main.c
··· 632 632 enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; 633 633 struct qeth_eddp_context *ctx = NULL; 634 634 635 - QETH_DBF_TEXT(TRACE, 6, "l2xmit"); 636 - 637 635 if ((card->state != CARD_STATE_UP) || !card->lan_online) { 638 636 card->stats.tx_carrier_errors++; 639 637 goto tx_drop; ··· 653 655 if (card->info.type == QETH_CARD_TYPE_OSN) 654 656 hdr = (struct qeth_hdr *)skb->data; 655 657 else { 656 - new_skb = qeth_prepare_skb(card, skb, &hdr); 658 + /* create a clone with writeable headroom */ 659 + new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr)); 657 660 if (!new_skb) 658 661 goto tx_drop; 662 + hdr = (struct qeth_hdr *)skb_push(new_skb, 663 + sizeof(struct qeth_hdr)); 659 664 qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); 660 665 } 661 666 ··· 745 744 int index; 746 745 int i; 747 746 748 - QETH_DBF_TEXT(TRACE, 6, "qdinput"); 749 747 card = (struct qeth_card *) card_ptr; 750 748 net_dev = card->dev; 751 749 if (card->options.performance_stats) {
-5
drivers/s390/net/qeth_l3_main.c
··· 2557 2557 static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, 2558 2558 struct sk_buff *skb, int ipv, int cast_type) 2559 2559 { 2560 - QETH_DBF_TEXT(TRACE, 6, "fillhdr"); 2561 - 2562 2560 memset(hdr, 0, sizeof(struct qeth_hdr)); 2563 2561 hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3; 2564 2562 hdr->hdr.l3.ext_flags = 0; ··· 2634 2636 int tx_bytes = skb->len; 2635 2637 enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; 2636 2638 struct qeth_eddp_context *ctx = NULL; 2637 - 2638 - QETH_DBF_TEXT(TRACE, 6, "l3xmit"); 2639 2639 2640 2640 if ((card->info.type == QETH_CARD_TYPE_IQD) && 2641 2641 (skb->protocol != htons(ETH_P_IPV6)) && ··· 2978 2982 int index; 2979 2983 int i; 2980 2984 2981 - QETH_DBF_TEXT(TRACE, 6, "qdinput"); 2982 2985 card = (struct qeth_card *) card_ptr; 2983 2986 net_dev = card->dev; 2984 2987 if (card->options.performance_stats) {