K2L and L2E have different from K2HK EthSS version, which uses tag_info
field for destination slave port. This commit adds the dest_port_info
field
to the struct pktdma_cfg, to configure which HD filed tag_info or
pkt_info
shall be used to configure descriptor.
Before that commit the swinfo[2] was used for that purpose. Even if
that
worked on K2HK devices, the correct field for K2HK is the pkt_info.
The netcp_send() configure appropriate HD info field depending on the
direct_info of the currently using netcp.
Signed-off-by: Vitaly Andrianov <vita...@ti.com>
Acked-by: Murali Karicheri <m-kariche...@ti.com>
---
arch/arm/include/asm/ti-common/keystone_nav.h | 9 ++++++++-
drivers/dma/keystone_nav.c | 12 ++++++++++--
drivers/net/keystone_net.c | 3 +--
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/ti-common/keystone_nav.h
b/arch/arm/include/asm/ti-common/keystone_nav.h
index 696d8c6..5a0e391 100644
--- a/arch/arm/include/asm/ti-common/keystone_nav.h
+++ b/arch/arm/include/asm/ti-common/keystone_nav.h
@@ -152,6 +152,11 @@ struct rx_flow_regs {
u32 thresh[3];
};
+enum dest_port_info {
+ PKT_INFO,
+ TAG_INFO
+};
+
struct pktdma_cfg {
struct global_ctl_regs *global;
struct tx_chan_regs *tx_ch;
@@ -167,6 +172,7 @@ struct pktdma_cfg {
u32 tx_snd_q;
u32 rx_flow; /* flow that is used for RX */
+ enum dest_port_info dest_port_info;/* HD fiels for dest port
bits */
};
extern struct pktdma_cfg netcp_pktdma;
@@ -184,7 +190,8 @@ struct rx_buff_desc {
int ksnav_close(struct pktdma_cfg *pktdma);
int ksnav_init(struct pktdma_cfg *pktdma, struct rx_buff_desc
*rx_buffers);
-int ksnav_send(struct pktdma_cfg *pktdma, u32 *pkt, int num_bytes,
u32 swinfo2);
+int ksnav_send(struct pktdma_cfg *pktdma, u32 *pkt, int num_bytes,
+ u32 dest_port);
void *ksnav_recv(struct pktdma_cfg *pktdma, u32 **pkt, int
*num_bytes);
void ksnav_release_rxhd(struct pktdma_cfg *pktdma, void *hd);
diff --git a/drivers/dma/keystone_nav.c b/drivers/dma/keystone_nav.c
index dfca75a..64b1cee 100644
--- a/drivers/dma/keystone_nav.c
+++ b/drivers/dma/keystone_nav.c
@@ -278,7 +278,8 @@ int ksnav_close(struct pktdma_cfg *pktdma)
return QM_OK;
}
-int ksnav_send(struct pktdma_cfg *pktdma, u32 *pkt, int num_bytes,
u32 swinfo2)
+int ksnav_send(struct pktdma_cfg *pktdma, u32 *pkt, int num_bytes,
+ u32 dest_port)
{
struct qm_host_desc *hd;
@@ -286,8 +287,15 @@ int ksnav_send(struct pktdma_cfg *pktdma, u32
*pkt, int num_bytes, u32 swinfo2)
if (hd == NULL)
return QM_ERR;
+ dest_port &= 0xf;
hd->desc_info = num_bytes;
- hd->swinfo[2] = swinfo2;
+ if (pktdma->dest_port_info == PKT_INFO) {
+ hd->packet_info = qm_cfg->qpool_num | (dest_port << 16);
+ } else {
+ hd->packet_info = qm_cfg->qpool_num;
+ hd->tag_info = dest_port;
+ }
+
hd->packet_info = qm_cfg->qpool_num;
qm_buff_push(hd, pktdma->tx_snd_q, pkt, num_bytes);
diff --git a/drivers/net/keystone_net.c b/drivers/net/keystone_net.c
index 0c5fdee..e2adb67 100644
--- a/drivers/net/keystone_net.c
+++ b/drivers/net/keystone_net.c
@@ -381,8 +381,7 @@ int32_t cpmac_drv_send(u32 *buffer, int num_bytes,
int slave_port_num)
if (num_bytes < EMAC_MIN_ETHERNET_PKT_SIZE)
num_bytes = EMAC_MIN_ETHERNET_PKT_SIZE;
- return ksnav_send(&netcp_pktdma, buffer,
- num_bytes, (slave_port_num) << 16);
+ return ksnav_send(&netcp_pktdma, buffer, num_bytes,
slave_port_num);
}
/* Eth device open */