diff options
author | Frank Blaschka <frank.blaschka@de.ibm.com> | 2008-04-24 04:15:24 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-29 01:56:32 -0400 |
commit | f90b744eb8ead0af7a7aa2f78ff861dff4863f2c (patch) | |
tree | d5901d8dbdcb6c3af05a28d00bbc43f961629093 | |
parent | 3f9975aa4d5b3c614eef8785ec63da13fbd55b51 (diff) |
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>
-rw-r--r-- | drivers/s390/net/qeth_core.h | 31 | ||||
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 67 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l2_main.c | 8 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 5 |
4 files changed, 13 insertions, 98 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 8dd83d920981..699ac11debd8 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -758,27 +758,6 @@ static inline int qeth_get_micros(void) | |||
758 | return (int) (get_clock() >> 12); | 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 | static inline int qeth_get_ip_version(struct sk_buff *skb) | 761 | static inline int qeth_get_ip_version(struct sk_buff *skb) |
783 | { | 762 | { |
784 | switch (skb->protocol) { | 763 | switch (skb->protocol) { |
@@ -791,6 +770,12 @@ static inline int qeth_get_ip_version(struct sk_buff *skb) | |||
791 | } | 770 | } |
792 | } | 771 | } |
793 | 772 | ||
773 | static inline void qeth_put_buffer_pool_entry(struct qeth_card *card, | ||
774 | struct qeth_buffer_pool_entry *entry) | ||
775 | { | ||
776 | list_add_tail(&entry->list, &card->qdio.in_buf_pool.entry_list); | ||
777 | } | ||
778 | |||
794 | struct qeth_eddp_context; | 779 | struct qeth_eddp_context; |
795 | extern struct ccwgroup_driver qeth_l2_ccwgroup_driver; | 780 | extern struct ccwgroup_driver qeth_l2_ccwgroup_driver; |
796 | extern struct ccwgroup_driver qeth_l3_ccwgroup_driver; | 781 | extern struct ccwgroup_driver qeth_l3_ccwgroup_driver; |
@@ -828,8 +813,6 @@ struct qeth_cmd_buffer *qeth_get_ipacmd_buffer(struct qeth_card *, | |||
828 | int qeth_query_setadapterparms(struct qeth_card *); | 813 | int qeth_query_setadapterparms(struct qeth_card *); |
829 | int qeth_check_qdio_errors(struct qdio_buffer *, unsigned int, | 814 | int qeth_check_qdio_errors(struct qdio_buffer *, unsigned int, |
830 | unsigned int, const char *); | 815 | unsigned int, const char *); |
831 | void qeth_put_buffer_pool_entry(struct qeth_card *, | ||
832 | struct qeth_buffer_pool_entry *); | ||
833 | void qeth_queue_input_buffer(struct qeth_card *, int); | 816 | void qeth_queue_input_buffer(struct qeth_card *, int); |
834 | struct sk_buff *qeth_core_get_next_skb(struct qeth_card *, | 817 | struct sk_buff *qeth_core_get_next_skb(struct qeth_card *, |
835 | struct qdio_buffer *, struct qdio_buffer_element **, int *, | 818 | struct qdio_buffer *, struct qdio_buffer_element **, int *, |
@@ -865,8 +848,6 @@ int qeth_send_control_data(struct qeth_card *, int, struct qeth_cmd_buffer *, | |||
865 | void *reply_param); | 848 | void *reply_param); |
866 | int qeth_get_cast_type(struct qeth_card *, struct sk_buff *); | 849 | int qeth_get_cast_type(struct qeth_card *, struct sk_buff *); |
867 | int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); | 850 | int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); |
868 | struct sk_buff *qeth_prepare_skb(struct qeth_card *, struct sk_buff *, | ||
869 | struct qeth_hdr **); | ||
870 | int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); | 851 | int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); |
871 | int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, | 852 | int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, |
872 | struct sk_buff *, struct qeth_hdr *, int, | 853 | struct sk_buff *, struct qeth_hdr *, int, |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 23a46340ffaa..820c332096e2 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -2252,14 +2252,6 @@ void qeth_print_status_message(struct qeth_card *card) | |||
2252 | } | 2252 | } |
2253 | EXPORT_SYMBOL_GPL(qeth_print_status_message); | 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 | static void qeth_initialize_working_pool_list(struct qeth_card *card) | 2255 | static void qeth_initialize_working_pool_list(struct qeth_card *card) |
2264 | { | 2256 | { |
2265 | struct qeth_buffer_pool_entry *entry; | 2257 | struct qeth_buffer_pool_entry *entry; |
@@ -2600,7 +2592,6 @@ void qeth_queue_input_buffer(struct qeth_card *card, int index) | |||
2600 | int rc; | 2592 | int rc; |
2601 | int newcount = 0; | 2593 | int newcount = 0; |
2602 | 2594 | ||
2603 | QETH_DBF_TEXT(TRACE, 6, "queinbuf"); | ||
2604 | count = (index < queue->next_buf_to_init)? | 2595 | count = (index < queue->next_buf_to_init)? |
2605 | card->qdio.in_buf_pool.buf_count - | 2596 | card->qdio.in_buf_pool.buf_count - |
2606 | (queue->next_buf_to_init - index) : | 2597 | (queue->next_buf_to_init - index) : |
@@ -2789,8 +2780,6 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int under_int, | |||
2789 | int i; | 2780 | int i; |
2790 | unsigned int qdio_flags; | 2781 | unsigned int qdio_flags; |
2791 | 2782 | ||
2792 | QETH_DBF_TEXT(TRACE, 6, "flushbuf"); | ||
2793 | |||
2794 | for (i = index; i < index + count; ++i) { | 2783 | for (i = index; i < index + count; ++i) { |
2795 | buf = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; | 2784 | buf = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; |
2796 | buf->buffer->element[buf->next_element_to_fill - 1].flags |= | 2785 | buf->buffer->element[buf->next_element_to_fill - 1].flags |= |
@@ -3034,49 +3023,6 @@ int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb, | |||
3034 | } | 3023 | } |
3035 | EXPORT_SYMBOL_GPL(qeth_get_priority_queue); | 3024 | EXPORT_SYMBOL_GPL(qeth_get_priority_queue); |
3036 | 3025 | ||
3037 | static void __qeth_free_new_skb(struct sk_buff *orig_skb, | ||
3038 | struct sk_buff *new_skb) | ||
3039 | { | ||
3040 | if (orig_skb != new_skb) | ||
3041 | dev_kfree_skb_any(new_skb); | ||
3042 | } | ||
3043 | |||
3044 | static inline struct sk_buff *qeth_realloc_headroom(struct qeth_card *card, | ||
3045 | struct sk_buff *skb, int size) | ||
3046 | { | ||
3047 | struct sk_buff *new_skb = skb; | ||
3048 | |||
3049 | if (skb_headroom(skb) >= size) | ||
3050 | return skb; | ||
3051 | new_skb = skb_realloc_headroom(skb, size); | ||
3052 | if (!new_skb) | ||
3053 | PRINT_ERR("Could not realloc headroom for qeth_hdr " | ||
3054 | "on interface %s", QETH_CARD_IFNAME(card)); | ||
3055 | return new_skb; | ||
3056 | } | ||
3057 | |||
3058 | struct sk_buff *qeth_prepare_skb(struct qeth_card *card, struct sk_buff *skb, | ||
3059 | struct qeth_hdr **hdr) | ||
3060 | { | ||
3061 | struct sk_buff *new_skb; | ||
3062 | |||
3063 | QETH_DBF_TEXT(TRACE, 6, "prepskb"); | ||
3064 | |||
3065 | new_skb = qeth_realloc_headroom(card, skb, | ||
3066 | sizeof(struct qeth_hdr)); | ||
3067 | if (!new_skb) | ||
3068 | return NULL; | ||
3069 | |||
3070 | *hdr = ((struct qeth_hdr *)qeth_push_skb(card, new_skb, | ||
3071 | sizeof(struct qeth_hdr))); | ||
3072 | if (*hdr == NULL) { | ||
3073 | __qeth_free_new_skb(skb, new_skb); | ||
3074 | return NULL; | ||
3075 | } | ||
3076 | return new_skb; | ||
3077 | } | ||
3078 | EXPORT_SYMBOL_GPL(qeth_prepare_skb); | ||
3079 | |||
3080 | int qeth_get_elements_no(struct qeth_card *card, void *hdr, | 3026 | int qeth_get_elements_no(struct qeth_card *card, void *hdr, |
3081 | struct sk_buff *skb, int elems) | 3027 | struct sk_buff *skb, int elems) |
3082 | { | 3028 | { |
@@ -3097,8 +3043,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr, | |||
3097 | } | 3043 | } |
3098 | EXPORT_SYMBOL_GPL(qeth_get_elements_no); | 3044 | EXPORT_SYMBOL_GPL(qeth_get_elements_no); |
3099 | 3045 | ||
3100 | static void __qeth_fill_buffer(struct sk_buff *skb, struct qdio_buffer *buffer, | 3046 | static inline void __qeth_fill_buffer(struct sk_buff *skb, |
3101 | int is_tso, int *next_element_to_fill) | 3047 | struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill) |
3102 | { | 3048 | { |
3103 | int length = skb->len; | 3049 | int length = skb->len; |
3104 | int length_here; | 3050 | int length_here; |
@@ -3140,15 +3086,13 @@ static void __qeth_fill_buffer(struct sk_buff *skb, struct qdio_buffer *buffer, | |||
3140 | *next_element_to_fill = element; | 3086 | *next_element_to_fill = element; |
3141 | } | 3087 | } |
3142 | 3088 | ||
3143 | static int qeth_fill_buffer(struct qeth_qdio_out_q *queue, | 3089 | static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue, |
3144 | struct qeth_qdio_out_buffer *buf, struct sk_buff *skb) | 3090 | struct qeth_qdio_out_buffer *buf, struct sk_buff *skb) |
3145 | { | 3091 | { |
3146 | struct qdio_buffer *buffer; | 3092 | struct qdio_buffer *buffer; |
3147 | struct qeth_hdr_tso *hdr; | 3093 | struct qeth_hdr_tso *hdr; |
3148 | int flush_cnt = 0, hdr_len, large_send = 0; | 3094 | int flush_cnt = 0, hdr_len, large_send = 0; |
3149 | 3095 | ||
3150 | QETH_DBF_TEXT(TRACE, 6, "qdfillbf"); | ||
3151 | |||
3152 | buffer = buf->buffer; | 3096 | buffer = buf->buffer; |
3153 | atomic_inc(&skb->users); | 3097 | atomic_inc(&skb->users); |
3154 | skb_queue_tail(&buf->skb_list, skb); | 3098 | skb_queue_tail(&buf->skb_list, skb); |
@@ -3207,8 +3151,6 @@ int qeth_do_send_packet_fast(struct qeth_card *card, | |||
3207 | int flush_cnt = 0; | 3151 | int flush_cnt = 0; |
3208 | int index; | 3152 | int index; |
3209 | 3153 | ||
3210 | QETH_DBF_TEXT(TRACE, 6, "dosndpfa"); | ||
3211 | |||
3212 | /* spin until we get the queue ... */ | 3154 | /* spin until we get the queue ... */ |
3213 | while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, | 3155 | while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, |
3214 | QETH_OUT_Q_LOCKED) != QETH_OUT_Q_UNLOCKED); | 3156 | QETH_OUT_Q_LOCKED) != QETH_OUT_Q_UNLOCKED); |
@@ -3260,8 +3202,6 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue, | |||
3260 | int tmp; | 3202 | int tmp; |
3261 | int rc = 0; | 3203 | int rc = 0; |
3262 | 3204 | ||
3263 | QETH_DBF_TEXT(TRACE, 6, "dosndpkt"); | ||
3264 | |||
3265 | /* spin until we get the queue ... */ | 3205 | /* spin until we get the queue ... */ |
3266 | while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, | 3206 | while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, |
3267 | QETH_OUT_Q_LOCKED) != QETH_OUT_Q_UNLOCKED); | 3207 | QETH_OUT_Q_LOCKED) != QETH_OUT_Q_UNLOCKED); |
@@ -3958,7 +3898,6 @@ struct sk_buff *qeth_core_get_next_skb(struct qeth_card *card, | |||
3958 | int use_rx_sg = 0; | 3898 | int use_rx_sg = 0; |
3959 | int frag = 0; | 3899 | int frag = 0; |
3960 | 3900 | ||
3961 | QETH_DBF_TEXT(TRACE, 6, "nextskb"); | ||
3962 | /* qeth_hdr must not cross element boundaries */ | 3901 | /* qeth_hdr must not cross element boundaries */ |
3963 | if (element->length < offset + sizeof(struct qeth_hdr)) { | 3902 | if (element->length < offset + sizeof(struct qeth_hdr)) { |
3964 | if (qeth_is_last_sbale(element)) | 3903 | if (qeth_is_last_sbale(element)) |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index e6092829a5a9..ef07e9cadfc1 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -632,8 +632,6 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
632 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; | 632 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; |
633 | struct qeth_eddp_context *ctx = NULL; | 633 | struct qeth_eddp_context *ctx = NULL; |
634 | 634 | ||
635 | QETH_DBF_TEXT(TRACE, 6, "l2xmit"); | ||
636 | |||
637 | if ((card->state != CARD_STATE_UP) || !card->lan_online) { | 635 | if ((card->state != CARD_STATE_UP) || !card->lan_online) { |
638 | card->stats.tx_carrier_errors++; | 636 | card->stats.tx_carrier_errors++; |
639 | goto tx_drop; | 637 | goto tx_drop; |
@@ -655,9 +653,12 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
655 | if (card->info.type == QETH_CARD_TYPE_OSN) | 653 | if (card->info.type == QETH_CARD_TYPE_OSN) |
656 | hdr = (struct qeth_hdr *)skb->data; | 654 | hdr = (struct qeth_hdr *)skb->data; |
657 | else { | 655 | else { |
658 | new_skb = qeth_prepare_skb(card, skb, &hdr); | 656 | /* create a clone with writeable headroom */ |
657 | new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr)); | ||
659 | if (!new_skb) | 658 | if (!new_skb) |
660 | goto tx_drop; | 659 | goto tx_drop; |
660 | hdr = (struct qeth_hdr *)skb_push(new_skb, | ||
661 | sizeof(struct qeth_hdr)); | ||
661 | qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); | 662 | qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); |
662 | } | 663 | } |
663 | 664 | ||
@@ -744,7 +745,6 @@ static void qeth_l2_qdio_input_handler(struct ccw_device *ccwdev, | |||
744 | int index; | 745 | int index; |
745 | int i; | 746 | int i; |
746 | 747 | ||
747 | QETH_DBF_TEXT(TRACE, 6, "qdinput"); | ||
748 | card = (struct qeth_card *) card_ptr; | 748 | card = (struct qeth_card *) card_ptr; |
749 | net_dev = card->dev; | 749 | net_dev = card->dev; |
750 | if (card->options.performance_stats) { | 750 | if (card->options.performance_stats) { |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index ce23169587e4..50545a1f6b3b 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -2557,8 +2557,6 @@ static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
2557 | static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | 2557 | static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, |
2558 | struct sk_buff *skb, int ipv, int cast_type) | 2558 | struct sk_buff *skb, int ipv, int cast_type) |
2559 | { | 2559 | { |
2560 | QETH_DBF_TEXT(TRACE, 6, "fillhdr"); | ||
2561 | |||
2562 | memset(hdr, 0, sizeof(struct qeth_hdr)); | 2560 | memset(hdr, 0, sizeof(struct qeth_hdr)); |
2563 | hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3; | 2561 | hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3; |
2564 | hdr->hdr.l3.ext_flags = 0; | 2562 | hdr->hdr.l3.ext_flags = 0; |
@@ -2637,8 +2635,6 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2637 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; | 2635 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; |
2638 | struct qeth_eddp_context *ctx = NULL; | 2636 | struct qeth_eddp_context *ctx = NULL; |
2639 | 2637 | ||
2640 | QETH_DBF_TEXT(TRACE, 6, "l3xmit"); | ||
2641 | |||
2642 | if ((card->info.type == QETH_CARD_TYPE_IQD) && | 2638 | if ((card->info.type == QETH_CARD_TYPE_IQD) && |
2643 | (skb->protocol != htons(ETH_P_IPV6)) && | 2639 | (skb->protocol != htons(ETH_P_IPV6)) && |
2644 | (skb->protocol != htons(ETH_P_IP))) | 2640 | (skb->protocol != htons(ETH_P_IP))) |
@@ -2982,7 +2978,6 @@ static void qeth_l3_qdio_input_handler(struct ccw_device *ccwdev, | |||
2982 | int index; | 2978 | int index; |
2983 | int i; | 2979 | int i; |
2984 | 2980 | ||
2985 | QETH_DBF_TEXT(TRACE, 6, "qdinput"); | ||
2986 | card = (struct qeth_card *) card_ptr; | 2981 | card = (struct qeth_card *) card_ptr; |
2987 | net_dev = card->dev; | 2982 | net_dev = card->dev; |
2988 | if (card->options.performance_stats) { | 2983 | if (card->options.performance_stats) { |