ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0217-dpaa2-eth-Don-t-use-netif_receive_skb_list-for-TCP-f.patch
1 From 01e74b70dd8183aa191cd594ec9fa2879357811f Mon Sep 17 00:00:00 2001
2 From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
3 Date: Mon, 22 Jul 2019 18:52:39 +0300
4 Subject: [PATCH] dpaa2-eth: Don't use netif_receive_skb_list for TCP frames
5
6 Using Rx skb bulking for all frames may negatively impact the
7 performance in some TCP termination scenarios, as it effectively
8 bypasses GRO.
9
10 Look at the hardware parse results of each ingress frame to see
11 if a TCP header is present or not; for TCP frames fall back to
12 the old implementation.
13
14 Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
15 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
16 ---
17  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 15 ++++++-
18  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 51 ++++++++++++++++++++++++
19  2 files changed, 65 insertions(+), 1 deletion(-)
20
21 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
22 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
23 @@ -353,6 +353,16 @@ out:
24         return xdp_act;
25  }
26  
27 +static bool frame_is_tcp(const struct dpaa2_fd *fd, struct dpaa2_fas *fas)
28 +{
29 +       struct dpaa2_fapr *fapr = dpaa2_get_fapr(fas, false);
30 +
31 +       if (!(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FAPRV))
32 +               return false;
33 +
34 +       return !!(fapr->faf_hi & DPAA2_FAF_HI_TCP_PRESENT);
35 +}
36 +
37  /* Main Rx frame processing routine */
38  static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv,
39                          struct dpaa2_eth_channel *ch,
40 @@ -440,7 +450,10 @@ static void dpaa2_eth_rx(struct dpaa2_et
41         percpu_stats->rx_packets++;
42         percpu_stats->rx_bytes += dpaa2_fd_get_len(fd);
43  
44 -       list_add_tail(&skb->list, ch->rx_list);
45 +       if (frame_is_tcp(fd, fas))
46 +               napi_gro_receive(&ch->napi, skb);
47 +       else
48 +               list_add_tail(&skb->list, ch->rx_list);
49  
50         return;
51  
52 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
53 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
54 @@ -178,6 +178,49 @@ struct dpaa2_fas {
55   */
56  #define DPAA2_TS_OFFSET                        0x8
57  
58 +/* Frame annotation parse results */
59 +struct dpaa2_fapr {
60 +       /* 64-bit word 1 */
61 +       __le32 faf_lo;
62 +       __le16 faf_ext;
63 +       __le16 nxt_hdr;
64 +       /* 64-bit word 2 */
65 +       __le64 faf_hi;
66 +       /* 64-bit word 3 */
67 +       u8 last_ethertype_offset;
68 +       u8 vlan_tci_offset_n;
69 +       u8 vlan_tci_offset_1;
70 +       u8 llc_snap_offset;
71 +       u8 eth_offset;
72 +       u8 ip1_pid_offset;
73 +       u8 shim_offset_2;
74 +       u8 shim_offset_1;
75 +       /* 64-bit word 4 */
76 +       u8 l5_offset;
77 +       u8 l4_offset;
78 +       u8 gre_offset;
79 +       u8 l3_offset_n;
80 +       u8 l3_offset_1;
81 +       u8 mpls_offset_n;
82 +       u8 mpls_offset_1;
83 +       u8 pppoe_offset;
84 +       /* 64-bit word 5 */
85 +       __le16 running_sum;
86 +       __le16 gross_running_sum;
87 +       u8 ipv6_frag_offset;
88 +       u8 nxt_hdr_offset;
89 +       u8 routing_hdr_offset_2;
90 +       u8 routing_hdr_offset_1;
91 +       /* 64-bit word 6 */
92 +       u8 reserved[5]; /* Soft-parsing context */
93 +       u8 ip_proto_offset_n;
94 +       u8 nxt_hdr_frag_offset;
95 +       u8 parse_error_code;
96 +};
97 +
98 +#define DPAA2_FAPR_OFFSET              0x10
99 +#define DPAA2_FAPR_SIZE                        sizeof((struct dpaa2_fapr))
100 +
101  /* Frame annotation egress action descriptor */
102  #define DPAA2_FAEAD_OFFSET             0x58
103  
104 @@ -208,6 +251,11 @@ static inline __le64 *dpaa2_get_ts(void
105         return dpaa2_get_hwa(buf_addr, swa) + DPAA2_TS_OFFSET;
106  }
107  
108 +static inline struct dpaa2_fapr *dpaa2_get_fapr(void *buf_addr, bool swa)
109 +{
110 +       return dpaa2_get_hwa(buf_addr, swa) + DPAA2_FAPR_OFFSET;
111 +}
112 +
113  static inline struct dpaa2_faead *dpaa2_get_faead(void *buf_addr, bool swa)
114  {
115         return dpaa2_get_hwa(buf_addr, swa) + DPAA2_FAEAD_OFFSET;
116 @@ -259,6 +307,9 @@ static inline struct dpaa2_faead *dpaa2_
117                                          DPAA2_FAS_L3CE         | \
118                                          DPAA2_FAS_L4CE)
119  
120 +/* TCP indication in Frame Annotation Parse Results */
121 +#define DPAA2_FAF_HI_TCP_PRESENT       BIT(23)
122 +
123  /* Time in milliseconds between link state updates */
124  #define DPAA2_ETH_LINK_STATE_REFRESH   1000
125