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
6 Using Rx skb bulking for all frames may negatively impact the
7 performance in some TCP termination scenarios, as it effectively
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.
14 Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
15 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
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(-)
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:
27 +static bool frame_is_tcp(const struct dpaa2_fd *fd, struct dpaa2_fas *fas)
29 + struct dpaa2_fapr *fapr = dpaa2_get_fapr(fas, false);
31 + if (!(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FAPRV))
34 + return !!(fapr->faf_hi & DPAA2_FAF_HI_TCP_PRESENT);
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);
44 - list_add_tail(&skb->list, ch->rx_list);
45 + if (frame_is_tcp(fd, fas))
46 + napi_gro_receive(&ch->napi, skb);
48 + list_add_tail(&skb->list, ch->rx_list);
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 {
56 #define DPAA2_TS_OFFSET 0x8
58 +/* Frame annotation parse results */
67 + u8 last_ethertype_offset;
68 + u8 vlan_tci_offset_n;
69 + u8 vlan_tci_offset_1;
86 + __le16 gross_running_sum;
87 + u8 ipv6_frag_offset;
89 + u8 routing_hdr_offset_2;
90 + u8 routing_hdr_offset_1;
92 + u8 reserved[5]; /* Soft-parsing context */
93 + u8 ip_proto_offset_n;
94 + u8 nxt_hdr_frag_offset;
95 + u8 parse_error_code;
98 +#define DPAA2_FAPR_OFFSET 0x10
99 +#define DPAA2_FAPR_SIZE sizeof((struct dpaa2_fapr))
101 /* Frame annotation egress action descriptor */
102 #define DPAA2_FAEAD_OFFSET 0x58
104 @@ -208,6 +251,11 @@ static inline __le64 *dpaa2_get_ts(void
105 return dpaa2_get_hwa(buf_addr, swa) + DPAA2_TS_OFFSET;
108 +static inline struct dpaa2_fapr *dpaa2_get_fapr(void *buf_addr, bool swa)
110 + return dpaa2_get_hwa(buf_addr, swa) + DPAA2_FAPR_OFFSET;
113 static inline struct dpaa2_faead *dpaa2_get_faead(void *buf_addr, bool swa)
115 return dpaa2_get_hwa(buf_addr, swa) + DPAA2_FAEAD_OFFSET;
116 @@ -259,6 +307,9 @@ static inline struct dpaa2_faead *dpaa2_
120 +/* TCP indication in Frame Annotation Parse Results */
121 +#define DPAA2_FAF_HI_TCP_PRESENT BIT(23)
123 /* Time in milliseconds between link state updates */
124 #define DPAA2_ETH_LINK_STATE_REFRESH 1000