Skip to content

Commit e170f40

Browse files
Karicheri, Muralidharandavem330
authored andcommitted
net: netcp: fix forward port number usage for 10G ethss
10G switch requires forward port number in the taginfo field, where as it should be in packet_info field for necp 1.4 Ethss. So fill this value correctly in the knav dma descriptor. Also rename dma_psflags field in struct netcp_tx_pipe to switch_to_port as it contain no flag, but the switch port number for forwarding the packet. Add a flag to hold the new flag, SWITCH_TO_PORT_IN_TAGINFO which will be set for 10G. This can also used in the future for other flags for the tx_pipe. Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: WingMan Kwok <w-kwok2@ti.com> CC: "David S. Miller" <davem@davemloft.net> CC: Mugunthan V N <mugunthanvnm@ti.com> CC: "Lad, Prabhakar" <prabhakar.csengg@gmail.com> CC: Grygorii Strashko <grygorii.strashko@ti.com> CC: Christoph Jaeger <cj@linux.com> CC: Lokesh Vutla <lokeshvutla@ti.com> CC: Markus Pargmann <mpa@pengutronix.de> CC: Kumar Gala <galak@codeaurora.org> CC: Ian Campbell <ijc+devicetree@hellion.org.uk> CC: Mark Rutland <mark.rutland@arm.com> CC: Pawel Moll <pawel.moll@arm.com> CC: Rob Herring <robh+dt@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 89c69d3 commit e170f40

File tree

3 files changed

+29
-13
lines changed

3 files changed

+29
-13
lines changed

drivers/net/ethernet/ti/netcp.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ struct netcp_tx_pipe {
4141
struct netcp_device *netcp_device;
4242
void *dma_queue;
4343
unsigned int dma_queue_id;
44-
u8 dma_psflags;
44+
/* To port for packet forwarded to switch. Used only by ethss */
45+
u8 switch_to_port;
46+
#define SWITCH_TO_PORT_IN_TAGINFO BIT(0)
47+
u8 flags;
4548
void *dma_channel;
4649
const char *dma_chan_name;
4750
};

drivers/net/ethernet/ti/netcp_core.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,9 +1098,9 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp,
10981098
struct netcp_tx_pipe *tx_pipe = NULL;
10991099
struct netcp_hook_list *tx_hook;
11001100
struct netcp_packet p_info;
1101-
u32 packet_info = 0;
11021101
unsigned int dma_sz;
11031102
dma_addr_t dma;
1103+
u32 tmp = 0;
11041104
int ret = 0;
11051105

11061106
p_info.netcp = netcp;
@@ -1140,20 +1140,27 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp,
11401140
memmove(p_info.psdata, p_info.psdata + p_info.psdata_len,
11411141
p_info.psdata_len);
11421142
set_words(psdata, p_info.psdata_len, psdata);
1143-
packet_info |=
1144-
(p_info.psdata_len & KNAV_DMA_DESC_PSLEN_MASK) <<
1143+
tmp |= (p_info.psdata_len & KNAV_DMA_DESC_PSLEN_MASK) <<
11451144
KNAV_DMA_DESC_PSLEN_SHIFT;
11461145
}
11471146

1148-
packet_info |= KNAV_DMA_DESC_HAS_EPIB |
1147+
tmp |= KNAV_DMA_DESC_HAS_EPIB |
11491148
((netcp->tx_compl_qid & KNAV_DMA_DESC_RETQ_MASK) <<
1150-
KNAV_DMA_DESC_RETQ_SHIFT) |
1151-
((tx_pipe->dma_psflags & KNAV_DMA_DESC_PSFLAG_MASK) <<
1152-
KNAV_DMA_DESC_PSFLAG_SHIFT);
1149+
KNAV_DMA_DESC_RETQ_SHIFT);
11531150

1154-
set_words(&packet_info, 1, &desc->packet_info);
1151+
if (!(tx_pipe->flags & SWITCH_TO_PORT_IN_TAGINFO)) {
1152+
tmp |= ((tx_pipe->switch_to_port & KNAV_DMA_DESC_PSFLAG_MASK) <<
1153+
KNAV_DMA_DESC_PSFLAG_SHIFT);
1154+
}
1155+
1156+
set_words(&tmp, 1, &desc->packet_info);
11551157
set_words((u32 *)&skb, 1, &desc->pad[0]);
11561158

1159+
if (tx_pipe->flags & SWITCH_TO_PORT_IN_TAGINFO) {
1160+
tmp = tx_pipe->switch_to_port;
1161+
set_words((u32 *)&tmp, 1, &desc->tag_info);
1162+
}
1163+
11571164
/* submit packet descriptor */
11581165
ret = knav_pool_desc_map(netcp->tx_pool, desc, sizeof(*desc), &dma,
11591166
&dma_sz);

drivers/net/ethernet/ti/netcp_ethss.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,15 +1472,21 @@ static int gbe_open(void *intf_priv, struct net_device *ndev)
14721472
GBE_MAJOR_VERSION(reg), GBE_MINOR_VERSION(reg),
14731473
GBE_RTL_VERSION(reg), GBE_IDENT(reg));
14741474

1475+
/* For 10G use directed to port */
1476+
if (gbe_dev->ss_version == XGBE_SS_VERSION_10)
1477+
gbe_intf->tx_pipe.flags = SWITCH_TO_PORT_IN_TAGINFO;
1478+
14751479
if (gbe_dev->enable_ale)
1476-
gbe_intf->tx_pipe.dma_psflags = 0;
1480+
gbe_intf->tx_pipe.switch_to_port = 0;
14771481
else
1478-
gbe_intf->tx_pipe.dma_psflags = port_num;
1482+
gbe_intf->tx_pipe.switch_to_port = port_num;
14791483

1480-
dev_dbg(gbe_dev->dev, "opened TX channel %s: %p with psflags %d\n",
1484+
dev_dbg(gbe_dev->dev,
1485+
"opened TX channel %s: %p with to port %d, flags %d\n",
14811486
gbe_intf->tx_pipe.dma_chan_name,
14821487
gbe_intf->tx_pipe.dma_channel,
1483-
gbe_intf->tx_pipe.dma_psflags);
1488+
gbe_intf->tx_pipe.switch_to_port,
1489+
gbe_intf->tx_pipe.flags);
14841490

14851491
gbe_slave_stop(gbe_intf);
14861492

0 commit comments

Comments
 (0)