Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: renesas: rswitch: enable only used MFWD features

Currently, rswitch driver does not utilize most of MFWD forwarding
and processing features. It only uses port-based forwarding for ETHA
ports, and direct descriptor forwarding for GWCA port.

Update rswitch_fwd_init() to enable exactly that, and keep everything
else disabled.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Nikita Yushchenko and committed by
David S. Miller
54d39705 65fb414c

+28 -16
+20 -10
drivers/net/ethernet/renesas/rswitch.c
··· 111 111 /* Forwarding engine block (MFWD) */ 112 112 static void rswitch_fwd_init(struct rswitch_private *priv) 113 113 { 114 + u32 all_ports_mask = GENMASK(RSWITCH_NUM_AGENTS - 1, 0); 114 115 unsigned int i; 115 116 116 - /* For ETHA */ 117 - for (i = 0; i < RSWITCH_NUM_PORTS; i++) { 118 - iowrite32(FWPC0_DEFAULT, priv->addr + FWPC0(i)); 117 + /* Start with empty configuration */ 118 + for (i = 0; i < RSWITCH_NUM_AGENTS; i++) { 119 + /* Disable all port features */ 120 + iowrite32(0, priv->addr + FWPC0(i)); 121 + /* Disallow L3 forwarding and direct descriptor forwarding */ 122 + iowrite32(FIELD_PREP(FWCP1_LTHFW, all_ports_mask), 123 + priv->addr + FWPC1(i)); 124 + /* Disallow L2 forwarding */ 125 + iowrite32(FIELD_PREP(FWCP2_LTWFW, all_ports_mask), 126 + priv->addr + FWPC2(i)); 127 + /* Disallow port based forwarding */ 119 128 iowrite32(0, priv->addr + FWPBFC(i)); 120 129 } 121 130 122 - for (i = 0; i < RSWITCH_NUM_PORTS; i++) { 131 + /* For enabled ETHA ports, setup port based forwarding */ 132 + rswitch_for_each_enabled_port(priv, i) { 133 + /* Port based forwarding from port i to GWCA port */ 134 + rswitch_modify(priv->addr, FWPBFC(i), FWPBFC_PBDV, 135 + FIELD_PREP(FWPBFC_PBDV, BIT(priv->gwca.index))); 136 + /* Within GWCA port, forward to Rx queue for port i */ 123 137 iowrite32(priv->rdev[i]->rx_queue->index, 124 138 priv->addr + FWPBFCSDC(GWCA_INDEX, i)); 125 - iowrite32(BIT(priv->gwca.index), priv->addr + FWPBFC(i)); 126 139 } 127 140 128 - /* For GWCA */ 129 - iowrite32(FWPC0_DEFAULT, priv->addr + FWPC0(priv->gwca.index)); 130 - iowrite32(FWPC1_DDE, priv->addr + FWPC1(priv->gwca.index)); 131 - iowrite32(0, priv->addr + FWPBFC(priv->gwca.index)); 132 - iowrite32(GENMASK(RSWITCH_NUM_PORTS - 1, 0), priv->addr + FWPBFC(priv->gwca.index)); 141 + /* For GWCA port, allow direct descriptor forwarding */ 142 + rswitch_modify(priv->addr, FWPC1(priv->gwca.index), FWPC1_DDE, FWPC1_DDE); 133 143 } 134 144 135 145 /* Gateway CPU agent block (GWCA) */
+8 -6
drivers/net/ethernet/renesas/rswitch.h
··· 12 12 13 13 #define RSWITCH_MAX_NUM_QUEUES 128 14 14 15 + #define RSWITCH_NUM_AGENTS 5 15 16 #define RSWITCH_NUM_PORTS 3 16 17 #define rswitch_for_each_enabled_port(priv, i) \ 17 18 for (i = 0; i < RSWITCH_NUM_PORTS; i++) \ ··· 807 806 #define CABPPFLC_INIT_VALUE 0x00800080 808 807 809 808 /* MFWD */ 809 + #define FWPC0(i) (FWPC00 + (i) * 0x10) 810 810 #define FWPC0_LTHTA BIT(0) 811 811 #define FWPC0_IP4UE BIT(3) 812 812 #define FWPC0_IP4TE BIT(4) ··· 821 819 #define FWPC0_MACHMA BIT(27) 822 820 #define FWPC0_VLANSA BIT(28) 823 821 824 - #define FWPC0(i) (FWPC00 + (i) * 0x10) 825 - #define FWPC0_DEFAULT (FWPC0_LTHTA | FWPC0_IP4UE | FWPC0_IP4TE | \ 826 - FWPC0_IP4OE | FWPC0_L2SE | FWPC0_IP4EA | \ 827 - FWPC0_IPDSA | FWPC0_IPHLA | FWPC0_MACSDA | \ 828 - FWPC0_MACHLA | FWPC0_MACHMA | FWPC0_VLANSA) 829 822 #define FWPC1(i) (FWPC10 + (i) * 0x10) 823 + #define FWCP1_LTHFW GENMASK(16 + (RSWITCH_NUM_AGENTS - 1), 16) 830 824 #define FWPC1_DDE BIT(0) 831 825 832 - #define FWPBFC(i) (FWPBFC0 + (i) * 0x10) 826 + #define FWPC2(i) (FWPC20 + (i) * 0x10) 827 + #define FWCP2_LTWFW GENMASK(16 + (RSWITCH_NUM_AGENTS - 1), 16) 828 + 829 + #define FWPBFC(i) (FWPBFC0 + (i) * 0x10) 830 + #define FWPBFC_PBDV GENMASK(RSWITCH_NUM_AGENTS - 1, 0) 833 831 834 832 #define FWPBFCSDC(j, i) (FWPBFCSDC00 + (i) * 0x10 + (j) * 0x04) 835 833