diff options
Diffstat (limited to 'drivers/s390/net/qeth.h')
| -rw-r--r-- | drivers/s390/net/qeth.h | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index 619f4a0c7160..821383d8cbe7 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h | |||
| @@ -176,7 +176,6 @@ extern struct ccwgroup_driver qeth_ccwgroup_driver; | |||
| 176 | /** | 176 | /** |
| 177 | * card stuff | 177 | * card stuff |
| 178 | */ | 178 | */ |
| 179 | #ifdef CONFIG_QETH_PERF_STATS | ||
| 180 | struct qeth_perf_stats { | 179 | struct qeth_perf_stats { |
| 181 | unsigned int bufs_rec; | 180 | unsigned int bufs_rec; |
| 182 | unsigned int bufs_sent; | 181 | unsigned int bufs_sent; |
| @@ -211,8 +210,10 @@ struct qeth_perf_stats { | |||
| 211 | unsigned int large_send_cnt; | 210 | unsigned int large_send_cnt; |
| 212 | unsigned int sg_skbs_sent; | 211 | unsigned int sg_skbs_sent; |
| 213 | unsigned int sg_frags_sent; | 212 | unsigned int sg_frags_sent; |
| 213 | /* initial values when measuring starts */ | ||
| 214 | unsigned long initial_rx_packets; | ||
| 215 | unsigned long initial_tx_packets; | ||
| 214 | }; | 216 | }; |
| 215 | #endif /* CONFIG_QETH_PERF_STATS */ | ||
| 216 | 217 | ||
| 217 | /* Routing stuff */ | 218 | /* Routing stuff */ |
| 218 | struct qeth_routing_info { | 219 | struct qeth_routing_info { |
| @@ -462,6 +463,7 @@ enum qeth_qdio_info_states { | |||
| 462 | QETH_QDIO_UNINITIALIZED, | 463 | QETH_QDIO_UNINITIALIZED, |
| 463 | QETH_QDIO_ALLOCATED, | 464 | QETH_QDIO_ALLOCATED, |
| 464 | QETH_QDIO_ESTABLISHED, | 465 | QETH_QDIO_ESTABLISHED, |
| 466 | QETH_QDIO_CLEANING | ||
| 465 | }; | 467 | }; |
| 466 | 468 | ||
| 467 | struct qeth_buffer_pool_entry { | 469 | struct qeth_buffer_pool_entry { |
| @@ -536,7 +538,7 @@ struct qeth_qdio_out_q { | |||
| 536 | } __attribute__ ((aligned(256))); | 538 | } __attribute__ ((aligned(256))); |
| 537 | 539 | ||
| 538 | struct qeth_qdio_info { | 540 | struct qeth_qdio_info { |
| 539 | volatile enum qeth_qdio_info_states state; | 541 | atomic_t state; |
| 540 | /* input */ | 542 | /* input */ |
| 541 | struct qeth_qdio_q *in_q; | 543 | struct qeth_qdio_q *in_q; |
| 542 | struct qeth_qdio_buffer_pool in_buf_pool; | 544 | struct qeth_qdio_buffer_pool in_buf_pool; |
| @@ -767,6 +769,7 @@ struct qeth_card_options { | |||
| 767 | int fake_ll; | 769 | int fake_ll; |
| 768 | int layer2; | 770 | int layer2; |
| 769 | enum qeth_large_send_types large_send; | 771 | enum qeth_large_send_types large_send; |
| 772 | int performance_stats; | ||
| 770 | }; | 773 | }; |
| 771 | 774 | ||
| 772 | /* | 775 | /* |
| @@ -819,9 +822,7 @@ struct qeth_card { | |||
| 819 | struct list_head cmd_waiter_list; | 822 | struct list_head cmd_waiter_list; |
| 820 | /* QDIO buffer handling */ | 823 | /* QDIO buffer handling */ |
| 821 | struct qeth_qdio_info qdio; | 824 | struct qeth_qdio_info qdio; |
| 822 | #ifdef CONFIG_QETH_PERF_STATS | ||
| 823 | struct qeth_perf_stats perf_stats; | 825 | struct qeth_perf_stats perf_stats; |
| 824 | #endif /* CONFIG_QETH_PERF_STATS */ | ||
| 825 | int use_hard_stop; | 826 | int use_hard_stop; |
| 826 | int (*orig_hard_header)(struct sk_buff *,struct net_device *, | 827 | int (*orig_hard_header)(struct sk_buff *,struct net_device *, |
| 827 | unsigned short,void *,void *,unsigned); | 828 | unsigned short,void *,void *,unsigned); |
| @@ -859,23 +860,18 @@ qeth_get_ipa_adp_type(enum qeth_link_types link_type) | |||
| 859 | } | 860 | } |
| 860 | } | 861 | } |
| 861 | 862 | ||
| 862 | static inline int | 863 | static inline struct sk_buff * |
| 863 | qeth_realloc_headroom(struct qeth_card *card, struct sk_buff **skb, int size) | 864 | qeth_realloc_headroom(struct qeth_card *card, struct sk_buff *skb, int size) |
| 864 | { | 865 | { |
| 865 | struct sk_buff *new_skb = NULL; | 866 | struct sk_buff *new_skb = skb; |
| 866 | 867 | ||
| 867 | if (skb_headroom(*skb) < size){ | 868 | if (skb_headroom(skb) >= size) |
| 868 | new_skb = skb_realloc_headroom(*skb, size); | 869 | return skb; |
| 869 | if (!new_skb) { | 870 | new_skb = skb_realloc_headroom(skb, size); |
| 870 | PRINT_ERR("qeth_prepare_skb: could " | 871 | if (!new_skb) |
| 871 | "not realloc headroom for qeth_hdr " | 872 | PRINT_ERR("Could not realloc headroom for qeth_hdr " |
| 872 | "on interface %s", QETH_CARD_IFNAME(card)); | 873 | "on interface %s", QETH_CARD_IFNAME(card)); |
| 873 | return -ENOMEM; | 874 | return new_skb; |
| 874 | } | ||
| 875 | kfree_skb(*skb); | ||
| 876 | *skb = new_skb; | ||
| 877 | } | ||
| 878 | return 0; | ||
| 879 | } | 875 | } |
| 880 | 876 | ||
| 881 | static inline struct sk_buff * | 877 | static inline struct sk_buff * |
| @@ -885,16 +881,15 @@ qeth_pskb_unshare(struct sk_buff *skb, int pri) | |||
| 885 | if (!skb_cloned(skb)) | 881 | if (!skb_cloned(skb)) |
| 886 | return skb; | 882 | return skb; |
| 887 | nskb = skb_copy(skb, pri); | 883 | nskb = skb_copy(skb, pri); |
| 888 | kfree_skb(skb); /* free our shared copy */ | ||
| 889 | return nskb; | 884 | return nskb; |
| 890 | } | 885 | } |
| 891 | 886 | ||
| 892 | static inline void * | 887 | static inline void * |
| 893 | qeth_push_skb(struct qeth_card *card, struct sk_buff **skb, int size) | 888 | qeth_push_skb(struct qeth_card *card, struct sk_buff *skb, int size) |
| 894 | { | 889 | { |
| 895 | void *hdr; | 890 | void *hdr; |
| 896 | 891 | ||
| 897 | hdr = (void *) skb_push(*skb, size); | 892 | hdr = (void *) skb_push(skb, size); |
| 898 | /* | 893 | /* |
| 899 | * sanity check, the Linux memory allocation scheme should | 894 | * sanity check, the Linux memory allocation scheme should |
| 900 | * never present us cases like this one (the qdio header size plus | 895 | * never present us cases like this one (the qdio header size plus |
| @@ -903,8 +898,7 @@ qeth_push_skb(struct qeth_card *card, struct sk_buff **skb, int size) | |||
| 903 | if ((((unsigned long) hdr) & (~(PAGE_SIZE - 1))) != | 898 | if ((((unsigned long) hdr) & (~(PAGE_SIZE - 1))) != |
| 904 | (((unsigned long) hdr + size + | 899 | (((unsigned long) hdr + size + |
| 905 | QETH_IP_HEADER_SIZE) & (~(PAGE_SIZE - 1)))) { | 900 | QETH_IP_HEADER_SIZE) & (~(PAGE_SIZE - 1)))) { |
| 906 | PRINT_ERR("qeth_prepare_skb: misaligned " | 901 | PRINT_ERR("Misaligned packet on interface %s. Discarded.", |
| 907 | "packet on interface %s. Discarded.", | ||
| 908 | QETH_CARD_IFNAME(card)); | 902 | QETH_CARD_IFNAME(card)); |
| 909 | return NULL; | 903 | return NULL; |
| 910 | } | 904 | } |
| @@ -1056,13 +1050,11 @@ qeth_get_arphdr_type(int cardtype, int linktype) | |||
| 1056 | } | 1050 | } |
| 1057 | } | 1051 | } |
| 1058 | 1052 | ||
| 1059 | #ifdef CONFIG_QETH_PERF_STATS | ||
| 1060 | static inline int | 1053 | static inline int |
| 1061 | qeth_get_micros(void) | 1054 | qeth_get_micros(void) |
| 1062 | { | 1055 | { |
| 1063 | return (int) (get_clock() >> 12); | 1056 | return (int) (get_clock() >> 12); |
| 1064 | } | 1057 | } |
| 1065 | #endif | ||
| 1066 | 1058 | ||
| 1067 | static inline int | 1059 | static inline int |
| 1068 | qeth_get_qdio_q_format(struct qeth_card *card) | 1060 | qeth_get_qdio_q_format(struct qeth_card *card) |
| @@ -1096,10 +1088,11 @@ qeth_string_to_ipaddr4(const char *buf, __u8 *addr) | |||
| 1096 | { | 1088 | { |
| 1097 | int count = 0, rc = 0; | 1089 | int count = 0, rc = 0; |
| 1098 | int in[4]; | 1090 | int in[4]; |
| 1091 | char c; | ||
| 1099 | 1092 | ||
| 1100 | rc = sscanf(buf, "%d.%d.%d.%d%n", | 1093 | rc = sscanf(buf, "%u.%u.%u.%u%c", |
| 1101 | &in[0], &in[1], &in[2], &in[3], &count); | 1094 | &in[0], &in[1], &in[2], &in[3], &c); |
| 1102 | if (rc != 4 || count<=0) | 1095 | if (rc != 4 && (rc != 5 || c != '\n')) |
| 1103 | return -EINVAL; | 1096 | return -EINVAL; |
| 1104 | for (count = 0; count < 4; count++) { | 1097 | for (count = 0; count < 4; count++) { |
| 1105 | if (in[count] > 255) | 1098 | if (in[count] > 255) |
| @@ -1123,24 +1116,28 @@ qeth_ipaddr6_to_string(const __u8 *addr, char *buf) | |||
| 1123 | static inline int | 1116 | static inline int |
| 1124 | qeth_string_to_ipaddr6(const char *buf, __u8 *addr) | 1117 | qeth_string_to_ipaddr6(const char *buf, __u8 *addr) |
| 1125 | { | 1118 | { |
| 1126 | char *end, *start; | 1119 | const char *end, *end_tmp, *start; |
| 1127 | __u16 *in; | 1120 | __u16 *in; |
| 1128 | char num[5]; | 1121 | char num[5]; |
| 1129 | int num2, cnt, out, found, save_cnt; | 1122 | int num2, cnt, out, found, save_cnt; |
| 1130 | unsigned short in_tmp[8] = {0, }; | 1123 | unsigned short in_tmp[8] = {0, }; |
| 1131 | 1124 | ||
| 1132 | cnt = out = found = save_cnt = num2 = 0; | 1125 | cnt = out = found = save_cnt = num2 = 0; |
| 1133 | end = start = (char *) buf; | 1126 | end = start = buf; |
| 1134 | in = (__u16 *) addr; | 1127 | in = (__u16 *) addr; |
| 1135 | memset(in, 0, 16); | 1128 | memset(in, 0, 16); |
| 1136 | while (end) { | 1129 | while (*end) { |
| 1137 | end = strchr(end,':'); | 1130 | end = strchr(start,':'); |
| 1138 | if (end == NULL) { | 1131 | if (end == NULL) { |
| 1139 | end = (char *)buf + (strlen(buf)); | 1132 | end = buf + strlen(buf); |
| 1140 | out = 1; | 1133 | if ((end_tmp = strchr(start, '\n')) != NULL) |
| 1134 | end = end_tmp; | ||
| 1135 | out = 1; | ||
| 1141 | } | 1136 | } |
| 1142 | if ((end - start)) { | 1137 | if ((end - start)) { |
| 1143 | memset(num, 0, 5); | 1138 | memset(num, 0, 5); |
| 1139 | if ((end - start) > 4) | ||
| 1140 | return -EINVAL; | ||
| 1144 | memcpy(num, start, end - start); | 1141 | memcpy(num, start, end - start); |
| 1145 | if (!qeth_isxdigit(num)) | 1142 | if (!qeth_isxdigit(num)) |
| 1146 | return -EINVAL; | 1143 | return -EINVAL; |
| @@ -1158,6 +1155,8 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr) | |||
| 1158 | } | 1155 | } |
| 1159 | start = ++end; | 1156 | start = ++end; |
| 1160 | } | 1157 | } |
| 1158 | if (cnt + save_cnt > 8) | ||
| 1159 | return -EINVAL; | ||
| 1161 | cnt = 7; | 1160 | cnt = 7; |
| 1162 | while (save_cnt) | 1161 | while (save_cnt) |
| 1163 | in[cnt--] = in_tmp[--save_cnt]; | 1162 | in[cnt--] = in_tmp[--save_cnt]; |
