diff options
Diffstat (limited to 'target/linux/layerscape/patches-5.4/701-net-0217-dpaa2-eth-Don-t-use-netif_receive_skb_list-for-TCP-f.patch')
-rw-r--r-- | target/linux/layerscape/patches-5.4/701-net-0217-dpaa2-eth-Don-t-use-netif_receive_skb_list-for-TCP-f.patch | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/target/linux/layerscape/patches-5.4/701-net-0217-dpaa2-eth-Don-t-use-netif_receive_skb_list-for-TCP-f.patch b/target/linux/layerscape/patches-5.4/701-net-0217-dpaa2-eth-Don-t-use-netif_receive_skb_list-for-TCP-f.patch new file mode 100644 index 0000000000..74b4b6d3c0 --- /dev/null +++ b/target/linux/layerscape/patches-5.4/701-net-0217-dpaa2-eth-Don-t-use-netif_receive_skb_list-for-TCP-f.patch @@ -0,0 +1,125 @@ +From 01e74b70dd8183aa191cd594ec9fa2879357811f Mon Sep 17 00:00:00 2001 +From: Ioana Radulescu <ruxandra.radulescu@nxp.com> +Date: Mon, 22 Jul 2019 18:52:39 +0300 +Subject: [PATCH] dpaa2-eth: Don't use netif_receive_skb_list for TCP frames + +Using Rx skb bulking for all frames may negatively impact the +performance in some TCP termination scenarios, as it effectively +bypasses GRO. + +Look at the hardware parse results of each ingress frame to see +if a TCP header is present or not; for TCP frames fall back to +the old implementation. + +Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> +Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 15 ++++++- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 51 ++++++++++++++++++++++++ + 2 files changed, 65 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -353,6 +353,16 @@ out: + return xdp_act; + } + ++static bool frame_is_tcp(const struct dpaa2_fd *fd, struct dpaa2_fas *fas) ++{ ++ struct dpaa2_fapr *fapr = dpaa2_get_fapr(fas, false); ++ ++ if (!(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FAPRV)) ++ return false; ++ ++ return !!(fapr->faf_hi & DPAA2_FAF_HI_TCP_PRESENT); ++} ++ + /* Main Rx frame processing routine */ + static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv, + struct dpaa2_eth_channel *ch, +@@ -440,7 +450,10 @@ static void dpaa2_eth_rx(struct dpaa2_et + percpu_stats->rx_packets++; + percpu_stats->rx_bytes += dpaa2_fd_get_len(fd); + +- list_add_tail(&skb->list, ch->rx_list); ++ if (frame_is_tcp(fd, fas)) ++ napi_gro_receive(&ch->napi, skb); ++ else ++ list_add_tail(&skb->list, ch->rx_list); + + return; + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +@@ -178,6 +178,49 @@ struct dpaa2_fas { + */ + #define DPAA2_TS_OFFSET 0x8 + ++/* Frame annotation parse results */ ++struct dpaa2_fapr { ++ /* 64-bit word 1 */ ++ __le32 faf_lo; ++ __le16 faf_ext; ++ __le16 nxt_hdr; ++ /* 64-bit word 2 */ ++ __le64 faf_hi; ++ /* 64-bit word 3 */ ++ u8 last_ethertype_offset; ++ u8 vlan_tci_offset_n; ++ u8 vlan_tci_offset_1; ++ u8 llc_snap_offset; ++ u8 eth_offset; ++ u8 ip1_pid_offset; ++ u8 shim_offset_2; ++ u8 shim_offset_1; ++ /* 64-bit word 4 */ ++ u8 l5_offset; ++ u8 l4_offset; ++ u8 gre_offset; ++ u8 l3_offset_n; ++ u8 l3_offset_1; ++ u8 mpls_offset_n; ++ u8 mpls_offset_1; ++ u8 pppoe_offset; ++ /* 64-bit word 5 */ ++ __le16 running_sum; ++ __le16 gross_running_sum; ++ u8 ipv6_frag_offset; ++ u8 nxt_hdr_offset; ++ u8 routing_hdr_offset_2; ++ u8 routing_hdr_offset_1; ++ /* 64-bit word 6 */ ++ u8 reserved[5]; /* Soft-parsing context */ ++ u8 ip_proto_offset_n; ++ u8 nxt_hdr_frag_offset; ++ u8 parse_error_code; ++}; ++ ++#define DPAA2_FAPR_OFFSET 0x10 ++#define DPAA2_FAPR_SIZE sizeof((struct dpaa2_fapr)) ++ + /* Frame annotation egress action descriptor */ + #define DPAA2_FAEAD_OFFSET 0x58 + +@@ -208,6 +251,11 @@ static inline __le64 *dpaa2_get_ts(void + return dpaa2_get_hwa(buf_addr, swa) + DPAA2_TS_OFFSET; + } + ++static inline struct dpaa2_fapr *dpaa2_get_fapr(void *buf_addr, bool swa) ++{ ++ return dpaa2_get_hwa(buf_addr, swa) + DPAA2_FAPR_OFFSET; ++} ++ + static inline struct dpaa2_faead *dpaa2_get_faead(void *buf_addr, bool swa) + { + return dpaa2_get_hwa(buf_addr, swa) + DPAA2_FAEAD_OFFSET; +@@ -259,6 +307,9 @@ static inline struct dpaa2_faead *dpaa2_ + DPAA2_FAS_L3CE | \ + DPAA2_FAS_L4CE) + ++/* TCP indication in Frame Annotation Parse Results */ ++#define DPAA2_FAF_HI_TCP_PRESENT BIT(23) ++ + /* Time in milliseconds between link state updates */ + #define DPAA2_ETH_LINK_STATE_REFRESH 1000 + |