Commit 763a32bd authored by David S. Miller's avatar David S. Miller

Merge branch 'xgene-tso'

Iyappan Subramanian says:

====================
drivers: net: xgene: Add TSO support

Adding TSO support for 10GbE

iperf Tx data rate without TSO: 3.42 Gbps
                      with TSO: 9.41 Gbps

v2: Address review comments from v1
    - skb_linearize() if headers doesn't fit in 3 hardware buffers

v1:
* Initial version
====================
Signed-off-by: default avatarIyappan Subramanian <isubramanian@apm.com>
parents 21c721fd 9b00eb49
...@@ -193,12 +193,16 @@ enum xgene_enet_rm { ...@@ -193,12 +193,16 @@ enum xgene_enet_rm {
#define USERINFO_LEN 32 #define USERINFO_LEN 32
#define FPQNUM_POS 32 #define FPQNUM_POS 32
#define FPQNUM_LEN 12 #define FPQNUM_LEN 12
#define NV_POS 50
#define NV_LEN 1
#define LL_POS 51
#define LL_LEN 1
#define LERR_POS 60 #define LERR_POS 60
#define LERR_LEN 3 #define LERR_LEN 3
#define STASH_POS 52 #define STASH_POS 52
#define STASH_LEN 2 #define STASH_LEN 2
#define BUFDATALEN_POS 48 #define BUFDATALEN_POS 48
#define BUFDATALEN_LEN 12 #define BUFDATALEN_LEN 15
#define DATAADDR_POS 0 #define DATAADDR_POS 0
#define DATAADDR_LEN 42 #define DATAADDR_LEN 42
#define COHERENT_POS 63 #define COHERENT_POS 63
...@@ -215,9 +219,19 @@ enum xgene_enet_rm { ...@@ -215,9 +219,19 @@ enum xgene_enet_rm {
#define IPHDR_LEN 6 #define IPHDR_LEN 6
#define EC_POS 22 /* Enable checksum */ #define EC_POS 22 /* Enable checksum */
#define EC_LEN 1 #define EC_LEN 1
#define ET_POS 23 /* Enable TSO */
#define IS_POS 24 /* IP protocol select */ #define IS_POS 24 /* IP protocol select */
#define IS_LEN 1 #define IS_LEN 1
#define TYPE_ETH_WORK_MESSAGE_POS 44 #define TYPE_ETH_WORK_MESSAGE_POS 44
#define LL_BYTES_MSB_POS 56
#define LL_BYTES_MSB_LEN 8
#define LL_BYTES_LSB_POS 48
#define LL_BYTES_LSB_LEN 12
#define LL_LEN_POS 48
#define LL_LEN_LEN 8
#define DATALEN_MASK GENMASK(11, 0)
#define LAST_BUFFER (0x7800ULL << BUFDATALEN_POS)
struct xgene_enet_raw_desc { struct xgene_enet_raw_desc {
__le64 m0; __le64 m0;
......
...@@ -40,8 +40,12 @@ ...@@ -40,8 +40,12 @@
#define XGENE_DRV_VERSION "v1.0" #define XGENE_DRV_VERSION "v1.0"
#define XGENE_ENET_MAX_MTU 1536 #define XGENE_ENET_MAX_MTU 1536
#define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN) #define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN)
#define BUFLEN_16K (16 * 1024)
#define NUM_PKT_BUF 64 #define NUM_PKT_BUF 64
#define NUM_BUFPOOL 32 #define NUM_BUFPOOL 32
#define MAX_EXP_BUFFS 256
#define XGENE_ENET_MSS 1448
#define XGENE_MIN_ENET_FRAME_SIZE 60
#define START_CPU_BUFNUM_0 0 #define START_CPU_BUFNUM_0 0
#define START_ETH_BUFNUM_0 2 #define START_ETH_BUFNUM_0 2
...@@ -79,6 +83,7 @@ struct xgene_enet_desc_ring { ...@@ -79,6 +83,7 @@ struct xgene_enet_desc_ring {
u16 num; u16 num;
u16 head; u16 head;
u16 tail; u16 tail;
u16 exp_buf_tail;
u16 slots; u16 slots;
u16 irq; u16 irq;
char irq_name[IRQ_ID_SIZE]; char irq_name[IRQ_ID_SIZE];
...@@ -93,6 +98,7 @@ struct xgene_enet_desc_ring { ...@@ -93,6 +98,7 @@ struct xgene_enet_desc_ring {
u8 nbufpool; u8 nbufpool;
struct sk_buff *(*rx_skb); struct sk_buff *(*rx_skb);
struct sk_buff *(*cp_skb); struct sk_buff *(*cp_skb);
dma_addr_t *frag_dma_addr;
enum xgene_enet_ring_cfgsize cfgsize; enum xgene_enet_ring_cfgsize cfgsize;
struct xgene_enet_desc_ring *cp_ring; struct xgene_enet_desc_ring *cp_ring;
struct xgene_enet_desc_ring *buf_pool; struct xgene_enet_desc_ring *buf_pool;
...@@ -102,6 +108,7 @@ struct xgene_enet_desc_ring { ...@@ -102,6 +108,7 @@ struct xgene_enet_desc_ring {
struct xgene_enet_raw_desc *raw_desc; struct xgene_enet_raw_desc *raw_desc;
struct xgene_enet_raw_desc16 *raw_desc16; struct xgene_enet_raw_desc16 *raw_desc16;
}; };
__le64 *exp_bufs;
}; };
struct xgene_mac_ops { struct xgene_mac_ops {
...@@ -112,6 +119,7 @@ struct xgene_mac_ops { ...@@ -112,6 +119,7 @@ struct xgene_mac_ops {
void (*tx_disable)(struct xgene_enet_pdata *pdata); void (*tx_disable)(struct xgene_enet_pdata *pdata);
void (*rx_disable)(struct xgene_enet_pdata *pdata); void (*rx_disable)(struct xgene_enet_pdata *pdata);
void (*set_mac_addr)(struct xgene_enet_pdata *pdata); void (*set_mac_addr)(struct xgene_enet_pdata *pdata);
void (*set_mss)(struct xgene_enet_pdata *pdata);
void (*link_state)(struct work_struct *work); void (*link_state)(struct work_struct *work);
}; };
...@@ -170,6 +178,7 @@ struct xgene_enet_pdata { ...@@ -170,6 +178,7 @@ struct xgene_enet_pdata {
u8 eth_bufnum; u8 eth_bufnum;
u8 bp_bufnum; u8 bp_bufnum;
u16 ring_num; u16 ring_num;
u32 mss;
}; };
struct xgene_indirect_ctl { struct xgene_indirect_ctl {
...@@ -204,6 +213,9 @@ static inline u64 xgene_enet_get_field_value(int pos, int len, u64 src) ...@@ -204,6 +213,9 @@ static inline u64 xgene_enet_get_field_value(int pos, int len, u64 src)
#define GET_VAL(field, src) \ #define GET_VAL(field, src) \
xgene_enet_get_field_value(field ## _POS, field ## _LEN, src) xgene_enet_get_field_value(field ## _POS, field ## _LEN, src)
#define GET_BIT(field, src) \
xgene_enet_get_field_value(field ## _POS, 1, src)
static inline struct device *ndev_to_dev(struct net_device *ndev) static inline struct device *ndev_to_dev(struct net_device *ndev)
{ {
return ndev->dev.parent; return ndev->dev.parent;
......
...@@ -184,6 +184,11 @@ static void xgene_xgmac_set_mac_addr(struct xgene_enet_pdata *pdata) ...@@ -184,6 +184,11 @@ static void xgene_xgmac_set_mac_addr(struct xgene_enet_pdata *pdata)
xgene_enet_wr_mac(pdata, HSTMACADR_MSW_ADDR, addr1); xgene_enet_wr_mac(pdata, HSTMACADR_MSW_ADDR, addr1);
} }
static void xgene_xgmac_set_mss(struct xgene_enet_pdata *pdata)
{
xgene_enet_wr_csr(pdata, XG_TSIF_MSS_REG0_ADDR, pdata->mss);
}
static u32 xgene_enet_link_status(struct xgene_enet_pdata *pdata) static u32 xgene_enet_link_status(struct xgene_enet_pdata *pdata)
{ {
u32 data; u32 data;
...@@ -204,8 +209,8 @@ static void xgene_xgmac_init(struct xgene_enet_pdata *pdata) ...@@ -204,8 +209,8 @@ static void xgene_xgmac_init(struct xgene_enet_pdata *pdata)
data &= ~HSTLENCHK; data &= ~HSTLENCHK;
xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data); xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data);
xgene_enet_wr_mac(pdata, HSTMAXFRAME_LENGTH_ADDR, 0x06000600);
xgene_xgmac_set_mac_addr(pdata); xgene_xgmac_set_mac_addr(pdata);
xgene_xgmac_set_mss(pdata);
xgene_enet_rd_csr(pdata, XG_RSIF_CONFIG_REG_ADDR, &data); xgene_enet_rd_csr(pdata, XG_RSIF_CONFIG_REG_ADDR, &data);
data |= CFG_RSIF_FPBUFF_TIMEOUT_EN; data |= CFG_RSIF_FPBUFF_TIMEOUT_EN;
...@@ -329,6 +334,7 @@ struct xgene_mac_ops xgene_xgmac_ops = { ...@@ -329,6 +334,7 @@ struct xgene_mac_ops xgene_xgmac_ops = {
.rx_disable = xgene_xgmac_rx_disable, .rx_disable = xgene_xgmac_rx_disable,
.tx_disable = xgene_xgmac_tx_disable, .tx_disable = xgene_xgmac_tx_disable,
.set_mac_addr = xgene_xgmac_set_mac_addr, .set_mac_addr = xgene_xgmac_set_mac_addr,
.set_mss = xgene_xgmac_set_mss,
.link_state = xgene_enet_link_state .link_state = xgene_enet_link_state
}; };
......
...@@ -62,7 +62,9 @@ ...@@ -62,7 +62,9 @@
#define XCLE_BYPASS_REG0_ADDR 0x0160 #define XCLE_BYPASS_REG0_ADDR 0x0160
#define XCLE_BYPASS_REG1_ADDR 0x0164 #define XCLE_BYPASS_REG1_ADDR 0x0164
#define XG_CFG_BYPASS_ADDR 0x0204 #define XG_CFG_BYPASS_ADDR 0x0204
#define XG_CFG_LINK_AGGR_RESUME_0_ADDR 0x0214
#define XG_LINK_STATUS_ADDR 0x0228 #define XG_LINK_STATUS_ADDR 0x0228
#define XG_TSIF_MSS_REG0_ADDR 0x02a4
#define XG_ENET_SPARE_CFG_REG_ADDR 0x040c #define XG_ENET_SPARE_CFG_REG_ADDR 0x040c
#define XG_ENET_SPARE_CFG_REG_1_ADDR 0x0410 #define XG_ENET_SPARE_CFG_REG_1_ADDR 0x0410
#define XGENET_RX_DV_GATE_REG_0_ADDR 0x0804 #define XGENET_RX_DV_GATE_REG_0_ADDR 0x0804
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment