.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Networking over Thunderbolt cable using Apple ThunderboltIP protocol |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Authors: Amir Levy <amir.jer.levy@intel.com> |
---|
6 | 7 | * Michael Jamet <michael.jamet@intel.com> |
---|
7 | 8 | * Mika Westerberg <mika.westerberg@linux.intel.com> |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License version 2 as |
---|
11 | | - * published by the Free Software Foundation. |
---|
12 | 9 | */ |
---|
13 | 10 | |
---|
14 | 11 | #include <linux/atomic.h> |
---|
.. | .. |
---|
869 | 866 | eof_mask = BIT(TBIP_PDF_FRAME_END); |
---|
870 | 867 | |
---|
871 | 868 | ring = tb_ring_alloc_rx(xd->tb->nhi, -1, TBNET_RING_SIZE, |
---|
872 | | - RING_FLAG_FRAME | RING_FLAG_E2E, sof_mask, |
---|
873 | | - eof_mask, tbnet_start_poll, net); |
---|
| 869 | + RING_FLAG_FRAME, sof_mask, eof_mask, |
---|
| 870 | + tbnet_start_poll, net); |
---|
874 | 871 | if (!ring) { |
---|
875 | 872 | netdev_err(dev, "failed to allocate Rx ring\n"); |
---|
876 | 873 | tb_ring_free(net->tx_ring.ring); |
---|
.. | .. |
---|
961 | 958 | *tucso = ~csum_tcpudp_magic(ip_hdr(skb)->saddr, |
---|
962 | 959 | ip_hdr(skb)->daddr, 0, |
---|
963 | 960 | ip_hdr(skb)->protocol, 0); |
---|
964 | | - } else if (skb_is_gso_v6(skb)) { |
---|
| 961 | + } else if (skb_is_gso(skb) && skb_is_gso_v6(skb)) { |
---|
965 | 962 | tucso = dest + ((void *)&(tcp_hdr(skb)->check) - data); |
---|
966 | 963 | *tucso = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
---|
967 | 964 | &ipv6_hdr(skb)->daddr, 0, |
---|
968 | 965 | IPPROTO_TCP, 0); |
---|
969 | | - return false; |
---|
970 | 966 | } else if (protocol == htons(ETH_P_IPV6)) { |
---|
971 | 967 | tucso = dest + skb_checksum_start_offset(skb) + skb->csum_offset; |
---|
972 | 968 | *tucso = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
---|
.. | .. |
---|
1008 | 1004 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[frag_num]; |
---|
1009 | 1005 | |
---|
1010 | 1006 | *len = skb_frag_size(frag); |
---|
1011 | | - return kmap_atomic(skb_frag_page(frag)) + frag->page_offset; |
---|
| 1007 | + return kmap_atomic(skb_frag_page(frag)) + skb_frag_off(frag); |
---|
1012 | 1008 | } |
---|
1013 | 1009 | |
---|
1014 | 1010 | static netdev_tx_t tbnet_start_xmit(struct sk_buff *skb, |
---|
.. | .. |
---|
1338 | 1334 | tb_property_add_immediate(tbnet_dir, "prtcid", 1); |
---|
1339 | 1335 | tb_property_add_immediate(tbnet_dir, "prtcvers", 1); |
---|
1340 | 1336 | tb_property_add_immediate(tbnet_dir, "prtcrevs", 1); |
---|
| 1337 | + /* Currently only announce support for match frags ID (bit 1). Bit 0 |
---|
| 1338 | + * is reserved for full E2E flow control which we do not support at |
---|
| 1339 | + * the moment. |
---|
| 1340 | + */ |
---|
1341 | 1341 | tb_property_add_immediate(tbnet_dir, "prtcstns", |
---|
1342 | 1342 | TBNET_MATCH_FRAGS_ID); |
---|
1343 | 1343 | |
---|
1344 | 1344 | ret = tb_register_property_dir("network", tbnet_dir); |
---|
1345 | | - if (ret) { |
---|
1346 | | - tb_property_free_dir(tbnet_dir); |
---|
1347 | | - return ret; |
---|
1348 | | - } |
---|
| 1345 | + if (ret) |
---|
| 1346 | + goto err_free_dir; |
---|
1349 | 1347 | |
---|
1350 | | - return tb_register_service_driver(&tbnet_driver); |
---|
| 1348 | + ret = tb_register_service_driver(&tbnet_driver); |
---|
| 1349 | + if (ret) |
---|
| 1350 | + goto err_unregister; |
---|
| 1351 | + |
---|
| 1352 | + return 0; |
---|
| 1353 | + |
---|
| 1354 | +err_unregister: |
---|
| 1355 | + tb_unregister_property_dir("network", tbnet_dir); |
---|
| 1356 | +err_free_dir: |
---|
| 1357 | + tb_property_free_dir(tbnet_dir); |
---|
| 1358 | + |
---|
| 1359 | + return ret; |
---|
1351 | 1360 | } |
---|
1352 | 1361 | module_init(tbnet_init); |
---|
1353 | 1362 | |
---|