|
34 | 34 | #define TBNET_RING_SIZE 256 |
35 | 35 | #define TBNET_LOGIN_RETRIES 60 |
36 | 36 | #define TBNET_LOGOUT_RETRIES 10 |
| 37 | +#define TBNET_THROTTLING 128000 |
37 | 38 | #define TBNET_E2E BIT(0) |
38 | 39 | #define TBNET_MATCH_FRAGS_ID BIT(1) |
39 | 40 | #define TBNET_64K_FRAMES BIT(2) |
40 | 41 | #define TBNET_MAX_MTU SZ_64K |
41 | | -#define TBNET_FRAME_SIZE SZ_4K |
| 42 | +#define TBNET_FRAME_SIZE TB_MAX_FRAME_SIZE |
42 | 43 | #define TBNET_MAX_PAYLOAD_SIZE \ |
43 | 44 | (TBNET_FRAME_SIZE - sizeof(struct thunderbolt_ip_frame_header)) |
44 | 45 | /* Rx packets need to hold space for skb_shared_info */ |
@@ -327,11 +328,6 @@ static void stop_login(struct tbnet *net) |
327 | 328 | netdev_dbg(net->dev, "login stopped\n"); |
328 | 329 | } |
329 | 330 |
|
330 | | -static inline unsigned int tbnet_frame_size(const struct tbnet_frame *tf) |
331 | | -{ |
332 | | - return tf->frame.size ? : TBNET_FRAME_SIZE; |
333 | | -} |
334 | | - |
335 | 331 | static void tbnet_free_buffers(struct tbnet_ring *ring) |
336 | 332 | { |
337 | 333 | unsigned int i; |
@@ -562,7 +558,7 @@ static struct tbnet_frame *tbnet_get_tx_buffer(struct tbnet *net) |
562 | 558 | tf->frame.size = 0; |
563 | 559 |
|
564 | 560 | dma_sync_single_for_cpu(dma_dev, tf->frame.buffer_phy, |
565 | | - tbnet_frame_size(tf), DMA_TO_DEVICE); |
| 561 | + tb_ring_frame_size(&tf->frame), DMA_TO_DEVICE); |
566 | 562 |
|
567 | 563 | return tf; |
568 | 564 | } |
@@ -744,7 +740,7 @@ static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf, |
744 | 740 | } |
745 | 741 |
|
746 | 742 | /* Should be greater than just header i.e. contains data */ |
747 | | - size = tbnet_frame_size(tf); |
| 743 | + size = tb_ring_frame_size(&tf->frame); |
748 | 744 | if (size <= sizeof(*hdr)) { |
749 | 745 | net->stats.rx_length_errors++; |
750 | 746 | return false; |
@@ -961,6 +957,9 @@ static int tbnet_open(struct net_device *dev) |
961 | 957 | } |
962 | 958 | net->rx_ring.ring = ring; |
963 | 959 |
|
| 960 | + tb_ring_throttling(net->tx_ring.ring, TBNET_THROTTLING); |
| 961 | + tb_ring_throttling(net->rx_ring.ring, TBNET_THROTTLING); |
| 962 | + |
964 | 963 | napi_enable(&net->napi); |
965 | 964 | start_login(net); |
966 | 965 |
|
@@ -1011,7 +1010,8 @@ static bool tbnet_xmit_csum_and_map(struct tbnet *net, struct sk_buff *skb, |
1011 | 1010 | hdr->frame_index, hdr->frame_count); |
1012 | 1011 | dma_sync_single_for_device(dma_dev, |
1013 | 1012 | frames[i]->frame.buffer_phy, |
1014 | | - tbnet_frame_size(frames[i]), DMA_TO_DEVICE); |
| 1013 | + tb_ring_frame_size(&frames[i]->frame), |
| 1014 | + DMA_TO_DEVICE); |
1015 | 1015 | } |
1016 | 1016 |
|
1017 | 1017 | return true; |
@@ -1085,7 +1085,7 @@ static bool tbnet_xmit_csum_and_map(struct tbnet *net, struct sk_buff *skb, |
1085 | 1085 | */ |
1086 | 1086 | for (i = 0; i < frame_count; i++) { |
1087 | 1087 | dma_sync_single_for_device(dma_dev, frames[i]->frame.buffer_phy, |
1088 | | - tbnet_frame_size(frames[i]), DMA_TO_DEVICE); |
| 1088 | + tb_ring_frame_size(&frames[i]->frame), DMA_TO_DEVICE); |
1089 | 1089 | } |
1090 | 1090 |
|
1091 | 1091 | return true; |
|
0 commit comments