ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0257-net-mscc-ocelot-export-a-constant-for-the-tag-length.patch
1 From f53826ed84b6ce7c588949263cc9dedf3c577aa6 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Thu, 14 Nov 2019 17:03:24 +0200
4 Subject: [PATCH] net: mscc: ocelot: export a constant for the tag length in
5  bytes
6
7 This constant will be used in a future patch to increase the MTU on NPI
8 ports, and will also be used in the tagger driver for Felix.
9
10 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
11 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14  drivers/net/ethernet/mscc/ocelot.c       | 4 ++--
15  drivers/net/ethernet/mscc/ocelot.h       | 4 ++--
16  drivers/net/ethernet/mscc/ocelot_board.c | 2 +-
17  3 files changed, 5 insertions(+), 5 deletions(-)
18
19 --- a/drivers/net/ethernet/mscc/ocelot.c
20 +++ b/drivers/net/ethernet/mscc/ocelot.c
21 @@ -576,11 +576,11 @@ static int ocelot_port_xmit(struct sk_bu
22         struct skb_shared_info *shinfo = skb_shinfo(skb);
23         struct ocelot_port *ocelot_port = &priv->port;
24         struct ocelot *ocelot = ocelot_port->ocelot;
25 +       u32 val, ifh[OCELOT_TAG_LEN / 4];
26         struct frame_info info = {};
27         u8 grp = 0; /* Send everything on CPU group 0 */
28         unsigned int i, count, last;
29         int port = priv->chip_port;
30 -       u32 val, ifh[IFH_LEN];
31  
32         val = ocelot_read(ocelot, QS_INJ_STATUS);
33         if (!(val & QS_INJ_STATUS_FIFO_RDY(BIT(grp))) ||
34 @@ -603,7 +603,7 @@ static int ocelot_port_xmit(struct sk_bu
35  
36         ocelot_gen_ifh(ifh, &info);
37  
38 -       for (i = 0; i < IFH_LEN; i++)
39 +       for (i = 0; i < OCELOT_TAG_LEN / 4; i++)
40                 ocelot_write_rix(ocelot, (__force u32)cpu_to_be32(ifh[i]),
41                                  QS_INJ_WR, grp);
42  
43 --- a/drivers/net/ethernet/mscc/ocelot.h
44 +++ b/drivers/net/ethernet/mscc/ocelot.h
45 @@ -43,8 +43,6 @@
46  
47  #define OCELOT_PTP_QUEUE_SZ    128
48  
49 -#define IFH_LEN 4
50 -
51  struct frame_info {
52         u32 len;
53         u16 port;
54 @@ -66,6 +64,8 @@ struct frame_info {
55  #define IFH_REW_OP_TWO_STEP_PTP                0x3
56  #define IFH_REW_OP_ORIGIN_PTP          0x5
57  
58 +#define OCELOT_TAG_LEN                 16
59 +
60  #define OCELOT_SPEED_2500 0
61  #define OCELOT_SPEED_1000 1
62  #define OCELOT_SPEED_100  2
63 --- a/drivers/net/ethernet/mscc/ocelot_board.c
64 +++ b/drivers/net/ethernet/mscc/ocelot_board.c
65 @@ -105,7 +105,7 @@ static irqreturn_t ocelot_xtr_irq_handle
66                 int sz, len, buf_len;
67                 struct sk_buff *skb;
68  
69 -               for (i = 0; i < IFH_LEN; i++) {
70 +               for (i = 0; i < OCELOT_TAG_LEN / 4; i++) {
71                         err = ocelot_rx_frame_word(ocelot, grp, true, &ifh[i]);
72                         if (err != 4)
73                                 break;