Skip to contentSkip to conversation

Chelsio Terminator 5 (T5) 10G/40G Poll Mode Driver

PATCH Superseded Rahul Lakkireddy 4 participants 61 messages May 22, 2015 – Jul 1, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Chelsio Terminator 5 (T5) 10G/40G Poll Mode Driver

This series of patches add the CXGBE Poll Mode Driver support for Chelsio Terminator 5 series of 10G/40G adapters. The CXGBE PMD is split into two patches. The first patch adds the hardware specific api for all supported Chelsio T5 adapters and the second patch adds the actual DPDK CXGBE PMD.

More information on the CXGBE PMD can be found in the documentation added by the third patch. Also, the CXGBE PMD is enabled for compilation and linking by the fourth patch. Finally, update MAINTAINERS file to claim responsibility for the CXGBE PMD.

Rahul Lakkireddy (5):
cxgbe: add hardware specific api for all supported Chelsio T5 series
adapters.
cxgbe: add cxgbe poll mode driver.
doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst
config: enable cxgbe PMD for compilation and linking.
maintainers: claim responsibility for cxgbe PMD.

 MAINTAINERS                                 |    5 +
 config/common_linuxapp                      |   10 +
 doc/guides/nics/cxgbe.rst                   |  209 +++
 doc/guides/nics/index.rst                   |    1 +
 doc/guides/prog_guide/source_org.rst        |    1 +
 lib/Makefile                                |    1 +
 lib/librte_pmd_cxgbe/Makefile               |   74 +
 lib/librte_pmd_cxgbe/cxgbe.h                |   60 +
 lib/librte_pmd_cxgbe/cxgbe/adapter.h        |  560 ++++++
 lib/librte_pmd_cxgbe/cxgbe/common.h         |  401 ++++
 lib/librte_pmd_cxgbe/cxgbe/t4_chip_type.h   |   79 +
 lib/librte_pmd_cxgbe/cxgbe/t4_hw.c          | 2686 +++++++++++++++++++++++++++
 lib/librte_pmd_cxgbe/cxgbe/t4_hw.h          |  149 ++
 lib/librte_pmd_cxgbe/cxgbe/t4_msg.h         |  345 ++++
 lib/librte_pmd_cxgbe/cxgbe/t4_pci_id_tbl.h  |  148 ++
 lib/librte_pmd_cxgbe/cxgbe/t4_regs.h        |  779 ++++++++
 lib/librte_pmd_cxgbe/cxgbe/t4_regs_values.h |  168 ++
 lib/librte_pmd_cxgbe/cxgbe/t4fw_interface.h | 1730 +++++++++++++++++
 lib/librte_pmd_cxgbe/cxgbe_compat.h         |  290 +++
 lib/librte_pmd_cxgbe/cxgbe_ethdev.c         |  796 ++++++++
 lib/librte_pmd_cxgbe/cxgbe_main.c           | 1219 ++++++++++++
 lib/librte_pmd_cxgbe/sge.c                  | 2250 ++++++++++++++++++++++
 mk/rte.app.mk                               |    1 +
 23 files changed, 11962 insertions(+), 0 deletions(-)
 create mode 100644 doc/guides/nics/cxgbe.rst
 create mode 100644 lib/librte_pmd_cxgbe/Makefile
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/adapter.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/common.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_chip_type.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_hw.c
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_hw.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_msg.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_pci_id_tbl.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_regs.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_regs_values.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4fw_interface.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe_compat.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe_ethdev.c
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe_main.c
 create mode 100644 lib/librte_pmd_cxgbe/sge.c
#1 lore raw

PATCH 1/5 cxgbe: add hardware specific api for all supported Chelsio T5 series adapters.

Adds hardware specific api for all the Chelsio T5 adapters under lib/librte_pmd_cxgbe/cxgbe directory.

---
 lib/librte_pmd_cxgbe/cxgbe/adapter.h        |  560 ++++++
 lib/librte_pmd_cxgbe/cxgbe/common.h         |  401 ++++
 lib/librte_pmd_cxgbe/cxgbe/t4_chip_type.h   |   79 +
 lib/librte_pmd_cxgbe/cxgbe/t4_hw.c          | 2686 +++++++++++++++++++++++++++
 lib/librte_pmd_cxgbe/cxgbe/t4_hw.h          |  149 ++
 lib/librte_pmd_cxgbe/cxgbe/t4_msg.h         |  345 ++++
 lib/librte_pmd_cxgbe/cxgbe/t4_pci_id_tbl.h  |  148 ++
 lib/librte_pmd_cxgbe/cxgbe/t4_regs.h        |  779 ++++++++
 lib/librte_pmd_cxgbe/cxgbe/t4_regs_values.h |  168 ++
 lib/librte_pmd_cxgbe/cxgbe/t4fw_interface.h | 1730 +++++++++++++++++
 10 files changed, 7045 insertions(+), 0 deletions(-)
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/adapter.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/common.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_chip_type.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_hw.c
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_hw.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_msg.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_pci_id_tbl.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_regs.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4_regs_values.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe/t4fw_interface.h
lib/librte_pmd_cxgbe/cxgbe/adapter.h new file +560 -0
new file mode 100644
index 0000000..e928854
@@ -0,0 +1,560 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014-2015 Chelsio Communications.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Chelsio Communications nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* This file should not be included directly.  Include common.h instead. */
+
+#ifndef __T4_ADAPTER_H__
+#define __T4_ADAPTER_H__
+
+#include <rte_mbuf.h>
+
+#include "cxgbe_compat.h"
+#include "t4_regs_values.h"
+
+enum {
+	MAX_ETH_QSETS = 64,           /* # of Ethernet Tx/Rx queue sets */
+};
+
+struct adapter;
+struct sge_rspq;
+
+enum {
+	PORT_RSS_DONE = (1 << 0),
+};
+
+struct port_info {
+	struct adapter *adapter;        /* adapter that this port belongs to */
+	struct rte_eth_dev *eth_dev;    /* associated rte eth device */
+	struct port_stats stats_base;   /* port statistics base */
+	struct link_config link_cfg;    /* link configuration info */
+
+	unsigned long flags;            /* port related flags */
+	short int xact_addr_filt;       /* index of exact MAC address filter */
+
+	u16    viid;                    /* associated virtual interface id */
+	s8     mdio_addr;               /* address of the PHY */
+	u8     port_type;               /* firmware port type */
+	u8     mod_type;                /* firmware module type */
+	u8     port_id;                 /* physical port ID */
+	u8     tx_chan;                 /* associated channel */
+
+	u8     n_rx_qsets;              /* # of rx qsets */
+	u8     n_tx_qsets;              /* # of tx qsets */
+	u8     first_qset;              /* index of first qset */
+
+	u16    *rss;                    /* rss table */
+	u8     rss_mode;                /* rss mode */
+	u16    rss_size;                /* size of VI's RSS table slice */
+};
+
+/* Enable or disable autonegotiation.  If this is set to enable,
+ * the forced link modes above are completely ignored.
+ */
+#define AUTONEG_DISABLE         0x00
+#define AUTONEG_ENABLE          0x01
+
+enum {                                 /* adapter flags */
+	FULL_INIT_DONE     = (1 << 0),
+	USING_MSI          = (1 << 1),
+	USING_MSIX         = (1 << 2),
+	FW_QUEUE_BOUND     = (1 << 3),
+	FW_OK              = (1 << 4),
+	CFG_QUEUES	   = (1 << 5),
+	MASTER_PF          = (1 << 6),
+};
+
+struct rx_sw_desc {                /* SW state per Rx descriptor */
+	void *buf;                 /* struct page or mbuf */
+	dma_addr_t dma_addr;
+};
+
+struct sge_fl {                     /* SGE free-buffer queue state */
+	/* RO fields */
+	struct rx_sw_desc *sdesc;   /* address of SW Rx descriptor ring */
+
+	dma_addr_t addr;            /* bus address of HW ring start */
+	__be64 *desc;               /* address of HW Rx descriptor ring */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cntxt_id;      /* SGE relative QID for the free list */
+	unsigned int size;          /* capacity of free list */
+
+	unsigned int avail;         /* # of available Rx buffers */
+	unsigned int pend_cred;     /* new buffers since last FL DB ring */
+	unsigned int cidx;          /* consumer index */
+	unsigned int pidx;          /* producer index */
+
+	unsigned long alloc_failed; /* # of times buffer allocation failed */
+	unsigned long low;          /* # of times momentarily starving */
+};
+
+#define MAX_MBUF_FRAGS (16384 / 512 + 2)
+
+/* A packet gather list */
+struct pkt_gl {
+	union {
+		struct rte_mbuf *mbufs[MAX_MBUF_FRAGS];
+	} /* UNNAMED */;
+	void *va;                         /* virtual address of first byte */
+	unsigned int nfrags;              /* # of fragments */
+	unsigned int tot_len;             /* total length of fragments */
+	bool usembufs;                    /* use mbufs for fragments */
+};
+
+typedef int (*rspq_handler_t)(struct sge_rspq *q, const __be64 *rsp,
+			      const struct pkt_gl *gl);
+
+struct sge_rspq {                   /* state for an SGE response queue */
+	struct adapter *adapter;      /* adapter that this queue belongs to */
+	struct rte_eth_dev *eth_dev;  /* associated rte eth device */
+	struct rte_mempool  *mb_pool; /* associated mempool */
+
+	dma_addr_t phys_addr;       /* physical address of the ring */
+	__be64 *desc;               /* address of HW response ring */
+	const __be64 *cur_desc;     /* current descriptor in queue */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cidx;          /* consumer index */
+	unsigned int iqe_len;       /* entry size */
+	unsigned int size;          /* capacity of response queue */
+	int offset;                 /* offset into current Rx buffer */
+
+	u8 gen;                     /* current generation bit */
+	u8 intr_params;             /* interrupt holdoff parameters */
+	u8 next_intr_params;        /* holdoff params for next interrupt */
+	u8 pktcnt_idx;              /* interrupt packet threshold */
+	u8 idx;                     /* queue index within its group */
+	u16 cntxt_id;               /* SGE relative QID for the response Q */
+	u16 abs_id;                 /* absolute SGE id for the response q */
+
+	rspq_handler_t handler;     /* associated handler for this response q */
+};
+
+struct sge_eth_rx_stats {	/* Ethernet rx queue statistics */
+	u64 pkts;		/* # of ethernet packets */
+	u64 rx_bytes;		/* # of ethernet bytes */
+	u64 rx_cso;		/* # of Rx checksum offloads */
+	u64 vlan_ex;		/* # of Rx VLAN extractions */
+	u64 rx_drops;		/* # of packets dropped due to no mem */
+};
+
+struct sge_eth_rxq {                /* a SW Ethernet Rx queue */
+	struct sge_rspq rspq;
+	struct sge_fl fl;
+	struct sge_eth_rx_stats stats;
+	bool usembufs;               /* one ingress packet per mbuf FL buffer */
+} __rte_cache_aligned;
+
+/*
+ * Currently there are two types of coalesce WR. Type 0 needs 48 bytes per
+ * packet (if one sgl is present) and type 1 needs 32 bytes. This means
+ * that type 0 can fit a maximum of 10 packets per WR and type 1 can fit
+ * 15 packets. We need to keep track of the mbuf pointers in a coalesce WR
+ * to be able to free those mbufs when we get completions back from the FW.
+ * Allocating the maximum number of pointers in every tx desc is a waste
+ * of memory resources so we only store 2 pointers per tx desc which should
+ * be enough since a tx desc can only fit 2 packets in the best case
+ * scenario where a packet needs 32 bytes.
+ */
+#define ETH_COALESCE_PKT_NUM 15
+#define ETH_COALESCE_PKT_PER_DESC 2
+
+struct tx_eth_coal_desc {
+	struct rte_mbuf *mbuf[ETH_COALESCE_PKT_PER_DESC];
+	struct ulptx_sgl *sgl[ETH_COALESCE_PKT_PER_DESC];
+	int idx;
+};
+
+struct tx_desc {
+	__be64 flit[8];
+};
+
+struct tx_sw_desc {                /* SW state per Tx descriptor */
+	struct rte_mbuf *mbuf;
+	struct ulptx_sgl *sgl;
+	struct tx_eth_coal_desc coalesce;
+};
+
+enum {
+	EQ_STOPPED = (1 << 0),
+};
+
+struct eth_coalesce {
+	unsigned char *ptr;
+	unsigned char type;
+	unsigned int idx;
+	unsigned int len;
+	unsigned int flits;
+	unsigned int max;
+};
+
+struct sge_txq {
+	struct tx_desc *desc;       /* address of HW Tx descriptor ring */
+	struct tx_sw_desc *sdesc;   /* address of SW Tx descriptor ring */
+	struct sge_qstat *stat;     /* queue status entry */
+	struct eth_coalesce coalesce; /* coalesce info */
+
+	uint64_t phys_addr;         /* physical address of the ring */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cntxt_id;     /* SGE relative QID for the Tx Q */
+	unsigned int in_use;       /* # of in-use Tx descriptors */
+	unsigned int size;         /* # of descriptors */
+	unsigned int cidx;         /* SW consumer index */
+	unsigned int pidx;         /* producer index */
+	unsigned int dbidx;	   /* last idx when db ring was done */
+	unsigned int equeidx;	   /* last sent credit request */
+
+	int db_disabled;            /* doorbell state */
+	unsigned short db_pidx;     /* doorbell producer index */
+	unsigned short db_pidx_inc; /* doorbell producer increment */
+};
+
+struct sge_eth_tx_stats {	/* Ethernet tx queue statistics */
+	u64 pkts;		/* # of ethernet packets */
+	u64 tx_bytes;		/* # of ethernet bytes */
+	u64 tso;		/* # of TSO requests */
+	u64 tx_cso;		/* # of Tx checksum offloads */
+	u64 vlan_ins;		/* # of Tx VLAN insertions */
+	u64 mapping_err;	/* # of I/O MMU packet mapping errors */
+	u64 coal_wr;            /* # of coalesced wr */
+	u64 coal_pkts;          /* # of coalesced packets */
+};
+
+struct sge_eth_txq {                   /* state for an SGE Ethernet Tx queue */
+	struct sge_txq q;
+	struct rte_eth_dev *eth_dev;   /* port that this queue belongs to */
+	struct sge_eth_tx_stats stats; /* queue statistics */
+
+	unsigned int flags;            /* flags for state of the queue */
+} __rte_cache_aligned;
+
+struct sge {
+	struct sge_eth_txq ethtxq[MAX_ETH_QSETS];
+	struct sge_eth_rxq ethrxq[MAX_ETH_QSETS];
+	struct sge_rspq fw_evtq __rte_cache_aligned;
+
+	u16 max_ethqsets;           /* # of available Ethernet queue sets */
+	u32 stat_len;               /* length of status page at ring end */
+	u32 pktshift;               /* padding between CPL & packet data */
+
+	/* response queue interrupt parameters */
+	u16 timer_val[SGE_NTIMERS];
+	u8  counter_val[SGE_NCOUNTERS];
+
+	u32 fl_align;               /* response queue message alignment */
+	u32 fl_pg_order;            /* large page allocation size */
+	u32 fl_starve_thres;        /* Free List starvation threshold */
+};
+
+#define T4_OS_NEEDS_MBOX_LOCKING 1
+
+/*
+ * OS Lock/List primitives for those interfaces in the Common Code which
+ * need this.
+ */
+
+struct mbox_entry {
+	TAILQ_ENTRY(mbox_entry) next;
+};
+
+TAILQ_HEAD(mbox_list, mbox_entry);
+
+struct adapter {
+	struct rte_pci_device *pdev;       /* associated rte pci device */
+	struct rte_eth_dev *eth_dev;       /* first port's rte eth device */
+	struct adapter_params params;      /* adapter parameters */
+	struct port_info port[MAX_NPORTS]; /* ports belonging to this adapter */
+	struct sge sge;                    /* associated SGE */
+
+	/* support for single-threading access to adapter mailbox registers */
+	struct mbox_list mbox_list;
+	rte_spinlock_t mbox_lock;
+
+	u8 *regs;              /* pointer to registers region */
+	u8 *bar2;              /* pointer to bar2 region */
+	unsigned long flags;   /* adapter flags */
+	unsigned int mbox;     /* associated mailbox */
+	unsigned int pf;       /* associated physical function id */
+
+	int use_unpacked_mode; /* unpacked rx mode state */
+};
+
+#define CXGBE_PCI_REG(reg) (*((volatile uint32_t *)(reg)))
+
+static inline uint64_t cxgbe_read_addr64(volatile void *addr)
+{
+	uint64_t val = CXGBE_PCI_REG(addr);
+	uint64_t val2 = CXGBE_PCI_REG(((volatile uint8_t *)(addr) + 4));
+
+	val2 = (uint64_t)(val2 << 32);
+	val += val2;
+	return val;
+}
+
+static inline uint32_t cxgbe_read_addr(volatile void *addr)
+{
+	return CXGBE_PCI_REG(addr);
+}
+
+#define CXGBE_PCI_REG_ADDR(adap, reg) \
+	((volatile uint32_t *)((char *)(adap)->regs + (reg)))
+
+#define CXGBE_READ_REG(adap, reg) \
+	cxgbe_read_addr(CXGBE_PCI_REG_ADDR((adap), (reg)))
+
+#define CXGBE_READ_REG64(adap, reg) \
+	cxgbe_read_addr64(CXGBE_PCI_REG_ADDR((adap), (reg)))
+
+#define CXGBE_PCI_REG_WRITE(reg, value) ({ \
+	CXGBE_PCI_REG((reg)) = (value); })
+
+#define CXGBE_WRITE_REG(adap, reg, value) \
+	CXGBE_PCI_REG_WRITE(CXGBE_PCI_REG_ADDR((adap), (reg)), (value))
+
+static inline uint64_t cxgbe_write_addr64(volatile void *addr, uint64_t val)
+{
+	CXGBE_PCI_REG(addr) = val;
+	CXGBE_PCI_REG(((volatile uint8_t *)(addr) + 4)) = (val >> 32);
+	return val;
+}
+
+#define CXGBE_WRITE_REG64(adap, reg, value) \
+	cxgbe_write_addr64(CXGBE_PCI_REG_ADDR((adap), (reg)), (value))
+
+/**
+ * t4_read_reg - read a HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ *
+ * Returns the 32-bit value of the given HW register.
+ */
+static inline u32 t4_read_reg(struct adapter *adapter, u32 reg_addr)
+{
+	u32 val = CXGBE_READ_REG(adapter, reg_addr);
+
+	CXGBE_DEBUG_REG(adapter, "read register 0x%x value 0x%x\n", reg_addr,
+			val);
+	return val;
+}
+
+/**
+ * t4_write_reg - write a HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ * @val: the value to write
+ *
+ * Write a 32-bit value into the given HW register.
+ */
+static inline void t4_write_reg(struct adapter *adapter, u32 reg_addr, u32 val)
+{
+	CXGBE_DEBUG_REG(adapter, "setting register 0x%x to 0x%x\n", reg_addr,
+			val);
+	CXGBE_WRITE_REG(adapter, reg_addr, val);
+}
+
+/**
+ * t4_read_reg64 - read a 64-bit HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ *
+ * Returns the 64-bit value of the given HW register.
+ */
+static inline u64 t4_read_reg64(struct adapter *adapter, u32 reg_addr)
+{
+	u64 val = CXGBE_READ_REG64(adapter, reg_addr);
+
+	CXGBE_DEBUG_REG(adapter, "64-bit read register %#x value %#llx\n",
+			reg_addr, (unsigned long long)val);
+	return val;
+}
+
+/**
+ * t4_write_reg64 - write a 64-bit HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ * @val: the value to write
+ *
+ * Write a 64-bit value into the given HW register.
+ */
+static inline void t4_write_reg64(struct adapter *adapter, u32 reg_addr,
+				  u64 val)
+{
+	CXGBE_DEBUG_REG(adapter, "setting register %#x to %#llx\n", reg_addr,
+			(unsigned long long)val);
+
+	CXGBE_WRITE_REG64(adapter, reg_addr, val);
+}
+
+/**
+ * t4_os_set_hw_addr - store a port's MAC address in SW
+ * @adapter: the adapter
+ * @port_idx: the port index
+ * @hw_addr: the Ethernet address
+ *
+ * Store the Ethernet address of the given port in SW.  Called by the
+ * common code when it retrieves a port's Ethernet address from EEPROM.
+ */
+static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx,
+				     u8 hw_addr[])
+{
+	struct port_info *pi = &adapter->port[port_idx];
+
+	ether_addr_copy((struct ether_addr *)hw_addr,
+			&pi->eth_dev->data->mac_addrs[0]);
+}
+
+/**
+ * t4_os_lock_init - initialize spinlock
+ * @lock: the spinlock
+ */
+static inline void t4_os_lock_init(rte_spinlock_t *lock)
+{
+	rte_spinlock_init(lock);
+}
+
+/**
+ * t4_os_lock - spin until lock is acquired
+ * @lock: the spinlock
+ */
+static inline void t4_os_lock(rte_spinlock_t *lock)
+{
+	rte_spinlock_lock(lock);
+}
+
+/**
+ * t4_os_unlock - unlock a spinlock
+ * @lock: the spinlock
+ */
+static inline void t4_os_unlock(rte_spinlock_t *lock)
+{
+	rte_spinlock_unlock(lock);
+}
+
+/**
+ * t4_os_init_list_head - initialize
+ * @head: head of list to initialize [to empty]
+ */
+static inline void t4_os_init_list_head(struct mbox_list *head)
+{
+	TAILQ_INIT(head);
+}
+
+static inline struct mbox_entry *t4_os_list_first_entry(struct mbox_list *head)
+{
+	return TAILQ_FIRST(head);
+}
+
+/**
+ * t4_os_atomic_add_tail - Enqueue list element atomically onto list
+ * @new: the entry to be addded to the queue
+ * @head: current head of the linked list
+ * @lock: lock to use to guarantee atomicity
+ */
+static inline void t4_os_atomic_add_tail(struct mbox_entry *entry,
+					 struct mbox_list *head,
+					 rte_spinlock_t *lock)
+{
+	t4_os_lock(lock);
+	TAILQ_INSERT_TAIL(head, entry, next);
+	t4_os_unlock(lock);
+}
+
+/**
+ * t4_os_atomic_list_del - Dequeue list element atomically from list
+ * @entry: the entry to be remove/dequeued from the list.
+ * @lock: the spinlock
+ */
+static inline void t4_os_atomic_list_del(struct mbox_entry *entry,
+					 struct mbox_list *head,
+					 rte_spinlock_t *lock)
+{
+	t4_os_lock(lock);
+	TAILQ_REMOVE(head, entry, next);
+	t4_os_unlock(lock);
+}
+
+/**
+ * adap2pinfo - return the port_info of a port
+ * @adap: the adapter
+ * @idx: the port index
+ *
+ * Return the port_info structure for the port of the given index.
+ */
+static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
+{
+	return &adap->port[idx];
+}
+
+void *t4_alloc_mem(size_t size);
+void t4_free_mem(void *addr);
+#define t4_os_alloc(_size)     t4_alloc_mem((_size))
+#define t4_os_free(_ptr)       t4_free_mem((_ptr))
+
+void t4_os_portmod_changed(const struct adapter *adap, int port_id);
+void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
+
+void reclaim_completed_tx(struct sge_txq *q);
+void t4_free_sge_resources(struct adapter *adap);
+int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, uint16_t left);
+int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
+		     const struct pkt_gl *gl);
+int t4_sge_init(struct adapter *adap);
+int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
+			 struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			 unsigned int iqid, int socket_id);
+int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *rspq, bool fwevtq,
+		     struct rte_eth_dev *eth_dev, int intr_idx,
+		     struct sge_fl *fl, rspq_handler_t handler,
+		     int cong, struct rte_mempool *mp, int queue_id,
+		     int socket_id);
+int t4_sge_eth_txq_start(struct sge_eth_txq *txq);
+int t4_sge_eth_txq_stop(struct sge_eth_txq *txq);
+void t4_sge_eth_txq_release(struct adapter *adap, struct sge_eth_txq *txq);
+int t4_sge_eth_rxq_start(struct adapter *adap, struct sge_rspq *rq);
+int t4_sge_eth_rxq_stop(struct adapter *adap, struct sge_rspq *rq);
+void t4_sge_eth_rxq_release(struct adapter *adap, struct sge_eth_rxq *rxq);
+void t4_sge_eth_clear_queues(struct port_info *pi);
+int cxgb4_set_rspq_intr_params(struct sge_rspq *q, unsigned int us,
+			       unsigned int cnt);
+int cxgbe_poll(struct sge_rspq *q, struct rte_mbuf **rx_pkts,
+	       unsigned int budget, unsigned int *work_done);
+int cxgb4_write_rss(const struct port_info *pi, const u16 *queues);
+
+#endif /* __T4_ADAPTER_H__ */
lib/librte_pmd_cxgbe/cxgbe/common.h new file +401 -0

401 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe/t4_chip_type.h new file +79 -0

79 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe/t4_hw.c new file +2686 -0

1,960 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe/t4_hw.h new file +149 -0

149 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe/t4_msg.h new file +345 -0

345 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe/t4_pci_id_tbl.h new file +148 -0

148 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe/t4_regs.h new file +779 -0

779 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe/t4_regs_values.h new file +168 -0

168 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe/t4fw_interface.h new file +1730 -0

1,730 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.1

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH 2/5 cxgbe: add cxgbe poll mode driver.

In reply to Rahul Lakkireddy

Adds cxgbe poll mode driver for DPDK under lib/librte_pmd_cxgbe directory. This patch:

1. Adds the Makefile to compile cxgbe pmd.
2. Registers and initializes the cxgbe pmd driver.
3. Implements the necessary eth_dev_ops.

---
 lib/librte_pmd_cxgbe/Makefile       |   74 ++
 lib/librte_pmd_cxgbe/cxgbe.h        |   60 +
 lib/librte_pmd_cxgbe/cxgbe_compat.h |  290 +++++
 lib/librte_pmd_cxgbe/cxgbe_ethdev.c |  796 +++++++++++++
 lib/librte_pmd_cxgbe/cxgbe_main.c   | 1219 +++++++++++++++++++
 lib/librte_pmd_cxgbe/sge.c          | 2250 +++++++++++++++++++++++++++++++++++
 6 files changed, 4689 insertions(+), 0 deletions(-)
 create mode 100644 lib/librte_pmd_cxgbe/Makefile
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe_compat.h
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe_ethdev.c
 create mode 100644 lib/librte_pmd_cxgbe/cxgbe_main.c
 create mode 100644 lib/librte_pmd_cxgbe/sge.c
lib/librte_pmd_cxgbe/Makefile new file +74 -0
new file mode 100644
index 0000000..945f196
@@ -0,0 +1,74 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014-2015 Chelsio Communications.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of Chelsio Communications nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_cxgbe.a
+
+CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_cxgbe/cxgbe/
+CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_cxgbe/
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+ifeq ($(CC), icc)
+#
+# CFLAGS for icc
+#
+CFLAGS_BASE_DRIVER = -wd174 -wd593 -wd869 -wd981 -wd2259
+else
+#
+# CFLAGS for gcc
+#
+ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
+CFLAGS     += -Wno-deprecated
+endif
+CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value
+CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args
+
+endif
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_main.c
+SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += sge.c
+SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe/t4_hw.c
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_eal lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_net lib/librte_malloc
+
+include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pmd_cxgbe/cxgbe.h new file +60 -0

60 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe_compat.h new file +290 -0

290 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe_ethdev.c new file +796 -0

796 lines not on this page · raw message

lib/librte_pmd_cxgbe/cxgbe_main.c new file +1219 -0

1,219 lines not on this page · raw message

lib/librte_pmd_cxgbe/sge.c new file +2250 -0

561 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.1

Part of the diff is not shown here. View the raw message.

#3 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Quoted 74 lines · On Fri, 22 May 2015 18:54:20 +0530 Rahul Lakkireddy…
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +74 -0
+#define pr_err(y, args...) dev_err(0, y, ##args)
+#define pr_warn(y, args...) dev_warn(0, y, ##args)
+#define pr_info(y, args...) dev_info(0, y, ##args)
+#define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
+
+#define ASSERT(x) do {\
+	if (!(x)) \
+		rte_panic("CXGBE: x"); \
+} while (0)
+#define BUG_ON(x) ASSERT(!(x))
+
+#ifndef WARN_ON
+#define WARN_ON(x) do { \
+	int ret = !!(x); \
+	if (unlikely(ret)) \
+		pr_warn("WARN_ON: \"" #x "\" at %s:%d\n", __func__, __LINE__); \
+} while (0)
+#endif
+
+#define __iomem
+
+#ifndef BIT
+#define BIT(n) (1 << (n))
+#endif
+
+#define L1_CACHE_SHIFT  6
+#define L1_CACHE_BYTES  BIT(L1_CACHE_SHIFT)
+
+#define PAGE_SHIFT  12
+#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
+
+#define VLAN_HLEN 4
+
+#define rmb()     rte_rmb() /* dpdk rte provided rmb */
+#define wmb()     rte_wmb() /* dpdk rte provided wmb */
+
+typedef uint8_t   u8;
+typedef int8_t    s8;
+typedef uint16_t  u16;
+typedef uint32_t  u32;
+typedef int32_t   s32;
+typedef uint64_t  u64;
+typedef int       bool;
+typedef uint64_t  dma_addr_t;
+
+#ifndef __le16
+#define __le16	uint16_t
+#endif
+#ifndef __le32
+#define __le32	uint32_t
+#endif
+#ifndef __le64
+#define __le64	uint64_t
+#endif
+#ifndef __be16
+#define __be16	uint16_t
+#endif
+#ifndef __be32
+#define __be32	uint32_t
+#endif
+#ifndef __be64
+#define __be64	uint64_t
+#endif
+#ifndef __u8
+#define __u8	uint8_t
+#endif
+#ifndef __u16
+#define __u16	uint16_t
+#endif
+#ifndef __u32
+#define __u32	uint32_t
+#endif
+#ifndef __u64

lib/librte_pmd_cxgbe/cxgbe_compat.h line 176

Quoted 10 lines
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +10 -0
+#define __u64	uint64_t
+#endif
+
+#define FALSE	0
+#define TRUE	1
+#define false	0
+#define true	1
+
+#define min(a, b) RTE_MIN(a, b)
+#define max(a, b) RTE_MAX(a, b)

This is not Linux kernel.
Please don't create wrappers for all the stuff in Linux to port your driver.

#4 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Quoted 82 lines · Stephen Hemminger
Quoted 79 lines · On Fri, 22 May 2015 18:54:20 +0530 Rahul Lakkireddy…
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +79 -0
+#define pr_err(y, args...) dev_err(0, y, ##args)
+#define pr_warn(y, args...) dev_warn(0, y, ##args)
+#define pr_info(y, args...) dev_info(0, y, ##args)
+#define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
+
+#define ASSERT(x) do {\
+	if (!(x)) \
+		rte_panic("CXGBE: x"); \
+} while (0)
+#define BUG_ON(x) ASSERT(!(x))
+
+#ifndef WARN_ON
+#define WARN_ON(x) do { \
+	int ret = !!(x); \
+	if (unlikely(ret)) \
+		pr_warn("WARN_ON: \"" #x "\" at %s:%d\n", __func__, __LINE__); \
+} while (0)
+#endif
+
+#define __iomem
+
+#ifndef BIT
+#define BIT(n) (1 << (n))
+#endif
+
+#define L1_CACHE_SHIFT  6
+#define L1_CACHE_BYTES  BIT(L1_CACHE_SHIFT)
+
+#define PAGE_SHIFT  12
+#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
+
+#define VLAN_HLEN 4
+
+#define rmb()     rte_rmb() /* dpdk rte provided rmb */
+#define wmb()     rte_wmb() /* dpdk rte provided wmb */
+
+typedef uint8_t   u8;
+typedef int8_t    s8;
+typedef uint16_t  u16;
+typedef uint32_t  u32;
+typedef int32_t   s32;
+typedef uint64_t  u64;
+typedef int       bool;
+typedef uint64_t  dma_addr_t;
+
+#ifndef __le16
+#define __le16	uint16_t
+#endif
+#ifndef __le32
+#define __le32	uint32_t
+#endif
+#ifndef __le64
+#define __le64	uint64_t
+#endif
+#ifndef __be16
+#define __be16	uint16_t
+#endif
+#ifndef __be32
+#define __be32	uint32_t
+#endif
+#ifndef __be64
+#define __be64	uint64_t
+#endif
+#ifndef __u8
+#define __u8	uint8_t
+#endif
+#ifndef __u16
+#define __u16	uint16_t
+#endif
+#ifndef __u32
+#define __u32	uint32_t
+#endif
+#ifndef __u64
+#define __u64	uint64_t
+#endif
+
+#define FALSE	0
+#define TRUE	1
Quoted 8 lines

lib/librte_pmd_cxgbe/cxgbe_compat.h line 176

Quoted 5 lines
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +5 -0
+#define false	0
+#define true	1
+
+#define min(a, b) RTE_MIN(a, b)
+#define max(a, b) RTE_MAX(a, b)

This is not Linux kernel.
Please don't create wrappers for all the stuff in Linux to port your driver.

We actually referred several PMD's compat file including - enic_compat.h, i40e_osdep.h, ixgbe_osdep.h, fm10k_osdep.h, etc.

Most of the types above are already defined by many of existing PMD's compat file. Can we at-least keep those which are already defined by several PMD's compat file?

Thanks,
Rahul.

#5 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Quoted 92 lines · Rahul Lakkireddy
Quoted 82 lines · Stephen Hemminger
Quoted 79 lines · On Fri, 22 May 2015 18:54:20 +0530 Rahul Lakkireddy…
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +79 -0
+#define pr_err(y, args...) dev_err(0, y, ##args)
+#define pr_warn(y, args...) dev_warn(0, y, ##args)
+#define pr_info(y, args...) dev_info(0, y, ##args)
+#define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
+
+#define ASSERT(x) do {\
+	if (!(x)) \
+		rte_panic("CXGBE: x"); \
+} while (0)
+#define BUG_ON(x) ASSERT(!(x))
+
+#ifndef WARN_ON
+#define WARN_ON(x) do { \
+	int ret = !!(x); \
+	if (unlikely(ret)) \
+		pr_warn("WARN_ON: \"" #x "\" at %s:%d\n", __func__, __LINE__); \
+} while (0)
+#endif
+
+#define __iomem
+
+#ifndef BIT
+#define BIT(n) (1 << (n))
+#endif
+
+#define L1_CACHE_SHIFT  6
+#define L1_CACHE_BYTES  BIT(L1_CACHE_SHIFT)
+
+#define PAGE_SHIFT  12
+#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
+
+#define VLAN_HLEN 4
+
+#define rmb()     rte_rmb() /* dpdk rte provided rmb */
+#define wmb()     rte_wmb() /* dpdk rte provided wmb */
+
+typedef uint8_t   u8;
+typedef int8_t    s8;
+typedef uint16_t  u16;
+typedef uint32_t  u32;
+typedef int32_t   s32;
+typedef uint64_t  u64;
+typedef int       bool;
+typedef uint64_t  dma_addr_t;
+
+#ifndef __le16
+#define __le16	uint16_t
+#endif
+#ifndef __le32
+#define __le32	uint32_t
+#endif
+#ifndef __le64
+#define __le64	uint64_t
+#endif
+#ifndef __be16
+#define __be16	uint16_t
+#endif
+#ifndef __be32
+#define __be32	uint32_t
+#endif
+#ifndef __be64
+#define __be64	uint64_t
+#endif
+#ifndef __u8
+#define __u8	uint8_t
+#endif
+#ifndef __u16
+#define __u16	uint16_t
+#endif
+#ifndef __u32
+#define __u32	uint32_t
+#endif
+#ifndef __u64
+#define __u64	uint64_t
+#endif
+
+#define FALSE	0
+#define TRUE	1
Quoted 8 lines

lib/librte_pmd_cxgbe/cxgbe_compat.h line 176

Quoted 5 lines
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +5 -0
+#define false	0
+#define true	1
+
+#define min(a, b) RTE_MIN(a, b)
+#define max(a, b) RTE_MAX(a, b)

This is not Linux kernel.
Please don't create wrappers for all the stuff in Linux to port your driver.

Quoted 6 lines

We actually referred several PMD's compat file including - enic_compat.h, i40e_osdep.h, ixgbe_osdep.h, fm10k_osdep.h, etc.

Most of the types above are already defined by many of existing PMD's compat file. Can we at-least keep those which are already defined by several PMD's compat file?

Just to give a background - since we are new to dpdk community, we studied the already merged PMD's compat files as reference to understand how things are done for driver submission. And so, we wrote cxgbe compat file along similar lines. However, if above wrappers are not acceptable then, we will definitely remove them in V2.

Just trying to get a clarification so that we don't repeat the same mistake in V2 submission. Reviews from you and dpdk community are more than welcome and appreciated.

Thanks,
Rahul.

#6 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Quoted 106 lines · On Tue, 26 May 2015 22:32:07 +0530 Rahul Lakkireddy…
Quoted 92 lines · Rahul Lakkireddy
Quoted 82 lines · Stephen Hemminger
Quoted 79 lines · On Fri, 22 May 2015 18:54:20 +0530 Rahul Lakkireddy…
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +79 -0
+#define pr_err(y, args...) dev_err(0, y, ##args)
+#define pr_warn(y, args...) dev_warn(0, y, ##args)
+#define pr_info(y, args...) dev_info(0, y, ##args)
+#define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
+
+#define ASSERT(x) do {\
+	if (!(x)) \
+		rte_panic("CXGBE: x"); \
+} while (0)
+#define BUG_ON(x) ASSERT(!(x))
+
+#ifndef WARN_ON
+#define WARN_ON(x) do { \
+	int ret = !!(x); \
+	if (unlikely(ret)) \
+		pr_warn("WARN_ON: \"" #x "\" at %s:%d\n", __func__, __LINE__); \
+} while (0)
+#endif
+
+#define __iomem
+
+#ifndef BIT
+#define BIT(n) (1 << (n))
+#endif
+
+#define L1_CACHE_SHIFT  6
+#define L1_CACHE_BYTES  BIT(L1_CACHE_SHIFT)
+
+#define PAGE_SHIFT  12
+#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
+
+#define VLAN_HLEN 4
+
+#define rmb()     rte_rmb() /* dpdk rte provided rmb */
+#define wmb()     rte_wmb() /* dpdk rte provided wmb */
+
+typedef uint8_t   u8;
+typedef int8_t    s8;
+typedef uint16_t  u16;
+typedef uint32_t  u32;
+typedef int32_t   s32;
+typedef uint64_t  u64;
+typedef int       bool;
+typedef uint64_t  dma_addr_t;
+
+#ifndef __le16
+#define __le16	uint16_t
+#endif
+#ifndef __le32
+#define __le32	uint32_t
+#endif
+#ifndef __le64
+#define __le64	uint64_t
+#endif
+#ifndef __be16
+#define __be16	uint16_t
+#endif
+#ifndef __be32
+#define __be32	uint32_t
+#endif
+#ifndef __be64
+#define __be64	uint64_t
+#endif
+#ifndef __u8
+#define __u8	uint8_t
+#endif
+#ifndef __u16
+#define __u16	uint16_t
+#endif
+#ifndef __u32
+#define __u32	uint32_t
+#endif
+#ifndef __u64
+#define __u64	uint64_t
+#endif
+
+#define FALSE	0
+#define TRUE	1
Quoted 8 lines

lib/librte_pmd_cxgbe/cxgbe_compat.h line 176

Quoted 5 lines
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +5 -0
+#define false	0
+#define true	1
+
+#define min(a, b) RTE_MIN(a, b)
+#define max(a, b) RTE_MAX(a, b)

This is not Linux kernel.
Please don't create wrappers for all the stuff in Linux to port your driver.

Quoted 6 lines

We actually referred several PMD's compat file including - enic_compat.h, i40e_osdep.h, ixgbe_osdep.h, fm10k_osdep.h, etc.

Most of the types above are already defined by many of existing PMD's compat file. Can we at-least keep those which are already defined by several PMD's compat file?

Just to give a background - since we are new to dpdk community, we studied the already merged PMD's compat files as reference to understand how things are done for driver submission. And so, we wrote cxgbe compat file along similar lines. However, if above wrappers are not acceptable then, we will definitely remove them in V2.

Quoted 3 lines

Just trying to get a clarification so that we don't repeat the same mistake in V2 submission. Reviews from you and dpdk community are more than welcome and appreciated.

Does this driver share source code with other platforms? If it does then the compatibility wrappers make sense and reduce the maintenance effort. If the driver is a standalone port to DPDK, then it makes sense to complete the effort and use standard DPDK coding practices (stdint, stdbool, etc).

The other drivers in DPDK do things based on that. Many of the hardware drivers share code with BSD. Others like the virtual drivers were written or ported completely from scratch.

#7 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Quoted 8 lines · Stephen Hemminger
Quoted 5 lines · On Tue, 26 May 2015 22:32:07 +0530 Rahul Lakkireddy…
Quoted 4 lines · Rahul Lakkireddy
Quoted 3 lines · Stephen Hemminger

On Fri, 22 May 2015 18:54:20 +0530
Rahul Lakkireddy <[email protected]> wrote:

[...]

Quoted 17 lines
Quoted 17 lines
Quoted 10 lines
Quoted 3 lines

This is not Linux kernel.
Please don't create wrappers for all the stuff in Linux to port your driver.

We actually referred several PMD's compat file including - enic_compat.h, i40e_osdep.h, ixgbe_osdep.h, fm10k_osdep.h, etc.

Most of the types above are already defined by many of existing PMD's compat file. Can we at-least keep those which are already defined by several PMD's compat file?

Just to give a background - since we are new to dpdk community, we studied the already merged PMD's compat files as reference to understand how things are done for driver submission. And so, we wrote cxgbe compat file along similar lines. However, if above wrappers are not acceptable then, we will definitely remove them in V2.

Quoted 5 lines
Quoted 3 lines

Just trying to get a clarification so that we don't repeat the same mistake in V2 submission. Reviews from you and dpdk community are more than welcome and appreciated.

Does this driver share source code with other platforms?

Yes. The h/w specific code is common to Linux and FBSD.
And we will be enabling FBSD support soon after this PMD gets merged and we are able to carry out and complete testing on FBSD.

Quoted 9 lines

If it does then the compatibility wrappers make sense and reduce the maintenance effort.
If the driver is a standalone port to DPDK, then it makes sense to complete the effort and use standard DPDK coding practices (stdint, stdbool, etc).

The other drivers in DPDK do things based on that. Many of the hardware drivers share code with BSD. Others like the virtual drivers were written or ported completely from scratch.

Thank you for your guidance.

#8 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

In reply to Rahul Lakkireddy

lib/librte_pmd_cxgbe/cxgbe_compat.h line 223

Quoted 8 lines · On Fri, 22 May 2015 18:54:20 +0530 Rahul Lakkireddy…
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +8 -0
+/**
+ * fls - find last (most-significant) bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+static inline int fls(int x)

Isn't there a Gcc intrinsic already for this?

#9 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Quoted 13 lines · Stephen Hemminger

lib/librte_pmd_cxgbe/cxgbe_compat.h line 223

Quoted 8 lines · On Fri, 22 May 2015 18:54:20 +0530 Rahul Lakkireddy…
lib/librte_pmd_cxgbe/cxgbe_compat.h new file +8 -0
+/**
+ * fls - find last (most-significant) bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+static inline int fls(int x)

Isn't there a Gcc intrinsic already for this?

I guess you are referring to __builtin_clz ?
I will do that change in v2.

Thanks,
Rahul.

#10 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

In reply to Rahul Lakkireddy
Quoted 5 lines · On Fri, 22 May 2015 18:54:20 +0530 Rahul Lakkireddy…
lib/librte_pmd_cxgbe/cxgbe_ethdev.c new file +5 -0
+static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
+				 __rte_unused int wait_to_complete)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;

lib/librte_pmd_cxgbe/cxgbe_ethdev.c line 219

Quoted 10 lines
lib/librte_pmd_cxgbe/cxgbe_ethdev.c new file +10 -0
+	struct sge *s = &adapter->sge;
+	unsigned int work_done, budget = 4;
+	int ret;
+
+	cxgbe_poll(&s->fw_evtq, NULL, budget, &work_done);
+	ret = pi->link_cfg.link_ok;
+	eth_dev->data->dev_link.link_status = pi->link_cfg.link_ok;
+	eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	eth_dev->data->dev_link.link_speed = pi->link_cfg.speed;
+	return ret;

It is well not documented but link update is supposed to return 0 on link status changed and -1 if not changed.

#11 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Fri, 22 May 2015 18:54:20 +0530 Rahul Lakkireddy…
lib/librte_pmd_cxgbe/cxgbe_ethdev.c new file +10 -0
+static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
+				 __rte_unused int wait_to_complete)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct sge *s = &adapter->sge;
+	unsigned int work_done, budget = 4;
+	int ret;
+
+	cxgbe_poll(&s->fw_evtq, NULL, budget, &work_done);
Quoted 8 lines

lib/librte_pmd_cxgbe/cxgbe_ethdev.c line 219

Quoted 5 lines
lib/librte_pmd_cxgbe/cxgbe_ethdev.c new file +5 -0
+	ret = pi->link_cfg.link_ok;
+	eth_dev->data->dev_link.link_status = pi->link_cfg.link_ok;
+	eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	eth_dev->data->dev_link.link_speed = pi->link_cfg.speed;
+	return ret;

It is well not documented but link update is supposed to return 0 on link status changed and -1 if not changed.

Ok. We will correct the return value in v2 posting. We need to rebase anyway since PMDs now seem to have moved to drivers/net directory.

Thanks,
Rahul.

#12 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

2015-05-23 11:23, Rahul Lakkireddy:

Quoted 2 lines

We need to rebase anyway since PMDs now seem to have moved to drivers/net directory.

Yes. And the subdirectory should probably be renamed base/.

It would be nice to introduce the PMD features in separate patches as it was done for fm10k.

Thanks

#13 lore raw

Re: [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Quoted 5 lines · Thomas Monjalon

2015-05-23 11:23, Rahul Lakkireddy:

Quoted 2 lines

We need to rebase anyway since PMDs now seem to have moved to drivers/net directory.

Yes. And the subdirectory should probably be renamed base/.

Yes, we will do this.

Quoted 5 lines

It would be nice to introduce the PMD features in separate patches as it was done for fm10k.

Thanks

Ok. We will break this patch into several separate patches for v2 submission.

Thanks,
Rahul.

#14 lore raw

PATCH 3/5 doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

In reply to Rahul Lakkireddy

Adds cxgbe poll mode driver documentation under the usual doc/guides/nics/ directory with the rest of the drivers. The documentation covers cxgbe implementation details, features and limitations, prerequisites, configuration, and a sample application usage.

---
 doc/guides/nics/cxgbe.rst            |  209 ++++++++++++++++++++++++++++++++++
 doc/guides/nics/index.rst            |    1 +
 doc/guides/prog_guide/source_org.rst |    1 +
 3 files changed, 211 insertions(+), 0 deletions(-)
 create mode 100644 doc/guides/nics/cxgbe.rst
doc/guides/nics/cxgbe.rst new file +209 -0
new file mode 100644
index 0000000..71f21a6
@@ -0,0 +1,209 @@
+..  BSD LICENSE
+    Copyright 2015 Chelsio Communications.
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+    * Neither the name of Chelsio Communications nor the names of its
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+CXGBE Poll Mode Driver
+======================
+
+The CXGBE PMD (**librte_pmd_cxgbe**) provides poll mode driver support
+for **Chelsio T5** 10/40 Gbps family of adapters.
+
+More information can be found at `Chelsio Communications
+<http://www.chelsio.com>`_.
+
+Features
+--------
+
+CXGBE PMD has the support for:
+
+- Multiple queues for TX and RX.
+- Receiver Side Steering (RSS).
+- VLAN filtering.
+- Checksum offload.
+- Promiscuous mode.
+- All multicast mode.
+- Port hardware statistics.
+
+Limitations
+-----------
+
+The Chelsio T5 devices provide two/four ports but expose only a single PCI bus
+address. Thus, librte_pmd_cxgbe registers itself as a PCI driver that allocates
+one Ethernet device per detected port.
+
+For this reason, one cannot white/blacklist a single port without also
+white/blacklisting the others on the same device.
+
+Configuration
+-------------
+
+Compiling CXGBE PMD
+~~~~~~~~~~~~~~~~~~~
+
+These options can be modified in the ``.config`` file.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_PMD`` (default **y**)
+
+  Toggle compilation of librte_pmd_cxgbe driver.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional generic debugging
+  messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional registers related
+  run-time checks and debugging messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional firmware mailbox
+  related run-time checks and debugging messages at the cost of lower
+  performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional transmission data
+  path run-time checks and debugging messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional receiving data
+  path run-time checks and debugging messages at the cost of lower performance.
+
+Prerequisites
+-------------
+
+- Requires firmware version **1.13.32.0** and higher. Visit
+  `Chelsio Communications <http://www.chelsio.com>`_ to get latest firmware.
+
+Sample Application Notes
+-------------------------
+
+This section demonstrates how to launch **testpmd** with Chelsio T5
+devices managed by librte_pmd_cxgbe.
+
+#. Load the kernel module:
+
+   .. code-block:: console
+
+      modprobe cxgb4
+
+#. Get the PCI bus addresses of the interfaces bound to cxgb4 driver:
+
+   .. code-block:: console
+
+      dmesg | tail -2
+
+   Example output:
+
+   .. code-block:: console
+
+      cxgb4 0000:02:00.4 p1p1: renamed from eth0
+      cxgb4 0000:02:00.4 p1p2: renamed from eth1
+
+   .. note::
+
+      Both the interfaces of a Chelsio T5 2-port adapter are bound to the
+      same PCI bus address.
+
+#. Unload the kernel module:
+
+   .. code-block:: console
+
+      modprobe -ar cxgb4 csiostor
+
+#. Request huge pages:
+
+   .. code-block:: console
+
+      echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages/nr_hugepages
+
+#. Load igb_uio or vfio-pci driver:
+
+   .. code-block:: console
+
+      insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
+
+   or
+
+   .. code-block:: console
+
+      modprobe vfio-pci
+
+#. Bind the Chelsio T5 adapters to igb_uio or vfio-pci loaded in the previous
+   step:
+
+   .. code-block:: console
+
+      ./tools/dpdk_nic_bind.py --bind igb_uio 0000:02:00.4
+
+   or
+
+   Setup VFIO permissions for regular users and then bind to vfio-pci:
+
+   .. code-block:: console
+
+      sudo chmod a+x /dev/vfio
+
+      sudo chmod 0666 /dev/vfio/*
+
+      ./tools/dpdk_nic_bind.py --bind vfio-pci 0000:02:00.4
+
+#. Start testpmd with basic parameters:
+
+   .. code-block:: console
+
+      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 4 -w 0000:02:00.4 -- -i
+
+   Example output:
+
+   .. code-block:: console
+
+      [...]
+      EAL: PCI device 0000:02:00.4 on NUMA socket -1
+      EAL:   probe driver: 1425:5401 rte_cxgbe_pmd
+      EAL:   PCI memory mapped at 0x7fd7c0200000
+      EAL:   PCI memory mapped at 0x7fd77cdfd000
+      EAL:   PCI memory mapped at 0x7fd7c10b7000
+      PMD: rte_cxgbe_pmd: fw: 1.13.33.0, TP: 0.1.4.8
+      PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
+      Interactive-mode selected
+      Configuring Port 0 (socket 0)
+      Port 0: 00:07:43:2D:EA:C0
+      Configuring Port 1 (socket 0)
+      Port 1: 00:07:43:2D:EA:C8
+      Checking link statuses...
+      PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
+      PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
+      Port 0 Link Up - speed 10000 Mbps - full-duplex
+      Port 1 Link Up - speed 10000 Mbps - full-duplex
+      Done
+      testpmd>
doc/guides/nics/index.rst +1 -0
index aadbae3..295ffa2 100644
@@ -44,6 +44,7 @@ Network Interface Controller Drivers
     ixgbe
     intel_vf
     mlx4
+    cxgbe
     virtio
     vmxnet3
     pcap_ring
doc/guides/prog_guide/source_org.rst +1 -0
index 1bce0b8..d5f10cd 100644
@@ -80,6 +80,7 @@ The lib directory contains::
     +-- librte_meter        # QoS metering library
     +-- librte_net          # various IP-related headers
     +-- librte_pmd_bond     # bonding poll mode driver
+    +-- librte_pmd_cxgbe    # Chelsio Terminator 10GbE/40GbE poll mode driver
     +-- librte_pmd_e1000    # 1GbE poll mode drivers (igb and em)
     +-- librte_pmd_fm10k    # Host interface PMD driver for FM10000 Series
     +-- librte_pmd_ixgbe    # 10GbE poll mode driver
Signature · 1 line
1.7.1
#15 lore raw

Re: [PATCH 3/5] doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

2015-05-22 18:54, Rahul Lakkireddy:

Quoted 7 lines

Adds cxgbe poll mode driver documentation under the usual doc/guides/nics/ directory with the rest of the drivers. The documentation covers cxgbe implementation details, features and limitations, prerequisites, configuration, and a sample application usage.

Nice documentation, thank you.
Do not hesitate to add some design insights which would help tuning or maintenance.

doc/guides/nics/index.rst Network Interface Controller Drivers · line 49

Quoted 9 lines
doc/guides/nics/index.rst +1 -0
@@ -44,6 +44,7 @@ Network Interface Controller Drivers
     ixgbe
     intel_vf
     mlx4
+    cxgbe
     virtio
     vmxnet3

Please add it in the alphabetical order.

#16 lore raw

Re: [PATCH 3/5] doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

Quoted 6 lines · Thomas Monjalon

2015-05-22 18:54, Rahul Lakkireddy:

Quoted 5 lines

Adds cxgbe poll mode driver documentation under the usual doc/guides/nics/ directory with the rest of the drivers. The documentation covers cxgbe implementation details, features and limitations, prerequisites, configuration, and a sample application usage.

Quoted 6 lines
Quoted 2 lines

Nice documentation, thank you.
Do not hesitate to add some design insights which would help tuning or maintenance.

Sure. I will figure out if something can be added to documentation for tuning part.

Quoted 12 lines

doc/guides/nics/index.rst Network Interface Controller Drivers · line 49

Quoted 10 lines
doc/guides/nics/index.rst +1 -0
@@ -44,6 +44,7 @@ Network Interface Controller Drivers
     ixgbe
     intel_vf
     mlx4
+    cxgbe
     virtio
     vmxnet3

Please add it in the alphabetical order.

Ok. Will correct this in v2.

Thanks,
Rahul.

#17 lore raw

PATCH 4/5 config: enable cxgbe PMD for compilation and linking.

In reply to Rahul Lakkireddy

Changes to:
1. config/common_linuxapp to add macros for cxgbe pmd.
2. lib/Makefile to add cxgbe pmd to the compile list.
3. mk/rte.app.mk to add cxgbe pmd to link.

---
 config/common_linuxapp |   10 ++++++++++
 lib/Makefile           |    1 +
 mk/rte.app.mk          |    1 +
 3 files changed, 12 insertions(+), 0 deletions(-)
config/common_linuxapp +10 -0
index 0078dc9..dfafd45 100644
@@ -208,6 +208,16 @@ CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8
 CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1
 
 #
+# Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
+#
+CONFIG_RTE_LIBRTE_CXGBE_PMD=y
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n
+
+#
 # Compile burst-oriented Cisco ENIC PMD driver
 #
 CONFIG_RTE_LIBRTE_ENIC_PMD=y
lib/Makefile +1 -0
index d94355d..19beb28 100644
@@ -46,6 +46,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_ixgbe
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e
 DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += librte_pmd_fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += librte_pmd_mlx4
+DIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += librte_pmd_cxgbe
 DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += librte_pmd_enic
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring
mk/rte.app.mk +1 -0
index 1a2043a..0ed9651 100644
@@ -128,6 +128,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)      += -lrte_pmd_fm10k
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)      += -lrte_pmd_ixgbe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD)      += -lrte_pmd_e1000
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -lrte_pmd_mlx4
+_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD)      += -lrte_pmd_cxgbe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)       += -lrte_pmd_ring
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lrte_pmd_pcap
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET)  += -lrte_pmd_af_packet
Signature · 1 line
1.7.1
#18 lore raw

PATCH 5/5 maintainers: claim responsibility for cxgbe PMD.

In reply to Rahul Lakkireddy

Update MAINTAINERS file to claim responsibility for the cxgbe PMD.

---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index 0477e7d..37b7472 100644
@@ -239,6 +239,11 @@ M: Adrien Mazarguil <[email protected]>
 F: lib/librte_pmd_mlx4/
 F: doc/guides/nics/mlx4.rst
 
+Chelsio cxgbe
+M: Rahul Lakkireddy <[email protected]>
+F: lib/librte_pmd_cxgbe/
+F: doc/guides/nics/cxgbe.rst
+
 RedHat virtio
 M: Changchun Ouyang <[email protected]>
 F: lib/librte_pmd_virtio/
Signature · 1 line
1.7.1
#19 lore raw

v2 cover Chelsio Terminator 5 (T5) 10G/40G Poll Mode Driver

In reply to Rahul Lakkireddy

This series of patches add the CXGBE Poll Mode Driver support for Chelsio Terminator 5 series of 10G/40G adapters. The CXGBE PMD is split into multiple patches. The first patch adds the hardware specific api for all supported Chelsio T5 adapters and the patches from 2 to 8 add the actual DPDK CXGBE PMD.

More information on the CXGBE PMD can be found in the documentation added by patch 9. Also, the CXGBE PMD is enabled for compilation and linking by patch 10. Finally, update MAINTAINERS file to claim responsibility for the CXGBE PMD.

v2:
- Move the driver to drivers/net directory and update all config files and commit logs. Also update MAINTAINERS.
- Break the second patch into more patches; incrementally, adding features to the cxgbe poll mode driver.
- Replace bitwise operations in finding last (most significant) bit set with gcc's __builtin_clz.
- Fix the return value returned by link update eth_dev operation.
- Few bug fixes and code cleanup.

Rahul Lakkireddy (11):
cxgbe: add hardware specific api for all supported Chelsio T5 series
adapters.
cxgbe: add cxgbe poll mode driver.
cxgbe: add device configuration and RX support for cxgbe PMD.
cxgbe: add TX support for cxgbe PMD.
cxgbe: add device related operations for cxgbe PMD.
cxgbe: add port statistics for cxgbe PMD.
cxgbe: add link related functions for cxgbe PMD.
cxgbe: add flow control functions for cxgbe PMD.
doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst
config: enable cxgbe PMD for compilation and linking.
maintainers: claim responsibility for cxgbe PMD.

 MAINTAINERS                             |    5 +
 config/common_linuxapp                  |   10 +
 doc/guides/nics/cxgbe.rst               |  209 +++
 doc/guides/nics/index.rst               |    1 +
 doc/guides/prog_guide/source_org.rst    |    1 +
 drivers/net/Makefile                    |    1 +
 drivers/net/cxgbe/Makefile              |   74 +
 drivers/net/cxgbe/base/adapter.h        |  565 +++++++
 drivers/net/cxgbe/base/common.h         |  401 +++++
 drivers/net/cxgbe/base/t4_chip_type.h   |   79 +
 drivers/net/cxgbe/base/t4_hw.c          | 2686 +++++++++++++++++++++++++++++++
 drivers/net/cxgbe/base/t4_hw.h          |  149 ++
 drivers/net/cxgbe/base/t4_msg.h         |  345 ++++
 drivers/net/cxgbe/base/t4_pci_id_tbl.h  |  148 ++
 drivers/net/cxgbe/base/t4_regs.h        |  779 +++++++++
 drivers/net/cxgbe/base/t4_regs_values.h |  168 ++
 drivers/net/cxgbe/base/t4fw_interface.h | 1730 ++++++++++++++++++++
 drivers/net/cxgbe/cxgbe.h               |   60 +
 drivers/net/cxgbe/cxgbe_compat.h        |  266 +++
 drivers/net/cxgbe/cxgbe_ethdev.c        |  802 +++++++++
 drivers/net/cxgbe/cxgbe_main.c          | 1207 ++++++++++++++
 drivers/net/cxgbe/sge.c                 | 2253 ++++++++++++++++++++++++++
 mk/rte.app.mk                           |    1 +
 23 files changed, 11940 insertions(+)
 create mode 100644 doc/guides/nics/cxgbe.rst
 create mode 100644 drivers/net/cxgbe/Makefile
 create mode 100644 drivers/net/cxgbe/base/adapter.h
 create mode 100644 drivers/net/cxgbe/base/common.h
 create mode 100644 drivers/net/cxgbe/base/t4_chip_type.h
 create mode 100644 drivers/net/cxgbe/base/t4_hw.c
 create mode 100644 drivers/net/cxgbe/base/t4_hw.h
 create mode 100644 drivers/net/cxgbe/base/t4_msg.h
 create mode 100644 drivers/net/cxgbe/base/t4_pci_id_tbl.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs_values.h
 create mode 100644 drivers/net/cxgbe/base/t4fw_interface.h
 create mode 100644 drivers/net/cxgbe/cxgbe.h
 create mode 100644 drivers/net/cxgbe/cxgbe_compat.h
 create mode 100644 drivers/net/cxgbe/cxgbe_ethdev.c
 create mode 100644 drivers/net/cxgbe/cxgbe_main.c
 create mode 100644 drivers/net/cxgbe/sge.c
Signature · 1 line
2.4.1
#20 lore raw

PATCH v2 1/11 cxgbe: add hardware specific api for all supported Chelsio T5 series adapters.

Adds hardware specific api for all the Chelsio T5 adapters under drivers/net/cxgbe/base directory.

---
v2:
- Move files to new directory under drivers/net/cxgbe/base and update commit log.
- Few bug fixes related to tx.

 drivers/net/cxgbe/base/adapter.h        |  565 +++++++
 drivers/net/cxgbe/base/common.h         |  401 +++++
 drivers/net/cxgbe/base/t4_chip_type.h   |   79 +
 drivers/net/cxgbe/base/t4_hw.c          | 2686 +++++++++++++++++++++++++++++++
 drivers/net/cxgbe/base/t4_hw.h          |  149 ++
 drivers/net/cxgbe/base/t4_msg.h         |  345 ++++
 drivers/net/cxgbe/base/t4_pci_id_tbl.h  |  148 ++
 drivers/net/cxgbe/base/t4_regs.h        |  779 +++++++++
 drivers/net/cxgbe/base/t4_regs_values.h |  168 ++
 drivers/net/cxgbe/base/t4fw_interface.h | 1730 ++++++++++++++++++++
 10 files changed, 7050 insertions(+)
 create mode 100644 drivers/net/cxgbe/base/adapter.h
 create mode 100644 drivers/net/cxgbe/base/common.h
 create mode 100644 drivers/net/cxgbe/base/t4_chip_type.h
 create mode 100644 drivers/net/cxgbe/base/t4_hw.c
 create mode 100644 drivers/net/cxgbe/base/t4_hw.h
 create mode 100644 drivers/net/cxgbe/base/t4_msg.h
 create mode 100644 drivers/net/cxgbe/base/t4_pci_id_tbl.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs_values.h
 create mode 100644 drivers/net/cxgbe/base/t4fw_interface.h
drivers/net/cxgbe/base/adapter.h new file +565 -0
new file mode 100644
index 0000000..0ea1c95
@@ -0,0 +1,565 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014-2015 Chelsio Communications.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Chelsio Communications nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* This file should not be included directly.  Include common.h instead. */
+
+#ifndef __T4_ADAPTER_H__
+#define __T4_ADAPTER_H__
+
+#include <rte_mbuf.h>
+
+#include "cxgbe_compat.h"
+#include "t4_regs_values.h"
+
+enum {
+	MAX_ETH_QSETS = 64,           /* # of Ethernet Tx/Rx queue sets */
+};
+
+struct adapter;
+struct sge_rspq;
+
+enum {
+	PORT_RSS_DONE = (1 << 0),
+};
+
+struct port_info {
+	struct adapter *adapter;        /* adapter that this port belongs to */
+	struct rte_eth_dev *eth_dev;    /* associated rte eth device */
+	struct port_stats stats_base;   /* port statistics base */
+	struct link_config link_cfg;    /* link configuration info */
+
+	unsigned long flags;            /* port related flags */
+	short int xact_addr_filt;       /* index of exact MAC address filter */
+
+	u16    viid;                    /* associated virtual interface id */
+	s8     mdio_addr;               /* address of the PHY */
+	u8     port_type;               /* firmware port type */
+	u8     mod_type;                /* firmware module type */
+	u8     port_id;                 /* physical port ID */
+	u8     tx_chan;                 /* associated channel */
+
+	u8     n_rx_qsets;              /* # of rx qsets */
+	u8     n_tx_qsets;              /* # of tx qsets */
+	u8     first_qset;              /* index of first qset */
+
+	u16    *rss;                    /* rss table */
+	u8     rss_mode;                /* rss mode */
+	u16    rss_size;                /* size of VI's RSS table slice */
+};
+
+/* Enable or disable autonegotiation.  If this is set to enable,
+ * the forced link modes above are completely ignored.
+ */
+#define AUTONEG_DISABLE         0x00
+#define AUTONEG_ENABLE          0x01
+
+enum {                                 /* adapter flags */
+	FULL_INIT_DONE     = (1 << 0),
+	USING_MSI          = (1 << 1),
+	USING_MSIX         = (1 << 2),
+	FW_QUEUE_BOUND     = (1 << 3),
+	FW_OK              = (1 << 4),
+	CFG_QUEUES	   = (1 << 5),
+	MASTER_PF          = (1 << 6),
+};
+
+struct rx_sw_desc {                /* SW state per Rx descriptor */
+	void *buf;                 /* struct page or mbuf */
+	dma_addr_t dma_addr;
+};
+
+struct sge_fl {                     /* SGE free-buffer queue state */
+	/* RO fields */
+	struct rx_sw_desc *sdesc;   /* address of SW Rx descriptor ring */
+
+	dma_addr_t addr;            /* bus address of HW ring start */
+	__be64 *desc;               /* address of HW Rx descriptor ring */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cntxt_id;      /* SGE relative QID for the free list */
+	unsigned int size;          /* capacity of free list */
+
+	unsigned int avail;         /* # of available Rx buffers */
+	unsigned int pend_cred;     /* new buffers since last FL DB ring */
+	unsigned int cidx;          /* consumer index */
+	unsigned int pidx;          /* producer index */
+
+	unsigned long alloc_failed; /* # of times buffer allocation failed */
+	unsigned long low;          /* # of times momentarily starving */
+};
+
+#define MAX_MBUF_FRAGS (16384 / 512 + 2)
+
+/* A packet gather list */
+struct pkt_gl {
+	union {
+		struct rte_mbuf *mbufs[MAX_MBUF_FRAGS];
+	} /* UNNAMED */;
+	void *va;                         /* virtual address of first byte */
+	unsigned int nfrags;              /* # of fragments */
+	unsigned int tot_len;             /* total length of fragments */
+	bool usembufs;                    /* use mbufs for fragments */
+};
+
+typedef int (*rspq_handler_t)(struct sge_rspq *q, const __be64 *rsp,
+			      const struct pkt_gl *gl);
+
+struct sge_rspq {                   /* state for an SGE response queue */
+	struct adapter *adapter;      /* adapter that this queue belongs to */
+	struct rte_eth_dev *eth_dev;  /* associated rte eth device */
+	struct rte_mempool  *mb_pool; /* associated mempool */
+
+	dma_addr_t phys_addr;       /* physical address of the ring */
+	__be64 *desc;               /* address of HW response ring */
+	const __be64 *cur_desc;     /* current descriptor in queue */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cidx;          /* consumer index */
+	unsigned int iqe_len;       /* entry size */
+	unsigned int size;          /* capacity of response queue */
+	int offset;                 /* offset into current Rx buffer */
+
+	u8 gen;                     /* current generation bit */
+	u8 intr_params;             /* interrupt holdoff parameters */
+	u8 next_intr_params;        /* holdoff params for next interrupt */
+	u8 pktcnt_idx;              /* interrupt packet threshold */
+	u8 idx;                     /* queue index within its group */
+	u16 cntxt_id;               /* SGE relative QID for the response Q */
+	u16 abs_id;                 /* absolute SGE id for the response q */
+
+	rspq_handler_t handler;     /* associated handler for this response q */
+};
+
+struct sge_eth_rx_stats {	/* Ethernet rx queue statistics */
+	u64 pkts;		/* # of ethernet packets */
+	u64 rx_bytes;		/* # of ethernet bytes */
+	u64 rx_cso;		/* # of Rx checksum offloads */
+	u64 vlan_ex;		/* # of Rx VLAN extractions */
+	u64 rx_drops;		/* # of packets dropped due to no mem */
+};
+
+struct sge_eth_rxq {                /* a SW Ethernet Rx queue */
+	struct sge_rspq rspq;
+	struct sge_fl fl;
+	struct sge_eth_rx_stats stats;
+	bool usembufs;               /* one ingress packet per mbuf FL buffer */
+} __rte_cache_aligned;
+
+/*
+ * Currently there are two types of coalesce WR. Type 0 needs 48 bytes per
+ * packet (if one sgl is present) and type 1 needs 32 bytes. This means
+ * that type 0 can fit a maximum of 10 packets per WR and type 1 can fit
+ * 15 packets. We need to keep track of the mbuf pointers in a coalesce WR
+ * to be able to free those mbufs when we get completions back from the FW.
+ * Allocating the maximum number of pointers in every tx desc is a waste
+ * of memory resources so we only store 2 pointers per tx desc which should
+ * be enough since a tx desc can only fit 2 packets in the best case
+ * scenario where a packet needs 32 bytes.
+ */
+#define ETH_COALESCE_PKT_NUM 15
+#define ETH_COALESCE_PKT_PER_DESC 2
+
+struct tx_eth_coal_desc {
+	struct rte_mbuf *mbuf[ETH_COALESCE_PKT_PER_DESC];
+	struct ulptx_sgl *sgl[ETH_COALESCE_PKT_PER_DESC];
+	int idx;
+};
+
+struct tx_desc {
+	__be64 flit[8];
+};
+
+struct tx_sw_desc {                /* SW state per Tx descriptor */
+	struct rte_mbuf *mbuf;
+	struct ulptx_sgl *sgl;
+	struct tx_eth_coal_desc coalesce;
+};
+
+enum {
+	EQ_STOPPED = (1 << 0),
+};
+
+struct eth_coalesce {
+	unsigned char *ptr;
+	unsigned char type;
+	unsigned int idx;
+	unsigned int len;
+	unsigned int flits;
+	unsigned int max;
+};
+
+struct sge_txq {
+	struct tx_desc *desc;       /* address of HW Tx descriptor ring */
+	struct tx_sw_desc *sdesc;   /* address of SW Tx descriptor ring */
+	struct sge_qstat *stat;     /* queue status entry */
+	struct eth_coalesce coalesce; /* coalesce info */
+
+	uint64_t phys_addr;         /* physical address of the ring */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cntxt_id;     /* SGE relative QID for the Tx Q */
+	unsigned int in_use;       /* # of in-use Tx descriptors */
+	unsigned int size;         /* # of descriptors */
+	unsigned int cidx;         /* SW consumer index */
+	unsigned int pidx;         /* producer index */
+	unsigned int dbidx;	   /* last idx when db ring was done */
+	unsigned int equeidx;	   /* last sent credit request */
+	unsigned int last_pidx;	   /* last pidx recorded by tx monitor */
+	unsigned int last_coal_idx;/* last coal-idx recorded by tx monitor */
+
+	int db_disabled;            /* doorbell state */
+	unsigned short db_pidx;     /* doorbell producer index */
+	unsigned short db_pidx_inc; /* doorbell producer increment */
+};
+
+struct sge_eth_tx_stats {	/* Ethernet tx queue statistics */
+	u64 pkts;		/* # of ethernet packets */
+	u64 tx_bytes;		/* # of ethernet bytes */
+	u64 tso;		/* # of TSO requests */
+	u64 tx_cso;		/* # of Tx checksum offloads */
+	u64 vlan_ins;		/* # of Tx VLAN insertions */
+	u64 mapping_err;	/* # of I/O MMU packet mapping errors */
+	u64 coal_wr;            /* # of coalesced wr */
+	u64 coal_pkts;          /* # of coalesced packets */
+};
+
+struct sge_eth_txq {                   /* state for an SGE Ethernet Tx queue */
+	struct sge_txq q;
+	struct rte_eth_dev *eth_dev;   /* port that this queue belongs to */
+	struct sge_eth_tx_stats stats; /* queue statistics */
+	rte_spinlock_t txq_lock;
+
+	unsigned int flags;            /* flags for state of the queue */
+} __rte_cache_aligned;
+
+struct sge {
+	struct sge_eth_txq ethtxq[MAX_ETH_QSETS];
+	struct sge_eth_rxq ethrxq[MAX_ETH_QSETS];
+	struct sge_rspq fw_evtq __rte_cache_aligned;
+
+	u16 max_ethqsets;           /* # of available Ethernet queue sets */
+	u32 stat_len;               /* length of status page at ring end */
+	u32 pktshift;               /* padding between CPL & packet data */
+
+	/* response queue interrupt parameters */
+	u16 timer_val[SGE_NTIMERS];
+	u8  counter_val[SGE_NCOUNTERS];
+
+	u32 fl_align;               /* response queue message alignment */
+	u32 fl_pg_order;            /* large page allocation size */
+	u32 fl_starve_thres;        /* Free List starvation threshold */
+};
+
+#define T4_OS_NEEDS_MBOX_LOCKING 1
+
+/*
+ * OS Lock/List primitives for those interfaces in the Common Code which
+ * need this.
+ */
+
+struct mbox_entry {
+	TAILQ_ENTRY(mbox_entry) next;
+};
+
+TAILQ_HEAD(mbox_list, mbox_entry);
+
+struct adapter {
+	struct rte_pci_device *pdev;       /* associated rte pci device */
+	struct rte_eth_dev *eth_dev;       /* first port's rte eth device */
+	struct adapter_params params;      /* adapter parameters */
+	struct port_info port[MAX_NPORTS]; /* ports belonging to this adapter */
+	struct sge sge;                    /* associated SGE */
+
+	/* support for single-threading access to adapter mailbox registers */
+	struct mbox_list mbox_list;
+	rte_spinlock_t mbox_lock;
+
+	u8 *regs;              /* pointer to registers region */
+	u8 *bar2;              /* pointer to bar2 region */
+	unsigned long flags;   /* adapter flags */
+	unsigned int mbox;     /* associated mailbox */
+	unsigned int pf;       /* associated physical function id */
+
+	int use_unpacked_mode; /* unpacked rx mode state */
+};
+
+#define CXGBE_PCI_REG(reg) (*((volatile uint32_t *)(reg)))
+
+static inline uint64_t cxgbe_read_addr64(volatile void *addr)
+{
+	uint64_t val = CXGBE_PCI_REG(addr);
+	uint64_t val2 = CXGBE_PCI_REG(((volatile uint8_t *)(addr) + 4));
+
+	val2 = (uint64_t)(val2 << 32);
+	val += val2;
+	return val;
+}
+
+static inline uint32_t cxgbe_read_addr(volatile void *addr)
+{
+	return CXGBE_PCI_REG(addr);
+}
+
+#define CXGBE_PCI_REG_ADDR(adap, reg) \
+	((volatile uint32_t *)((char *)(adap)->regs + (reg)))
+
+#define CXGBE_READ_REG(adap, reg) \
+	cxgbe_read_addr(CXGBE_PCI_REG_ADDR((adap), (reg)))
+
+#define CXGBE_READ_REG64(adap, reg) \
+	cxgbe_read_addr64(CXGBE_PCI_REG_ADDR((adap), (reg)))
+
+#define CXGBE_PCI_REG_WRITE(reg, value) ({ \
+	CXGBE_PCI_REG((reg)) = (value); })
+
+#define CXGBE_WRITE_REG(adap, reg, value) \
+	CXGBE_PCI_REG_WRITE(CXGBE_PCI_REG_ADDR((adap), (reg)), (value))
+
+static inline uint64_t cxgbe_write_addr64(volatile void *addr, uint64_t val)
+{
+	CXGBE_PCI_REG(addr) = val;
+	CXGBE_PCI_REG(((volatile uint8_t *)(addr) + 4)) = (val >> 32);
+	return val;
+}
+
+#define CXGBE_WRITE_REG64(adap, reg, value) \
+	cxgbe_write_addr64(CXGBE_PCI_REG_ADDR((adap), (reg)), (value))
+
+/**
+ * t4_read_reg - read a HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ *
+ * Returns the 32-bit value of the given HW register.
+ */
+static inline u32 t4_read_reg(struct adapter *adapter, u32 reg_addr)
+{
+	u32 val = CXGBE_READ_REG(adapter, reg_addr);
+
+	CXGBE_DEBUG_REG(adapter, "read register 0x%x value 0x%x\n", reg_addr,
+			val);
+	return val;
+}
+
+/**
+ * t4_write_reg - write a HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ * @val: the value to write
+ *
+ * Write a 32-bit value into the given HW register.
+ */
+static inline void t4_write_reg(struct adapter *adapter, u32 reg_addr, u32 val)
+{
+	CXGBE_DEBUG_REG(adapter, "setting register 0x%x to 0x%x\n", reg_addr,
+			val);
+	CXGBE_WRITE_REG(adapter, reg_addr, val);
+}
+
+/**
+ * t4_read_reg64 - read a 64-bit HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ *
+ * Returns the 64-bit value of the given HW register.
+ */
+static inline u64 t4_read_reg64(struct adapter *adapter, u32 reg_addr)
+{
+	u64 val = CXGBE_READ_REG64(adapter, reg_addr);
+
+	CXGBE_DEBUG_REG(adapter, "64-bit read register %#x value %#llx\n",
+			reg_addr, (unsigned long long)val);
+	return val;
+}
+
+/**
+ * t4_write_reg64 - write a 64-bit HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ * @val: the value to write
+ *
+ * Write a 64-bit value into the given HW register.
+ */
+static inline void t4_write_reg64(struct adapter *adapter, u32 reg_addr,
+				  u64 val)
+{
+	CXGBE_DEBUG_REG(adapter, "setting register %#x to %#llx\n", reg_addr,
+			(unsigned long long)val);
+
+	CXGBE_WRITE_REG64(adapter, reg_addr, val);
+}
+
+/**
+ * t4_os_set_hw_addr - store a port's MAC address in SW
+ * @adapter: the adapter
+ * @port_idx: the port index
+ * @hw_addr: the Ethernet address
+ *
+ * Store the Ethernet address of the given port in SW.  Called by the
+ * common code when it retrieves a port's Ethernet address from EEPROM.
+ */
+static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx,
+				     u8 hw_addr[])
+{
+	struct port_info *pi = &adapter->port[port_idx];
+
+	ether_addr_copy((struct ether_addr *)hw_addr,
+			&pi->eth_dev->data->mac_addrs[0]);
+}
+
+/**
+ * t4_os_lock_init - initialize spinlock
+ * @lock: the spinlock
+ */
+static inline void t4_os_lock_init(rte_spinlock_t *lock)
+{
+	rte_spinlock_init(lock);
+}
+
+/**
+ * t4_os_lock - spin until lock is acquired
+ * @lock: the spinlock
+ */
+static inline void t4_os_lock(rte_spinlock_t *lock)
+{
+	rte_spinlock_lock(lock);
+}
+
+/**
+ * t4_os_unlock - unlock a spinlock
+ * @lock: the spinlock
+ */
+static inline void t4_os_unlock(rte_spinlock_t *lock)
+{
+	rte_spinlock_unlock(lock);
+}
+
+/**
+ * t4_os_init_list_head - initialize
+ * @head: head of list to initialize [to empty]
+ */
+static inline void t4_os_init_list_head(struct mbox_list *head)
+{
+	TAILQ_INIT(head);
+}
+
+static inline struct mbox_entry *t4_os_list_first_entry(struct mbox_list *head)
+{
+	return TAILQ_FIRST(head);
+}
+
+/**
+ * t4_os_atomic_add_tail - Enqueue list element atomically onto list
+ * @new: the entry to be addded to the queue
+ * @head: current head of the linked list
+ * @lock: lock to use to guarantee atomicity
+ */
+static inline void t4_os_atomic_add_tail(struct mbox_entry *entry,
+					 struct mbox_list *head,
+					 rte_spinlock_t *lock)
+{
+	t4_os_lock(lock);
+	TAILQ_INSERT_TAIL(head, entry, next);
+	t4_os_unlock(lock);
+}
+
+/**
+ * t4_os_atomic_list_del - Dequeue list element atomically from list
+ * @entry: the entry to be remove/dequeued from the list.
+ * @lock: the spinlock
+ */
+static inline void t4_os_atomic_list_del(struct mbox_entry *entry,
+					 struct mbox_list *head,
+					 rte_spinlock_t *lock)
+{
+	t4_os_lock(lock);
+	TAILQ_REMOVE(head, entry, next);
+	t4_os_unlock(lock);
+}
+
+/**
+ * adap2pinfo - return the port_info of a port
+ * @adap: the adapter
+ * @idx: the port index
+ *
+ * Return the port_info structure for the port of the given index.
+ */
+static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
+{
+	return &adap->port[idx];
+}
+
+void *t4_alloc_mem(size_t size);
+void t4_free_mem(void *addr);
+#define t4_os_alloc(_size)     t4_alloc_mem((_size))
+#define t4_os_free(_ptr)       t4_free_mem((_ptr))
+
+void t4_os_portmod_changed(const struct adapter *adap, int port_id);
+void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
+
+void reclaim_completed_tx(struct sge_txq *q);
+void t4_free_sge_resources(struct adapter *adap);
+void t4_sge_tx_monitor_start(struct adapter *adap);
+void t4_sge_tx_monitor_stop(struct adapter *adap);
+int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf);
+int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
+		     const struct pkt_gl *gl);
+int t4_sge_init(struct adapter *adap);
+int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
+			 struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			 unsigned int iqid, int socket_id);
+int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *rspq, bool fwevtq,
+		     struct rte_eth_dev *eth_dev, int intr_idx,
+		     struct sge_fl *fl, rspq_handler_t handler,
+		     int cong, struct rte_mempool *mp, int queue_id,
+		     int socket_id);
+int t4_sge_eth_txq_start(struct sge_eth_txq *txq);
+int t4_sge_eth_txq_stop(struct sge_eth_txq *txq);
+void t4_sge_eth_txq_release(struct adapter *adap, struct sge_eth_txq *txq);
+int t4_sge_eth_rxq_start(struct adapter *adap, struct sge_rspq *rq);
+int t4_sge_eth_rxq_stop(struct adapter *adap, struct sge_rspq *rq);
+void t4_sge_eth_rxq_release(struct adapter *adap, struct sge_eth_rxq *rxq);
+void t4_sge_eth_clear_queues(struct port_info *pi);
+int cxgb4_set_rspq_intr_params(struct sge_rspq *q, unsigned int us,
+			       unsigned int cnt);
+int cxgbe_poll(struct sge_rspq *q, struct rte_mbuf **rx_pkts,
+	       unsigned int budget, unsigned int *work_done);
+int cxgb4_write_rss(const struct port_info *pi, const u16 *queues);
+
+#endif /* __T4_ADAPTER_H__ */
drivers/net/cxgbe/base/common.h new file +401 -0

401 lines not on this page · raw message

drivers/net/cxgbe/base/t4_chip_type.h new file +79 -0

79 lines not on this page · raw message

drivers/net/cxgbe/base/t4_hw.c new file +2686 -0

1,955 lines not on this page · raw message

drivers/net/cxgbe/base/t4_hw.h new file +149 -0

149 lines not on this page · raw message

drivers/net/cxgbe/base/t4_msg.h new file +345 -0

345 lines not on this page · raw message

drivers/net/cxgbe/base/t4_pci_id_tbl.h new file +148 -0

148 lines not on this page · raw message

drivers/net/cxgbe/base/t4_regs.h new file +779 -0

779 lines not on this page · raw message

drivers/net/cxgbe/base/t4_regs_values.h new file +168 -0

168 lines not on this page · raw message

drivers/net/cxgbe/base/t4fw_interface.h new file +1730 -0

1,730 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.4.1

Part of the diff is not shown here. View the raw message.

#21 lore raw

PATCH v2 2/11 cxgbe: add cxgbe poll mode driver.

In reply to Rahul Lakkireddy

Adds cxgbe poll mode driver for DPDK under drivers/net/cxgbe directory. This patch:

1. Adds the Makefile to compile cxgbe pmd.
2. Registers and initializes the cxgbe pmd driver.

---
v2:
- Move files to new directory under drivers/net/cxgbe and update commit log.
- Move eth_dev_ops to separate patches.
- Update cxgbe Makefile to use relative rather than absolute path of pmd.
- Replace bitwise operations in fls() with gcc's __builtin_clz().
- Fix an issue in adap_init0_tweaks() related to rx_dma_offset.

 drivers/net/cxgbe/Makefile       |  74 ++++
 drivers/net/cxgbe/cxgbe.h        |  48 +++
 drivers/net/cxgbe/cxgbe_compat.h | 266 +++++++++++++++
 drivers/net/cxgbe/cxgbe_ethdev.c | 169 ++++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 706 +++++++++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/sge.c          | 311 +++++++++++++++++
 6 files changed, 1574 insertions(+)
 create mode 100644 drivers/net/cxgbe/Makefile
 create mode 100644 drivers/net/cxgbe/cxgbe.h
 create mode 100644 drivers/net/cxgbe/cxgbe_compat.h
 create mode 100644 drivers/net/cxgbe/cxgbe_ethdev.c
 create mode 100644 drivers/net/cxgbe/cxgbe_main.c
 create mode 100644 drivers/net/cxgbe/sge.c
drivers/net/cxgbe/Makefile new file +74 -0
new file mode 100644
index 0000000..ac07adb
@@ -0,0 +1,74 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014-2015 Chelsio Communications.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of Chelsio Communications nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_cxgbe.a
+
+CFLAGS += -I$(SRCDIR)/base/
+CFLAGS += -I$(SRCDIR)
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+ifeq ($(CC), icc)
+#
+# CFLAGS for icc
+#
+CFLAGS_BASE_DRIVER = -wd174 -wd593 -wd869 -wd981 -wd2259
+else
+#
+# CFLAGS for gcc
+#
+ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
+CFLAGS     += -Wno-deprecated
+endif
+CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value
+CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args
+
+endif
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_main.c
+SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += sge.c
+SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += base/t4_hw.c
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_eal lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_net lib/librte_malloc
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/cxgbe/cxgbe.h new file +48 -0

48 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_compat.h new file +266 -0

266 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_ethdev.c new file +169 -0

169 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c new file +706 -0

706 lines not on this page · raw message

drivers/net/cxgbe/sge.c new file +311 -0

311 lines not on this page · raw message

Signature · 1 line
2.4.1
#22 lore raw

Re: [PATCH v2 02/11] cxgbe: add cxgbe poll mode driver.

It doesn't build as a shared library.
Please add EXPORT_MAP and LIBABIVER to the Makefile.
It would be easier to test if build config was merged in this patch, with the Makefile.

Please merge also the maintainer infos.

2015-06-01 23:00, Rahul Lakkireddy:

Quoted 1 line

+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))

RTE_DIM may be used

#23 lore raw

Re: [PATCH v2 02/11] cxgbe: add cxgbe poll mode driver.

Hi Thomas,

Quoted 2 lines · Thomas Monjalon

It doesn't build as a shared library.
Please add EXPORT_MAP and LIBABIVER to the Makefile.

Will fix this in v3.

Quoted 5 lines

It would be easier to test if build config was merged in this patch, with the Makefile.

Please merge also the maintainer infos.

Will merge build config and maintainers with the Makefile patch

Quoted 4 lines

2015-06-01 23:00, Rahul Lakkireddy:

Quoted 1 line

+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))

RTE_DIM may be used

Will fix this in v3.

Thanks,
Rahul

#24 lore raw

PATCH v2 3/11 cxgbe: add device configuration and RX support for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds RX support for the cxgbe poll mode driver. This patch:

1. Adds rx queue related eth_dev_ops.
2. Adds RSS support.
3. Adds dev_configure() and dev_infos_get() eth_dev_ops.
4. Adds rx_pkt_burst for receiving packets.

---
v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Cleanup some RX related macros and code.

 drivers/net/cxgbe/cxgbe.h        |   6 +
 drivers/net/cxgbe/cxgbe_ethdev.c | 183 ++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 350 +++++++++++++++
 drivers/net/cxgbe/sge.c          | 915 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1454 insertions(+)
drivers/net/cxgbe/cxgbe.h +6 -0
index 44d48dc..90d1db0 100644
@@ -44,5 +44,11 @@
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
 int cxgbe_probe(struct adapter *adapter);
+void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
+	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
+int setup_sge_fwevtq(struct adapter *adapter);
+void cfg_queues(struct rte_eth_dev *eth_dev);
+int cfg_queue_count(struct rte_eth_dev *eth_dev);
+int setup_rss(struct port_info *pi);
 
 #endif /* _CXGBE_H_ */
drivers/net/cxgbe/cxgbe_ethdev.c +183 -0

196 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +350 -0

382 lines not on this page · raw message

drivers/net/cxgbe/sge.c +915 -0

927 lines not on this page · raw message

Signature · 1 line
2.4.1
#25 lore raw

PATCH v2 4/11 cxgbe: add TX support for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds TX support for the cxgbe poll mode driver. This patch:

1. Adds tx queue related eth_dev_ops.
2. Adds tx_pkt_burst for transmitting packets.

---
v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Few bug fixes for tx path.

 drivers/net/cxgbe/cxgbe_ethdev.c | 133 ++++++
 drivers/net/cxgbe/cxgbe_main.c   |   1 +
 drivers/net/cxgbe/sge.c          | 969 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 1103 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +133 -0
index 1c69973..b6e17e4 100644
@@ -85,6 +85,39 @@
  */
 #include "t4_pci_id_tbl.h"
 
+static uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+				uint16_t nb_pkts)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)tx_queue;
+	uint16_t pkts_sent, pkts_remain;
+	uint16_t total_sent = 0;
+	int ret = 0;
+
+	CXGBE_DEBUG_TX(adapter, "%s: txq = %p; tx_pkts = %p; nb_pkts = %d\n",
+		       __func__, txq, tx_pkts, nb_pkts);
+
+	t4_os_lock(&txq->txq_lock);
+	/* free up desc from already completed tx */
+	reclaim_completed_tx(&txq->q);
+	while (total_sent < nb_pkts) {
+		pkts_remain = nb_pkts - total_sent;
+
+		for (pkts_sent = 0; pkts_sent < pkts_remain; pkts_sent++) {
+			ret = t4_eth_xmit(txq, tx_pkts[total_sent + pkts_sent]);
+			if (ret < 0)
+				break;
+		}
+		if (!pkts_sent)
+			break;
+		total_sent += pkts_sent;
+		/* reclaim as much as possible */
+		reclaim_completed_tx(&txq->q);
+	}
+
+	t4_os_unlock(&txq->txq_lock);
+	return total_sent;
+}
+
 static uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts)
 {
@@ -131,8 +164,11 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	device_info->reta_size = pi->rss_size;
 }
 
+static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
+				    uint16_t tx_queue_id);
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t tx_queue_id);
+static void cxgbe_dev_tx_queue_release(void *q);
 static void cxgbe_dev_rx_queue_release(void *q);
 
 static int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
@@ -157,6 +193,98 @@ static int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
+static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
+				    uint16_t tx_queue_id)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)
+				  (eth_dev->data->tx_queues[tx_queue_id]);
+
+	dev_debug(NULL, "%s: tx_queue_id = %d\n", __func__, tx_queue_id);
+
+	return t4_sge_eth_txq_start(txq);
+}
+
+static int cxgbe_dev_tx_queue_stop(struct rte_eth_dev *eth_dev,
+				   uint16_t tx_queue_id)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)
+				  (eth_dev->data->tx_queues[tx_queue_id]);
+
+	dev_debug(NULL, "%s: tx_queue_id = %d\n", __func__, tx_queue_id);
+
+	return t4_sge_eth_txq_stop(txq);
+}
+
+static int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
+				    uint16_t queue_idx,	uint16_t nb_desc,
+				    unsigned int socket_id,
+				    const struct rte_eth_txconf *tx_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct sge *s = &adapter->sge;
+	struct sge_eth_txq *txq = &s->ethtxq[pi->first_qset + queue_idx];
+	int err = 0;
+	unsigned int temp_nb_desc;
+
+	RTE_SET_USED(tx_conf);
+
+	dev_debug(adapter, "%s: eth_dev->data->nb_tx_queues = %d; queue_idx = %d; nb_desc = %d; socket_id = %d; pi->first_qset = %u\n",
+		  __func__, eth_dev->data->nb_tx_queues, queue_idx, nb_desc,
+		  socket_id, pi->first_qset);
+
+	/*  Free up the existing queue  */
+	if (eth_dev->data->tx_queues[queue_idx]) {
+		cxgbe_dev_tx_queue_release(eth_dev->data->tx_queues[queue_idx]);
+		eth_dev->data->tx_queues[queue_idx] = NULL;
+	}
+
+	eth_dev->data->tx_queues[queue_idx] = (void *)txq;
+
+	/* Sanity Checking
+	 *
+	 * nb_desc should be > 1023 and <= CXGBE_MAX_RING_DESC_SIZE
+	 */
+	temp_nb_desc = nb_desc;
+	if (nb_desc < CXGBE_MIN_RING_DESC_SIZE) {
+		dev_warn(adapter, "%s: number of descriptors must be >= %d. Using default [%d]\n",
+			 __func__, CXGBE_MIN_RING_DESC_SIZE,
+			 CXGBE_DEFAULT_TX_DESC_SIZE);
+		temp_nb_desc = CXGBE_DEFAULT_TX_DESC_SIZE;
+	} else if (nb_desc > CXGBE_MAX_RING_DESC_SIZE) {
+		dev_err(adapter, "%s: number of descriptors must be between %d and %d inclusive. Default [%d]\n",
+			__func__, CXGBE_MIN_RING_DESC_SIZE,
+			CXGBE_MAX_RING_DESC_SIZE, CXGBE_DEFAULT_TX_DESC_SIZE);
+		return -(EINVAL);
+	}
+
+	txq->q.size = temp_nb_desc;
+
+	err = t4_sge_alloc_eth_txq(adapter, txq, eth_dev, queue_idx,
+				   s->fw_evtq.cntxt_id, socket_id);
+
+	dev_debug(adapter, "%s: txq->q.cntxt_id= %d err = %d\n",
+		  __func__, txq->q.cntxt_id, err);
+
+	return err;
+}
+
+static void cxgbe_dev_tx_queue_release(void *q)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)q;
+
+	if (txq) {
+		struct port_info *pi = (struct port_info *)
+				       (txq->eth_dev->data->dev_private);
+		struct adapter *adap = pi->adapter;
+
+		dev_debug(adapter, "%s: pi->port_id = %d; tx_queue_id = %d\n",
+			  __func__, pi->port_id, txq->q.cntxt_id);
+
+		t4_sge_eth_txq_release(adap, txq);
+	}
+}
+
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t rx_queue_id)
 {
@@ -264,6 +392,10 @@ static void cxgbe_dev_rx_queue_release(void *q)
 static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_configure		= cxgbe_dev_configure,
 	.dev_infos_get		= cxgbe_dev_info_get,
+	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
+	.tx_queue_start		= cxgbe_dev_tx_queue_start,
+	.tx_queue_stop		= cxgbe_dev_tx_queue_stop,
+	.tx_queue_release	= cxgbe_dev_tx_queue_release,
 	.rx_queue_setup         = cxgbe_dev_rx_queue_setup,
 	.rx_queue_start		= cxgbe_dev_rx_queue_start,
 	.rx_queue_stop		= cxgbe_dev_rx_queue_stop,
@@ -286,6 +418,7 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)
 
 	eth_dev->dev_ops = &cxgbe_eth_dev_ops;
 	eth_dev->rx_pkt_burst = &cxgbe_recv_pkts;
+	eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts;
 
 	/* for secondary processes, we don't initialise any further as primary
 	 * has already done this work.
drivers/net/cxgbe/cxgbe_main.c +1 -0
index abcef6b..3029b57 100644
@@ -1005,6 +1005,7 @@ allocate_mac:
 		pi->eth_dev->data->dev_private = pi;
 		pi->eth_dev->driver = adapter->eth_dev->driver;
 		pi->eth_dev->dev_ops = adapter->eth_dev->dev_ops;
+		pi->eth_dev->tx_pkt_burst = adapter->eth_dev->tx_pkt_burst;
 		pi->eth_dev->rx_pkt_burst = adapter->eth_dev->rx_pkt_burst;
 		TAILQ_INIT(&pi->eth_dev->link_intr_cbs);
 
drivers/net/cxgbe/sge.c +969 -0

1,005 lines not on this page · raw message

Signature · 1 line
2.4.1
#26 lore raw

PATCH v2 5/11 cxgbe: add device related operations for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds dev_start(), dev_stop(), and dev_close() eth_dev_ops for cxgbe poll mode driver.

---
v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Few changes related to tx bug fixes.

 drivers/net/cxgbe/cxgbe.h        |   4 ++
 drivers/net/cxgbe/cxgbe_ethdev.c | 114 ++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 139 +++++++++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/sge.c          |  58 ++++++++++++++++
 4 files changed, 315 insertions(+)
drivers/net/cxgbe/cxgbe.h +4 -0
index 90d1db0..bf08baf 100644
@@ -44,6 +44,10 @@
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
 int cxgbe_probe(struct adapter *adapter);
+int cxgbe_up(struct adapter *adap);
+int cxgbe_down(struct port_info *pi);
+void cxgbe_close(struct adapter *adapter);
+int link_start(struct port_info *pi);
 void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
 	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
 int setup_sge_fwevtq(struct adapter *adapter);
drivers/net/cxgbe/cxgbe_ethdev.c +114 -0

126 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +139 -0

151 lines not on this page · raw message

drivers/net/cxgbe/sge.c +58 -0

70 lines not on this page · raw message

Signature · 1 line
2.4.1
#27 lore raw

PATCH v2 6/11 cxgbe: add port statistics for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds stats_get() and stats_reset() eth_dev_ops for cxgbe poll mode driver.

---
v2:
- This patch is a subset of patch 2/5 submitted in v1.

 drivers/net/cxgbe/cxgbe.h        |  2 +
 drivers/net/cxgbe/cxgbe_ethdev.c | 83 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 11 ++++++
 3 files changed, 96 insertions(+)
drivers/net/cxgbe/cxgbe.h +2 -0
index bf08baf..97c37d2 100644
@@ -47,6 +47,8 @@ int cxgbe_probe(struct adapter *adapter);
 int cxgbe_up(struct adapter *adap);
 int cxgbe_down(struct port_info *pi);
 void cxgbe_close(struct adapter *adapter);
+void cxgbe_stats_get(struct port_info *pi, struct port_stats *stats);
+void cxgbe_stats_reset(struct port_info *pi);
 int link_start(struct port_info *pi);
 void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
 	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
drivers/net/cxgbe/cxgbe_ethdev.c +83 -0

95 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +11 -0
index 7995d3c..dad0a98 100644
@@ -310,6 +310,17 @@ void cfg_queues(struct rte_eth_dev *eth_dev)
 	}
 }
 
+void cxgbe_stats_get(struct port_info *pi, struct port_stats *stats)
+{
+	t4_get_port_stats_offset(pi->adapter, pi->tx_chan, stats,
+				 &pi->stats_base);
+}
+
+void cxgbe_stats_reset(struct port_info *pi)
+{
+	t4_clr_port_stats(pi->adapter, pi->tx_chan);
+}
+
 static void setup_memwin(struct adapter *adap)
 {
 	u32 mem_win0_base;
Signature · 1 line
2.4.1
#28 lore raw

PATCH v2 7/11 cxgbe: add link related functions for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds link update, promiscuous and multicast related eth_dev_ops for cxgbe poll mode driver.

---
v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Update cxgbe_dev_link_update() to return correct value.

 drivers/net/cxgbe/cxgbe_ethdev.c | 66 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +66 -0
index 600a16c..c0dd5f3 100644
@@ -164,6 +164,67 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	device_info->reta_size = pi->rss_size;
 }
 
+static void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      1, -1, 1, -1, false);
+}
+
+static void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      0, -1, 1, -1, false);
+}
+
+static void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	/* TODO: address filters ?? */
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      -1, 1, 1, -1, false);
+}
+
+static void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	/* TODO: address filters ?? */
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      -1, 0, 1, -1, false);
+}
+
+static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
+				 __rte_unused int wait_to_complete)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct sge *s = &adapter->sge;
+	struct rte_eth_link *old_link = &eth_dev->data->dev_link;
+	unsigned int work_done, budget = 4;
+
+	cxgbe_poll(&s->fw_evtq, NULL, budget, &work_done);
+	if (old_link->link_status == pi->link_cfg.link_ok)
+		return -1;  /* link not changed */
+
+	eth_dev->data->dev_link.link_status = pi->link_cfg.link_ok;
+	eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	eth_dev->data->dev_link.link_speed = pi->link_cfg.speed;
+
+	/* link has changed */
+	return 0;
+}
+
 static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t tx_queue_id);
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
@@ -585,8 +646,13 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_start		= cxgbe_dev_start,
 	.dev_stop		= cxgbe_dev_stop,
 	.dev_close		= cxgbe_dev_close,
+	.promiscuous_enable	= cxgbe_dev_promiscuous_enable,
+	.promiscuous_disable	= cxgbe_dev_promiscuous_disable,
+	.allmulticast_enable	= cxgbe_dev_allmulticast_enable,
+	.allmulticast_disable	= cxgbe_dev_allmulticast_disable,
 	.dev_configure		= cxgbe_dev_configure,
 	.dev_infos_get		= cxgbe_dev_info_get,
+	.link_update		= cxgbe_dev_link_update,
 	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
 	.tx_queue_start		= cxgbe_dev_tx_queue_start,
 	.tx_queue_stop		= cxgbe_dev_tx_queue_stop,
Signature · 1 line
2.4.1
#29 lore raw

PATCH v2 8/11 cxgbe: add flow control functions for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds flow control related eth_dev_ops for cxgbe poll mode driver.

---
v2:
- This patch is a subset of patch 2/5 submitted in v1.

 drivers/net/cxgbe/cxgbe_ethdev.c | 54 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +54 -0
index c0dd5f3..478051a 100644
@@ -642,6 +642,58 @@ static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
 	}
 }
 
+static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_fc_conf *fc_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct link_config *lc = &pi->link_cfg;
+	int rx_pause, tx_pause;
+
+	fc_conf->autoneg = lc->fc & PAUSE_AUTONEG;
+	rx_pause = lc->fc & PAUSE_RX;
+	tx_pause = lc->fc & PAUSE_TX;
+
+	if (rx_pause && tx_pause)
+		fc_conf->mode = RTE_FC_FULL;
+	else if (rx_pause)
+		fc_conf->mode = RTE_FC_RX_PAUSE;
+	else if (tx_pause)
+		fc_conf->mode = RTE_FC_TX_PAUSE;
+	else
+		fc_conf->mode = RTE_FC_NONE;
+	return 0;
+}
+
+static int cxgbe_flow_ctrl_set(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_fc_conf *fc_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct link_config *lc = &pi->link_cfg;
+
+	if (lc->supported & FW_PORT_CAP_ANEG) {
+		if (fc_conf->autoneg)
+			lc->requested_fc |= PAUSE_AUTONEG;
+		else
+			lc->requested_fc &= ~PAUSE_AUTONEG;
+	}
+
+	if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
+	    (fc_conf->mode & RTE_FC_RX_PAUSE))
+		lc->requested_fc |= PAUSE_RX;
+	else
+		lc->requested_fc &= ~PAUSE_RX;
+
+	if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
+	    (fc_conf->mode & RTE_FC_TX_PAUSE))
+		lc->requested_fc |= PAUSE_TX;
+	else
+		lc->requested_fc &= ~PAUSE_TX;
+
+	return t4_link_l1cfg(adapter, adapter->mbox, pi->tx_chan,
+			     &pi->link_cfg);
+}
+
 static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_start		= cxgbe_dev_start,
 	.dev_stop		= cxgbe_dev_stop,
@@ -663,6 +715,8 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.rx_queue_release	= cxgbe_dev_rx_queue_release,
 	.stats_get		= cxgbe_dev_stats_get,
 	.stats_reset		= cxgbe_dev_stats_reset,
+	.flow_ctrl_get		= cxgbe_flow_ctrl_get,
+	.flow_ctrl_set		= cxgbe_flow_ctrl_set,
 };
 
 /*
Signature · 1 line
2.4.1
#30 lore raw

PATCH v2 9/11 doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

In reply to Rahul Lakkireddy

Adds cxgbe poll mode driver documentation under the usual doc/guides/nics/ directory with the rest of the drivers. The documentation covers cxgbe implementation details, features and limitations, prerequisites, configuration, and a sample application usage.

---
v2:
- Move cxgbe entry to Drivers section in source_org.rst.
- Order the cxgbe entry alphabetically in index.rst.

 doc/guides/nics/cxgbe.rst            | 209 +++++++++++++++++++++++++++++++++++
 doc/guides/nics/index.rst            |   1 +
 doc/guides/prog_guide/source_org.rst |   1 +
 3 files changed, 211 insertions(+)
 create mode 100644 doc/guides/nics/cxgbe.rst
doc/guides/nics/cxgbe.rst new file +209 -0
new file mode 100644
index 0000000..54a019d
@@ -0,0 +1,209 @@
+..  BSD LICENSE
+    Copyright 2015 Chelsio Communications.
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+    * Neither the name of Chelsio Communications nor the names of its
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+CXGBE Poll Mode Driver
+======================
+
+The CXGBE PMD (**librte_pmd_cxgbe**) provides poll mode driver support
+for **Chelsio T5** 10/40 Gbps family of adapters.
+
+More information can be found at `Chelsio Communications
+<http://www.chelsio.com>`_.
+
+Features
+--------
+
+CXGBE PMD has the support for:
+
+- Multiple queues for TX and RX.
+- Receiver Side Steering (RSS).
+- VLAN filtering.
+- Checksum offload.
+- Promiscuous mode.
+- All multicast mode.
+- Port hardware statistics.
+
+Limitations
+-----------
+
+The Chelsio T5 devices provide two/four ports but expose a single PCI bus
+address, thus, librte_pmd_cxgbe registers itself as a
+PCI driver that allocates one Ethernet device per detected port.
+
+For this reason, one cannot white/blacklist a single port without also
+white/blacklisting the others on the same device.
+
+Configuration
+-------------
+
+Compiling CXGBE PMD
+~~~~~~~~~~~~~~~~~~~
+
+These options can be modified in the ``.config`` file.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_PMD`` (default **y**)
+
+  Toggle compilation of librte_pmd_cxgbe driver.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional generic debugging
+  messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional registers related
+  run-time checks and debugging messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional firmware mailbox
+  related run-time checks and debugging messages at the cost of lower
+  performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional transmission data
+  path run-time checks and debugging messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional receiving data
+  path run-time checks and debugging messages at the cost of lower performance.
+
+Prerequisites
+-------------
+
+- Requires firmware version **1.13.32.0** and higher. Visit
+  `Chelsio Communications <http://www.chelsio.com>`_ to get latest firmware.
+
+Sample Application Notes
+-------------------------
+
+This section demonstrates how to launch **testpmd** with Chelsio T5
+devices managed by librte_pmd_cxgbe.
+
+#. Load the kernel module:
+
+   .. code-block:: console
+
+      modprobe cxgb4
+
+#. Get the PCI bus addresses of the interfaces bound to cxgb4 driver:
+
+   .. code-block:: console
+
+      dmesg | tail -2
+
+   Example output:
+
+   .. code-block:: console
+
+      cxgb4 0000:02:00.4 p1p1: renamed from eth0
+      cxgb4 0000:02:00.4 p1p2: renamed from eth1
+
+   .. note::
+
+      Both the interfaces of a Chelsio T5 2-port adapter are bound to the
+      same PCI bus address.
+
+#. Unload the kernel module:
+
+   .. code-block:: console
+
+      modprobe -ar cxgb4 csiostor
+
+#. Request huge pages:
+
+   .. code-block:: console
+
+      echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages/nr_hugepages
+
+#. Load igb_uio or vfio-pci driver:
+
+   .. code-block:: console
+
+      insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
+
+   or
+
+   .. code-block:: console
+
+      modprobe vfio-pci
+
+#. Bind the Chelsio T5 adapters to igb_uio or vfio-pci loaded in the previous
+   step:
+
+   .. code-block:: console
+
+      ./tools/dpdk_nic_bind.py --bind igb_uio 0000:02:00.4
+
+   or
+
+   Setup VFIO permissions for regular users and then bind to vfio-pci:
+
+   .. code-block:: console
+
+      sudo chmod a+x /dev/vfio
+
+      sudo chmod 0666 /dev/vfio/*
+
+      ./tools/dpdk_nic_bind.py --bind vfio-pci 0000:02:00.4
+
+#. Start testpmd with basic parameters:
+
+   .. code-block:: console
+
+      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 4 -w 0000:02:00.4 -- -i
+
+   Example output:
+
+   .. code-block:: console
+
+      [...]
+      EAL: PCI device 0000:02:00.4 on NUMA socket -1
+      EAL:   probe driver: 1425:5401 rte_cxgbe_pmd
+      EAL:   PCI memory mapped at 0x7fd7c0200000
+      EAL:   PCI memory mapped at 0x7fd77cdfd000
+      EAL:   PCI memory mapped at 0x7fd7c10b7000
+      PMD: rte_cxgbe_pmd: fw: 1.13.33.0, TP: 0.1.4.8
+      PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
+      Interactive-mode selected
+      Configuring Port 0 (socket 0)
+      Port 0: 00:07:43:2D:EA:C0
+      Configuring Port 1 (socket 0)
+      Port 1: 00:07:43:2D:EA:C8
+      Checking link statuses...
+      PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
+      PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
+      Port 0 Link Up - speed 10000 Mbps - full-duplex
+      Port 1 Link Up - speed 10000 Mbps - full-duplex
+      Done
+      testpmd>
doc/guides/nics/index.rst +1 -0
index 1ee67fa..d1a92f8 100644
@@ -40,6 +40,7 @@ Network Interface Controller Drivers
     :maxdepth: 3
     :numbered:
 
+    cxgbe
     e1000em
     ixgbe
     intel_vf
doc/guides/prog_guide/source_org.rst +1 -0
index 4f6f489..bfdaa8a 100644
@@ -97,6 +97,7 @@ The drivers directory has a net subdirectory which contains::
     drivers/net
     +-- af_packet          # poll mode driver based on linux af_packet
     +-- bonding            # bonding poll mode driver
+    +-- cxgbe              # Chelsio Terminator 10GbE/40GbE poll mode driver
     +-- e1000              # 1GbE poll mode drivers (igb and em)
     +-- enic               # Cisco VIC Ethernet NIC Poll-mode Driver
     +-- fm10k              # Host interface PMD driver for FM10000 Series
Signature · 1 line
2.4.1
#31 lore raw

PATCH v2 10/11 config: enable cxgbe PMD for compilation and linking.

In reply to Rahul Lakkireddy

Changes to:
1. config/common_linuxapp to add macros for cxgbe pmd.
2. drivers/net/Makefile to add cxgbe pmd to the compile list.
3. mk/rte.app.mk to add cxgbe pmd to link.

---
v2:
- Move changes from lib/Makefile to drivers/net/Makefile and update commit log.
- Order the cxgbe entry alphabetically in mk/rte.app.mk.

 config/common_linuxapp | 10 ++++++++++
 drivers/net/Makefile   |  1 +
 mk/rte.app.mk          |  1 +
 3 files changed, 12 insertions(+)
config/common_linuxapp +10 -0
index 0078dc9..dfafd45 100644
@@ -208,6 +208,16 @@ CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8
 CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1
 
 #
+# Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
+#
+CONFIG_RTE_LIBRTE_CXGBE_PMD=y
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n
+
+#
 # Compile burst-oriented Cisco ENIC PMD driver
 #
 CONFIG_RTE_LIBRTE_ENIC_PMD=y
drivers/net/Makefile +1 -0
index 1e6648a..644cacb 100644
@@ -33,6 +33,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += bonding
+DIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe
 DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000
 DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic
 DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
mk/rte.app.mk +1 -0
index 1a2043a..bba6ddc 100644
@@ -122,6 +122,7 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)    += -lrte_pmd_vmxnet3_uio
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD)     += -lrte_pmd_virtio
+_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD)      += -lrte_pmd_cxgbe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD)       += -lrte_pmd_enic
 _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)       += -lrte_pmd_i40e
 _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)      += -lrte_pmd_fm10k
Signature · 1 line
2.4.1
#32 lore raw

PATCH v2 11/11 maintainers: claim responsibility for cxgbe PMD.

In reply to Rahul Lakkireddy

Update MAINTAINERS file to claim responsibility for the cxgbe PMD.

---
v2:
- Replace the old cxgbe directory entry with the new entry and order it alphabetically.

 MAINTAINERS | 5 +++++
 1 file changed, 5 insertions(+)
MAINTAINERS +5 -0
index 9362c19..1ec5117 100644
@@ -210,6 +210,11 @@ Linux AF_PACKET
 M: John W. Linville <[email protected]>
 F: drivers/net/af_packet/
 
+Chelsio cxgbe
+M: Rahul Lakkireddy <[email protected]>
+F: drivers/net/cxgbe/
+F: doc/guides/nics/cxgbe.rst
+
 Cisco enic
 F: drivers/net/enic/
 
Signature · 1 line
2.4.1
#33 lore raw

v3 cover Chelsio Terminator 5 (T5) 10G/40G Poll Mode Driver

In reply to Rahul Lakkireddy

This series of patches add the CXGBE Poll Mode Driver support for Chelsio Terminator 5 series of 10G/40G adapters. The CXGBE PMD is split into multiple patches. The first patch adds the hardware specific api for all supported Chelsio T5 adapters and the patches from 2 to 8 add the actual DPDK CXGBE PMD.

Also, the CXGBE PMD is enabled for compilation and linking by patch 2. MAINTAINERS file is also updated by patch 2 to claim responsibility for the CXGBE PMD.

More information on the CXGBE PMD can be found in the documentation added by patch 9.

v3:
- Merge patches 10 and 11 with patch 2.
- Add rte_pmd_cxgbe_version.map and add EXPORT_MAP and LIBABIVER to cxgbe Makefile.
- Use RTE_DIM macro for calculating ARRAY_SIZE.

v2:
- Move the driver to drivers/net directory and update all config files and commit logs. Also update MAINTAINERS.
- Break the second patch into more patches; incrementally, adding features to the cxgbe poll mode driver.
- Replace bitwise operations in finding last (most significant) bit set with gcc's __builtin_clz.
- Fix the return value returned by link update eth_dev operation.
- Few bug fixes and code cleanup.

Rahul Lakkireddy (9):
cxgbe: add hardware specific api for all supported Chelsio T5 series
adapters.
cxgbe: add cxgbe poll mode driver.
cxgbe: add device configuration and RX support for cxgbe PMD.
cxgbe: add TX support for cxgbe PMD.
cxgbe: add device related operations for cxgbe PMD.
cxgbe: add port statistics for cxgbe PMD.
cxgbe: add link related functions for cxgbe PMD.
cxgbe: add flow control functions for cxgbe PMD.
doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

 MAINTAINERS                                 |    5 +
 config/common_linuxapp                      |   10 +
 doc/guides/nics/cxgbe.rst                   |  209 +++
 doc/guides/nics/index.rst                   |    1 +
 doc/guides/prog_guide/source_org.rst        |    1 +
 drivers/net/Makefile                        |    1 +
 drivers/net/cxgbe/Makefile                  |   78 +
 drivers/net/cxgbe/base/adapter.h            |  565 ++++++
 drivers/net/cxgbe/base/common.h             |  401 ++++
 drivers/net/cxgbe/base/t4_chip_type.h       |   79 +
 drivers/net/cxgbe/base/t4_hw.c              | 2686 +++++++++++++++++++++++++++
 drivers/net/cxgbe/base/t4_hw.h              |  149 ++
 drivers/net/cxgbe/base/t4_msg.h             |  345 ++++
 drivers/net/cxgbe/base/t4_pci_id_tbl.h      |  148 ++
 drivers/net/cxgbe/base/t4_regs.h            |  779 ++++++++
 drivers/net/cxgbe/base/t4_regs_values.h     |  168 ++
 drivers/net/cxgbe/base/t4fw_interface.h     | 1730 +++++++++++++++++
 drivers/net/cxgbe/cxgbe.h                   |   60 +
 drivers/net/cxgbe/cxgbe_compat.h            |  266 +++
 drivers/net/cxgbe/cxgbe_ethdev.c            |  802 ++++++++
 drivers/net/cxgbe/cxgbe_main.c              | 1207 ++++++++++++
 drivers/net/cxgbe/rte_pmd_cxgbe_version.map |    4 +
 drivers/net/cxgbe/sge.c                     | 2253 ++++++++++++++++++++++
 mk/rte.app.mk                               |    1 +
 24 files changed, 11948 insertions(+)
 create mode 100644 doc/guides/nics/cxgbe.rst
 create mode 100644 drivers/net/cxgbe/Makefile
 create mode 100644 drivers/net/cxgbe/base/adapter.h
 create mode 100644 drivers/net/cxgbe/base/common.h
 create mode 100644 drivers/net/cxgbe/base/t4_chip_type.h
 create mode 100644 drivers/net/cxgbe/base/t4_hw.c
 create mode 100644 drivers/net/cxgbe/base/t4_hw.h
 create mode 100644 drivers/net/cxgbe/base/t4_msg.h
 create mode 100644 drivers/net/cxgbe/base/t4_pci_id_tbl.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs_values.h
 create mode 100644 drivers/net/cxgbe/base/t4fw_interface.h
 create mode 100644 drivers/net/cxgbe/cxgbe.h
 create mode 100644 drivers/net/cxgbe/cxgbe_compat.h
 create mode 100644 drivers/net/cxgbe/cxgbe_ethdev.c
 create mode 100644 drivers/net/cxgbe/cxgbe_main.c
 create mode 100644 drivers/net/cxgbe/rte_pmd_cxgbe_version.map
 create mode 100644 drivers/net/cxgbe/sge.c
Signature · 1 line
2.4.1
#34 lore raw

PATCH v3 1/9 cxgbe: add hardware specific api for all supported Chelsio T5 series adapters.

Adds hardware specific api for all the Chelsio T5 adapters under drivers/net/cxgbe/base directory.

---
v3:
- No changes

v2:
- Move files to new directory under drivers/net/cxgbe/base and update commit log.
- Few bug fixes related to tx.

 drivers/net/cxgbe/base/adapter.h        |  565 +++++++
 drivers/net/cxgbe/base/common.h         |  401 +++++
 drivers/net/cxgbe/base/t4_chip_type.h   |   79 +
 drivers/net/cxgbe/base/t4_hw.c          | 2686 +++++++++++++++++++++++++++++++
 drivers/net/cxgbe/base/t4_hw.h          |  149 ++
 drivers/net/cxgbe/base/t4_msg.h         |  345 ++++
 drivers/net/cxgbe/base/t4_pci_id_tbl.h  |  148 ++
 drivers/net/cxgbe/base/t4_regs.h        |  779 +++++++++
 drivers/net/cxgbe/base/t4_regs_values.h |  168 ++
 drivers/net/cxgbe/base/t4fw_interface.h | 1730 ++++++++++++++++++++
 10 files changed, 7050 insertions(+)
 create mode 100644 drivers/net/cxgbe/base/adapter.h
 create mode 100644 drivers/net/cxgbe/base/common.h
 create mode 100644 drivers/net/cxgbe/base/t4_chip_type.h
 create mode 100644 drivers/net/cxgbe/base/t4_hw.c
 create mode 100644 drivers/net/cxgbe/base/t4_hw.h
 create mode 100644 drivers/net/cxgbe/base/t4_msg.h
 create mode 100644 drivers/net/cxgbe/base/t4_pci_id_tbl.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs_values.h
 create mode 100644 drivers/net/cxgbe/base/t4fw_interface.h
drivers/net/cxgbe/base/adapter.h new file +565 -0
new file mode 100644
index 0000000..0ea1c95
@@ -0,0 +1,565 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014-2015 Chelsio Communications.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Chelsio Communications nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* This file should not be included directly.  Include common.h instead. */
+
+#ifndef __T4_ADAPTER_H__
+#define __T4_ADAPTER_H__
+
+#include <rte_mbuf.h>
+
+#include "cxgbe_compat.h"
+#include "t4_regs_values.h"
+
+enum {
+	MAX_ETH_QSETS = 64,           /* # of Ethernet Tx/Rx queue sets */
+};
+
+struct adapter;
+struct sge_rspq;
+
+enum {
+	PORT_RSS_DONE = (1 << 0),
+};
+
+struct port_info {
+	struct adapter *adapter;        /* adapter that this port belongs to */
+	struct rte_eth_dev *eth_dev;    /* associated rte eth device */
+	struct port_stats stats_base;   /* port statistics base */
+	struct link_config link_cfg;    /* link configuration info */
+
+	unsigned long flags;            /* port related flags */
+	short int xact_addr_filt;       /* index of exact MAC address filter */
+
+	u16    viid;                    /* associated virtual interface id */
+	s8     mdio_addr;               /* address of the PHY */
+	u8     port_type;               /* firmware port type */
+	u8     mod_type;                /* firmware module type */
+	u8     port_id;                 /* physical port ID */
+	u8     tx_chan;                 /* associated channel */
+
+	u8     n_rx_qsets;              /* # of rx qsets */
+	u8     n_tx_qsets;              /* # of tx qsets */
+	u8     first_qset;              /* index of first qset */
+
+	u16    *rss;                    /* rss table */
+	u8     rss_mode;                /* rss mode */
+	u16    rss_size;                /* size of VI's RSS table slice */
+};
+
+/* Enable or disable autonegotiation.  If this is set to enable,
+ * the forced link modes above are completely ignored.
+ */
+#define AUTONEG_DISABLE         0x00
+#define AUTONEG_ENABLE          0x01
+
+enum {                                 /* adapter flags */
+	FULL_INIT_DONE     = (1 << 0),
+	USING_MSI          = (1 << 1),
+	USING_MSIX         = (1 << 2),
+	FW_QUEUE_BOUND     = (1 << 3),
+	FW_OK              = (1 << 4),
+	CFG_QUEUES	   = (1 << 5),
+	MASTER_PF          = (1 << 6),
+};
+
+struct rx_sw_desc {                /* SW state per Rx descriptor */
+	void *buf;                 /* struct page or mbuf */
+	dma_addr_t dma_addr;
+};
+
+struct sge_fl {                     /* SGE free-buffer queue state */
+	/* RO fields */
+	struct rx_sw_desc *sdesc;   /* address of SW Rx descriptor ring */
+
+	dma_addr_t addr;            /* bus address of HW ring start */
+	__be64 *desc;               /* address of HW Rx descriptor ring */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cntxt_id;      /* SGE relative QID for the free list */
+	unsigned int size;          /* capacity of free list */
+
+	unsigned int avail;         /* # of available Rx buffers */
+	unsigned int pend_cred;     /* new buffers since last FL DB ring */
+	unsigned int cidx;          /* consumer index */
+	unsigned int pidx;          /* producer index */
+
+	unsigned long alloc_failed; /* # of times buffer allocation failed */
+	unsigned long low;          /* # of times momentarily starving */
+};
+
+#define MAX_MBUF_FRAGS (16384 / 512 + 2)
+
+/* A packet gather list */
+struct pkt_gl {
+	union {
+		struct rte_mbuf *mbufs[MAX_MBUF_FRAGS];
+	} /* UNNAMED */;
+	void *va;                         /* virtual address of first byte */
+	unsigned int nfrags;              /* # of fragments */
+	unsigned int tot_len;             /* total length of fragments */
+	bool usembufs;                    /* use mbufs for fragments */
+};
+
+typedef int (*rspq_handler_t)(struct sge_rspq *q, const __be64 *rsp,
+			      const struct pkt_gl *gl);
+
+struct sge_rspq {                   /* state for an SGE response queue */
+	struct adapter *adapter;      /* adapter that this queue belongs to */
+	struct rte_eth_dev *eth_dev;  /* associated rte eth device */
+	struct rte_mempool  *mb_pool; /* associated mempool */
+
+	dma_addr_t phys_addr;       /* physical address of the ring */
+	__be64 *desc;               /* address of HW response ring */
+	const __be64 *cur_desc;     /* current descriptor in queue */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cidx;          /* consumer index */
+	unsigned int iqe_len;       /* entry size */
+	unsigned int size;          /* capacity of response queue */
+	int offset;                 /* offset into current Rx buffer */
+
+	u8 gen;                     /* current generation bit */
+	u8 intr_params;             /* interrupt holdoff parameters */
+	u8 next_intr_params;        /* holdoff params for next interrupt */
+	u8 pktcnt_idx;              /* interrupt packet threshold */
+	u8 idx;                     /* queue index within its group */
+	u16 cntxt_id;               /* SGE relative QID for the response Q */
+	u16 abs_id;                 /* absolute SGE id for the response q */
+
+	rspq_handler_t handler;     /* associated handler for this response q */
+};
+
+struct sge_eth_rx_stats {	/* Ethernet rx queue statistics */
+	u64 pkts;		/* # of ethernet packets */
+	u64 rx_bytes;		/* # of ethernet bytes */
+	u64 rx_cso;		/* # of Rx checksum offloads */
+	u64 vlan_ex;		/* # of Rx VLAN extractions */
+	u64 rx_drops;		/* # of packets dropped due to no mem */
+};
+
+struct sge_eth_rxq {                /* a SW Ethernet Rx queue */
+	struct sge_rspq rspq;
+	struct sge_fl fl;
+	struct sge_eth_rx_stats stats;
+	bool usembufs;               /* one ingress packet per mbuf FL buffer */
+} __rte_cache_aligned;
+
+/*
+ * Currently there are two types of coalesce WR. Type 0 needs 48 bytes per
+ * packet (if one sgl is present) and type 1 needs 32 bytes. This means
+ * that type 0 can fit a maximum of 10 packets per WR and type 1 can fit
+ * 15 packets. We need to keep track of the mbuf pointers in a coalesce WR
+ * to be able to free those mbufs when we get completions back from the FW.
+ * Allocating the maximum number of pointers in every tx desc is a waste
+ * of memory resources so we only store 2 pointers per tx desc which should
+ * be enough since a tx desc can only fit 2 packets in the best case
+ * scenario where a packet needs 32 bytes.
+ */
+#define ETH_COALESCE_PKT_NUM 15
+#define ETH_COALESCE_PKT_PER_DESC 2
+
+struct tx_eth_coal_desc {
+	struct rte_mbuf *mbuf[ETH_COALESCE_PKT_PER_DESC];
+	struct ulptx_sgl *sgl[ETH_COALESCE_PKT_PER_DESC];
+	int idx;
+};
+
+struct tx_desc {
+	__be64 flit[8];
+};
+
+struct tx_sw_desc {                /* SW state per Tx descriptor */
+	struct rte_mbuf *mbuf;
+	struct ulptx_sgl *sgl;
+	struct tx_eth_coal_desc coalesce;
+};
+
+enum {
+	EQ_STOPPED = (1 << 0),
+};
+
+struct eth_coalesce {
+	unsigned char *ptr;
+	unsigned char type;
+	unsigned int idx;
+	unsigned int len;
+	unsigned int flits;
+	unsigned int max;
+};
+
+struct sge_txq {
+	struct tx_desc *desc;       /* address of HW Tx descriptor ring */
+	struct tx_sw_desc *sdesc;   /* address of SW Tx descriptor ring */
+	struct sge_qstat *stat;     /* queue status entry */
+	struct eth_coalesce coalesce; /* coalesce info */
+
+	uint64_t phys_addr;         /* physical address of the ring */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cntxt_id;     /* SGE relative QID for the Tx Q */
+	unsigned int in_use;       /* # of in-use Tx descriptors */
+	unsigned int size;         /* # of descriptors */
+	unsigned int cidx;         /* SW consumer index */
+	unsigned int pidx;         /* producer index */
+	unsigned int dbidx;	   /* last idx when db ring was done */
+	unsigned int equeidx;	   /* last sent credit request */
+	unsigned int last_pidx;	   /* last pidx recorded by tx monitor */
+	unsigned int last_coal_idx;/* last coal-idx recorded by tx monitor */
+
+	int db_disabled;            /* doorbell state */
+	unsigned short db_pidx;     /* doorbell producer index */
+	unsigned short db_pidx_inc; /* doorbell producer increment */
+};
+
+struct sge_eth_tx_stats {	/* Ethernet tx queue statistics */
+	u64 pkts;		/* # of ethernet packets */
+	u64 tx_bytes;		/* # of ethernet bytes */
+	u64 tso;		/* # of TSO requests */
+	u64 tx_cso;		/* # of Tx checksum offloads */
+	u64 vlan_ins;		/* # of Tx VLAN insertions */
+	u64 mapping_err;	/* # of I/O MMU packet mapping errors */
+	u64 coal_wr;            /* # of coalesced wr */
+	u64 coal_pkts;          /* # of coalesced packets */
+};
+
+struct sge_eth_txq {                   /* state for an SGE Ethernet Tx queue */
+	struct sge_txq q;
+	struct rte_eth_dev *eth_dev;   /* port that this queue belongs to */
+	struct sge_eth_tx_stats stats; /* queue statistics */
+	rte_spinlock_t txq_lock;
+
+	unsigned int flags;            /* flags for state of the queue */
+} __rte_cache_aligned;
+
+struct sge {
+	struct sge_eth_txq ethtxq[MAX_ETH_QSETS];
+	struct sge_eth_rxq ethrxq[MAX_ETH_QSETS];
+	struct sge_rspq fw_evtq __rte_cache_aligned;
+
+	u16 max_ethqsets;           /* # of available Ethernet queue sets */
+	u32 stat_len;               /* length of status page at ring end */
+	u32 pktshift;               /* padding between CPL & packet data */
+
+	/* response queue interrupt parameters */
+	u16 timer_val[SGE_NTIMERS];
+	u8  counter_val[SGE_NCOUNTERS];
+
+	u32 fl_align;               /* response queue message alignment */
+	u32 fl_pg_order;            /* large page allocation size */
+	u32 fl_starve_thres;        /* Free List starvation threshold */
+};
+
+#define T4_OS_NEEDS_MBOX_LOCKING 1
+
+/*
+ * OS Lock/List primitives for those interfaces in the Common Code which
+ * need this.
+ */
+
+struct mbox_entry {
+	TAILQ_ENTRY(mbox_entry) next;
+};
+
+TAILQ_HEAD(mbox_list, mbox_entry);
+
+struct adapter {
+	struct rte_pci_device *pdev;       /* associated rte pci device */
+	struct rte_eth_dev *eth_dev;       /* first port's rte eth device */
+	struct adapter_params params;      /* adapter parameters */
+	struct port_info port[MAX_NPORTS]; /* ports belonging to this adapter */
+	struct sge sge;                    /* associated SGE */
+
+	/* support for single-threading access to adapter mailbox registers */
+	struct mbox_list mbox_list;
+	rte_spinlock_t mbox_lock;
+
+	u8 *regs;              /* pointer to registers region */
+	u8 *bar2;              /* pointer to bar2 region */
+	unsigned long flags;   /* adapter flags */
+	unsigned int mbox;     /* associated mailbox */
+	unsigned int pf;       /* associated physical function id */
+
+	int use_unpacked_mode; /* unpacked rx mode state */
+};
+
+#define CXGBE_PCI_REG(reg) (*((volatile uint32_t *)(reg)))
+
+static inline uint64_t cxgbe_read_addr64(volatile void *addr)
+{
+	uint64_t val = CXGBE_PCI_REG(addr);
+	uint64_t val2 = CXGBE_PCI_REG(((volatile uint8_t *)(addr) + 4));
+
+	val2 = (uint64_t)(val2 << 32);
+	val += val2;
+	return val;
+}
+
+static inline uint32_t cxgbe_read_addr(volatile void *addr)
+{
+	return CXGBE_PCI_REG(addr);
+}
+
+#define CXGBE_PCI_REG_ADDR(adap, reg) \
+	((volatile uint32_t *)((char *)(adap)->regs + (reg)))
+
+#define CXGBE_READ_REG(adap, reg) \
+	cxgbe_read_addr(CXGBE_PCI_REG_ADDR((adap), (reg)))
+
+#define CXGBE_READ_REG64(adap, reg) \
+	cxgbe_read_addr64(CXGBE_PCI_REG_ADDR((adap), (reg)))
+
+#define CXGBE_PCI_REG_WRITE(reg, value) ({ \
+	CXGBE_PCI_REG((reg)) = (value); })
+
+#define CXGBE_WRITE_REG(adap, reg, value) \
+	CXGBE_PCI_REG_WRITE(CXGBE_PCI_REG_ADDR((adap), (reg)), (value))
+
+static inline uint64_t cxgbe_write_addr64(volatile void *addr, uint64_t val)
+{
+	CXGBE_PCI_REG(addr) = val;
+	CXGBE_PCI_REG(((volatile uint8_t *)(addr) + 4)) = (val >> 32);
+	return val;
+}
+
+#define CXGBE_WRITE_REG64(adap, reg, value) \
+	cxgbe_write_addr64(CXGBE_PCI_REG_ADDR((adap), (reg)), (value))
+
+/**
+ * t4_read_reg - read a HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ *
+ * Returns the 32-bit value of the given HW register.
+ */
+static inline u32 t4_read_reg(struct adapter *adapter, u32 reg_addr)
+{
+	u32 val = CXGBE_READ_REG(adapter, reg_addr);
+
+	CXGBE_DEBUG_REG(adapter, "read register 0x%x value 0x%x\n", reg_addr,
+			val);
+	return val;
+}
+
+/**
+ * t4_write_reg - write a HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ * @val: the value to write
+ *
+ * Write a 32-bit value into the given HW register.
+ */
+static inline void t4_write_reg(struct adapter *adapter, u32 reg_addr, u32 val)
+{
+	CXGBE_DEBUG_REG(adapter, "setting register 0x%x to 0x%x\n", reg_addr,
+			val);
+	CXGBE_WRITE_REG(adapter, reg_addr, val);
+}
+
+/**
+ * t4_read_reg64 - read a 64-bit HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ *
+ * Returns the 64-bit value of the given HW register.
+ */
+static inline u64 t4_read_reg64(struct adapter *adapter, u32 reg_addr)
+{
+	u64 val = CXGBE_READ_REG64(adapter, reg_addr);
+
+	CXGBE_DEBUG_REG(adapter, "64-bit read register %#x value %#llx\n",
+			reg_addr, (unsigned long long)val);
+	return val;
+}
+
+/**
+ * t4_write_reg64 - write a 64-bit HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ * @val: the value to write
+ *
+ * Write a 64-bit value into the given HW register.
+ */
+static inline void t4_write_reg64(struct adapter *adapter, u32 reg_addr,
+				  u64 val)
+{
+	CXGBE_DEBUG_REG(adapter, "setting register %#x to %#llx\n", reg_addr,
+			(unsigned long long)val);
+
+	CXGBE_WRITE_REG64(adapter, reg_addr, val);
+}
+
+/**
+ * t4_os_set_hw_addr - store a port's MAC address in SW
+ * @adapter: the adapter
+ * @port_idx: the port index
+ * @hw_addr: the Ethernet address
+ *
+ * Store the Ethernet address of the given port in SW.  Called by the
+ * common code when it retrieves a port's Ethernet address from EEPROM.
+ */
+static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx,
+				     u8 hw_addr[])
+{
+	struct port_info *pi = &adapter->port[port_idx];
+
+	ether_addr_copy((struct ether_addr *)hw_addr,
+			&pi->eth_dev->data->mac_addrs[0]);
+}
+
+/**
+ * t4_os_lock_init - initialize spinlock
+ * @lock: the spinlock
+ */
+static inline void t4_os_lock_init(rte_spinlock_t *lock)
+{
+	rte_spinlock_init(lock);
+}
+
+/**
+ * t4_os_lock - spin until lock is acquired
+ * @lock: the spinlock
+ */
+static inline void t4_os_lock(rte_spinlock_t *lock)
+{
+	rte_spinlock_lock(lock);
+}
+
+/**
+ * t4_os_unlock - unlock a spinlock
+ * @lock: the spinlock
+ */
+static inline void t4_os_unlock(rte_spinlock_t *lock)
+{
+	rte_spinlock_unlock(lock);
+}
+
+/**
+ * t4_os_init_list_head - initialize
+ * @head: head of list to initialize [to empty]
+ */
+static inline void t4_os_init_list_head(struct mbox_list *head)
+{
+	TAILQ_INIT(head);
+}
+
+static inline struct mbox_entry *t4_os_list_first_entry(struct mbox_list *head)
+{
+	return TAILQ_FIRST(head);
+}
+
+/**
+ * t4_os_atomic_add_tail - Enqueue list element atomically onto list
+ * @new: the entry to be addded to the queue
+ * @head: current head of the linked list
+ * @lock: lock to use to guarantee atomicity
+ */
+static inline void t4_os_atomic_add_tail(struct mbox_entry *entry,
+					 struct mbox_list *head,
+					 rte_spinlock_t *lock)
+{
+	t4_os_lock(lock);
+	TAILQ_INSERT_TAIL(head, entry, next);
+	t4_os_unlock(lock);
+}
+
+/**
+ * t4_os_atomic_list_del - Dequeue list element atomically from list
+ * @entry: the entry to be remove/dequeued from the list.
+ * @lock: the spinlock
+ */
+static inline void t4_os_atomic_list_del(struct mbox_entry *entry,
+					 struct mbox_list *head,
+					 rte_spinlock_t *lock)
+{
+	t4_os_lock(lock);
+	TAILQ_REMOVE(head, entry, next);
+	t4_os_unlock(lock);
+}
+
+/**
+ * adap2pinfo - return the port_info of a port
+ * @adap: the adapter
+ * @idx: the port index
+ *
+ * Return the port_info structure for the port of the given index.
+ */
+static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
+{
+	return &adap->port[idx];
+}
+
+void *t4_alloc_mem(size_t size);
+void t4_free_mem(void *addr);
+#define t4_os_alloc(_size)     t4_alloc_mem((_size))
+#define t4_os_free(_ptr)       t4_free_mem((_ptr))
+
+void t4_os_portmod_changed(const struct adapter *adap, int port_id);
+void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
+
+void reclaim_completed_tx(struct sge_txq *q);
+void t4_free_sge_resources(struct adapter *adap);
+void t4_sge_tx_monitor_start(struct adapter *adap);
+void t4_sge_tx_monitor_stop(struct adapter *adap);
+int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf);
+int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
+		     const struct pkt_gl *gl);
+int t4_sge_init(struct adapter *adap);
+int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
+			 struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			 unsigned int iqid, int socket_id);
+int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *rspq, bool fwevtq,
+		     struct rte_eth_dev *eth_dev, int intr_idx,
+		     struct sge_fl *fl, rspq_handler_t handler,
+		     int cong, struct rte_mempool *mp, int queue_id,
+		     int socket_id);
+int t4_sge_eth_txq_start(struct sge_eth_txq *txq);
+int t4_sge_eth_txq_stop(struct sge_eth_txq *txq);
+void t4_sge_eth_txq_release(struct adapter *adap, struct sge_eth_txq *txq);
+int t4_sge_eth_rxq_start(struct adapter *adap, struct sge_rspq *rq);
+int t4_sge_eth_rxq_stop(struct adapter *adap, struct sge_rspq *rq);
+void t4_sge_eth_rxq_release(struct adapter *adap, struct sge_eth_rxq *rxq);
+void t4_sge_eth_clear_queues(struct port_info *pi);
+int cxgb4_set_rspq_intr_params(struct sge_rspq *q, unsigned int us,
+			       unsigned int cnt);
+int cxgbe_poll(struct sge_rspq *q, struct rte_mbuf **rx_pkts,
+	       unsigned int budget, unsigned int *work_done);
+int cxgb4_write_rss(const struct port_info *pi, const u16 *queues);
+
+#endif /* __T4_ADAPTER_H__ */
drivers/net/cxgbe/base/common.h new file +401 -0

401 lines not on this page · raw message

drivers/net/cxgbe/base/t4_chip_type.h new file +79 -0

79 lines not on this page · raw message

drivers/net/cxgbe/base/t4_hw.c new file +2686 -0

1,955 lines not on this page · raw message

drivers/net/cxgbe/base/t4_hw.h new file +149 -0

149 lines not on this page · raw message

drivers/net/cxgbe/base/t4_msg.h new file +345 -0

345 lines not on this page · raw message

drivers/net/cxgbe/base/t4_pci_id_tbl.h new file +148 -0

148 lines not on this page · raw message

drivers/net/cxgbe/base/t4_regs.h new file +779 -0

779 lines not on this page · raw message

drivers/net/cxgbe/base/t4_regs_values.h new file +168 -0

168 lines not on this page · raw message

drivers/net/cxgbe/base/t4fw_interface.h new file +1730 -0

1,730 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.4.1

Part of the diff is not shown here. View the raw message.

#35 lore raw

PATCH v3 2/9 cxgbe: add cxgbe poll mode driver.

In reply to Rahul Lakkireddy

Adds cxgbe poll mode driver for DPDK under drivers/net/cxgbe directory. This patch:

1. Adds the Makefile to compile cxgbe pmd.
2. Registers and initializes the cxgbe pmd driver.

Enable cxgbe PMD for compilation and linking with changes to:
1. config/common_linuxapp to add macros for cxgbe pmd.
2. drivers/net/Makefile to add cxgbe pmd to the compile list.
3. mk/rte.app.mk to add cxgbe pmd to link.

Update MAINTAINERS file to claim responsibility for the cxgbe PMD.

---
v3:
- Merge patches 10 and 11 with this patch to enable compilation and update MAINTAINERS. Also, update commit log.
- Add rte_pmd_cxgbe_version.map and add EXPORT_MAP and LIBABIVER to cxgbe Makefile.
- Use RTE_DIM macro for calculating ARRAY_SIZE.

v2:
- Move files to new directory under drivers/net/cxgbe and update commit log.
- Move eth_dev_ops to separate patches.
- Update cxgbe Makefile to use relative rather than absolute path of pmd.
- Replace bitwise operations in fls() with gcc's __builtin_clz().
- Fix an issue in adap_init0_tweaks() related to rx_dma_offset.

 MAINTAINERS                                 |   5 +
 config/common_linuxapp                      |  10 +
 drivers/net/Makefile                        |   1 +
 drivers/net/cxgbe/Makefile                  |  78 +++
 drivers/net/cxgbe/cxgbe.h                   |  48 ++
 drivers/net/cxgbe/cxgbe_compat.h            | 266 +++++++++++
 drivers/net/cxgbe/cxgbe_ethdev.c            | 169 +++++++
 drivers/net/cxgbe/cxgbe_main.c              | 706 ++++++++++++++++++++++++++++
 drivers/net/cxgbe/rte_pmd_cxgbe_version.map |   4 +
 drivers/net/cxgbe/sge.c                     | 311 ++++++++++++
 mk/rte.app.mk                               |   1 +
 11 files changed, 1599 insertions(+)
 create mode 100644 drivers/net/cxgbe/Makefile
 create mode 100644 drivers/net/cxgbe/cxgbe.h
 create mode 100644 drivers/net/cxgbe/cxgbe_compat.h
 create mode 100644 drivers/net/cxgbe/cxgbe_ethdev.c
 create mode 100644 drivers/net/cxgbe/cxgbe_main.c
 create mode 100644 drivers/net/cxgbe/rte_pmd_cxgbe_version.map
 create mode 100644 drivers/net/cxgbe/sge.c
MAINTAINERS +5 -0
index 9362c19..1ec5117 100644
@@ -210,6 +210,11 @@ Linux AF_PACKET
 M: John W. Linville <[email protected]>
 F: drivers/net/af_packet/
 
+Chelsio cxgbe
+M: Rahul Lakkireddy <[email protected]>
+F: drivers/net/cxgbe/
+F: doc/guides/nics/cxgbe.rst
+
 Cisco enic
 F: drivers/net/enic/
 
config/common_linuxapp +10 -0
index 5deb55a..22a6d4e 100644
@@ -208,6 +208,16 @@ CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8
 CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1
 
 #
+# Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
+#
+CONFIG_RTE_LIBRTE_CXGBE_PMD=y
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n
+
+#
 # Compile burst-oriented Cisco ENIC PMD driver
 #
 CONFIG_RTE_LIBRTE_ENIC_PMD=y
drivers/net/Makefile +1 -0
index 1e6648a..644cacb 100644
@@ -33,6 +33,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += bonding
+DIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe
 DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000
 DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic
 DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
drivers/net/cxgbe/Makefile new file +78 -0

78 lines not on this page · raw message

drivers/net/cxgbe/cxgbe.h new file +48 -0

48 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_compat.h new file +266 -0

266 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_ethdev.c new file +169 -0

169 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c new file +706 -0

706 lines not on this page · raw message

drivers/net/cxgbe/rte_pmd_cxgbe_version.map new file +4 -0
new file mode 100644
index 0000000..bd8138a
@@ -0,0 +1,4 @@
+DPDK_2.1 {
+
+	local: *;
+};
drivers/net/cxgbe/sge.c new file +311 -0

311 lines not on this page · raw message

mk/rte.app.mk +1 -0
index 1a2043a..bba6ddc 100644
@@ -122,6 +122,7 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)    += -lrte_pmd_vmxnet3_uio
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD)     += -lrte_pmd_virtio
+_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD)      += -lrte_pmd_cxgbe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD)       += -lrte_pmd_enic
 _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)       += -lrte_pmd_i40e
 _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)      += -lrte_pmd_fm10k
Signature · 1 line
2.4.1
#36 lore raw

Re: [PATCH v3 2/9] cxgbe: add cxgbe poll mode driver.

2015-06-18 17:47, Rahul Lakkireddy:

MAINTAINERS Linux AF_PACKET · line 216

Quoted 4 lines
MAINTAINERS +4 -0
+Chelsio cxgbe
+M: Rahul Lakkireddy <[email protected]>
+F: drivers/net/cxgbe/
+F: doc/guides/nics/cxgbe.rst

Just a detail: the doc file is added in a later patch. For consistency, this line should be added later.

[...]

Quoted 4 lines
config/common_linuxapp +0 -0
@@ -208,6 +208,16 @@ CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8
 CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1

config/common_linuxapp CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8 · line 218

Quoted 10 lines
config/common_linuxapp +8 -0
 
 #
+# Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
+#
+CONFIG_RTE_LIBRTE_CXGBE_PMD=y
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n

What is the status of the driver with FreeBSD?
Could we, at least, add the options in common_bsdapp even disabled?

#37 lore raw

Re: [PATCH v3 2/9] cxgbe: add cxgbe poll mode driver.

Hi Thomas,

Quoted 8 lines · Thomas Monjalon

2015-06-18 17:47, Rahul Lakkireddy:

MAINTAINERS Linux AF_PACKET · line 216

Quoted 4 lines
MAINTAINERS +4 -0
+Chelsio cxgbe
+M: Rahul Lakkireddy <[email protected]>
+F: drivers/net/cxgbe/
+F: doc/guides/nics/cxgbe.rst

Just a detail: the doc file is added in a later patch. For consistency, this line should be added later.

I have fixed it in v4. Will post it soon.

Quoted 7 lines

[...]

Quoted 5 lines
config/common_linuxapp +0 -0
@@ -208,6 +208,16 @@ CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8
 CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1
 
Quoted 11 lines

config/common_linuxapp CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8 · line 218

Quoted 9 lines
config/common_linuxapp +8 -0
 #
+# Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
+#
+CONFIG_RTE_LIBRTE_CXGBE_PMD=y
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n

What is the status of the driver with FreeBSD?

We have compilation fixes in pipeline waiting for internal QA. We are currently mid-way in testing linux vfio after which we will pick up FBSD support.

Quoted 1 line

Could we, at least, add the options in common_bsdapp even disabled?

We tried compilation by keeping it disabled in common_bsdapp and the compilation goes fine.

However, if its ok with you, we would like to carry out some basic testing once our QA picks it up before adding this to common_bsdapp.

Thanks,
Rahul

#38 lore raw

PATCH v3 3/9 cxgbe: add device configuration and RX support for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds RX support for the cxgbe poll mode driver. This patch:

1. Adds rx queue related eth_dev_ops.
2. Adds RSS support.
3. Adds dev_configure() and dev_infos_get() eth_dev_ops.
4. Adds rx_pkt_burst for receiving packets.

---
v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Cleanup some RX related macros and code.

 drivers/net/cxgbe/cxgbe.h        |   6 +
 drivers/net/cxgbe/cxgbe_ethdev.c | 183 ++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 350 +++++++++++++++
 drivers/net/cxgbe/sge.c          | 915 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1454 insertions(+)
drivers/net/cxgbe/cxgbe.h +6 -0
index 44d48dc..90d1db0 100644
@@ -44,5 +44,11 @@
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
 int cxgbe_probe(struct adapter *adapter);
+void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
+	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
+int setup_sge_fwevtq(struct adapter *adapter);
+void cfg_queues(struct rte_eth_dev *eth_dev);
+int cfg_queue_count(struct rte_eth_dev *eth_dev);
+int setup_rss(struct port_info *pi);
 
 #endif /* _CXGBE_H_ */
drivers/net/cxgbe/cxgbe_ethdev.c +183 -0

196 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +350 -0

382 lines not on this page · raw message

drivers/net/cxgbe/sge.c +915 -0

927 lines not on this page · raw message

Signature · 1 line
2.4.1
#39 lore raw

Re: [PATCH v3 3/9] cxgbe: add device configuration and RX support for cxgbe PMD.

2015-06-18 17:47, Rahul Lakkireddy:

Quoted 9 lines

Adds RX support for the cxgbe poll mode driver. This patch:

1. Adds rx queue related eth_dev_ops.
2. Adds RSS support.
3. Adds dev_configure() and dev_infos_get() eth_dev_ops.
4. Adds rx_pkt_burst for receiving packets.

This patch doesn't build with 32-bit GCC because of some printf args (%lu).

#40 lore raw

Re: [PATCH v3 3/9] cxgbe: add device configuration and RX support for cxgbe PMD.

Quoted 8 lines · Thomas Monjalon

2015-06-18 17:47, Rahul Lakkireddy:

Quoted 7 lines

Adds RX support for the cxgbe poll mode driver. This patch:

1. Adds rx queue related eth_dev_ops.
2. Adds RSS support.
3. Adds dev_configure() and dev_infos_get() eth_dev_ops.
4. Adds rx_pkt_burst for receiving packets.

Quoted 4 lines
Quoted 2 lines

This patch doesn't build with 32-bit GCC because of some printf args (%lu).

I have fixed it in v4. Will post it soon.

Thanks,
Rahul.

#41 lore raw

PATCH v3 4/9 cxgbe: add TX support for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds TX support for the cxgbe poll mode driver. This patch:

1. Adds tx queue related eth_dev_ops.
2. Adds tx_pkt_burst for transmitting packets.

---
v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Few bug fixes for tx path.

 drivers/net/cxgbe/cxgbe_ethdev.c | 133 ++++++
 drivers/net/cxgbe/cxgbe_main.c   |   1 +
 drivers/net/cxgbe/sge.c          | 969 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 1103 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +133 -0
index 1c69973..b6e17e4 100644
@@ -85,6 +85,39 @@
  */
 #include "t4_pci_id_tbl.h"
 
+static uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+				uint16_t nb_pkts)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)tx_queue;
+	uint16_t pkts_sent, pkts_remain;
+	uint16_t total_sent = 0;
+	int ret = 0;
+
+	CXGBE_DEBUG_TX(adapter, "%s: txq = %p; tx_pkts = %p; nb_pkts = %d\n",
+		       __func__, txq, tx_pkts, nb_pkts);
+
+	t4_os_lock(&txq->txq_lock);
+	/* free up desc from already completed tx */
+	reclaim_completed_tx(&txq->q);
+	while (total_sent < nb_pkts) {
+		pkts_remain = nb_pkts - total_sent;
+
+		for (pkts_sent = 0; pkts_sent < pkts_remain; pkts_sent++) {
+			ret = t4_eth_xmit(txq, tx_pkts[total_sent + pkts_sent]);
+			if (ret < 0)
+				break;
+		}
+		if (!pkts_sent)
+			break;
+		total_sent += pkts_sent;
+		/* reclaim as much as possible */
+		reclaim_completed_tx(&txq->q);
+	}
+
+	t4_os_unlock(&txq->txq_lock);
+	return total_sent;
+}
+
 static uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts)
 {
@@ -131,8 +164,11 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	device_info->reta_size = pi->rss_size;
 }
 
+static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
+				    uint16_t tx_queue_id);
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t tx_queue_id);
+static void cxgbe_dev_tx_queue_release(void *q);
 static void cxgbe_dev_rx_queue_release(void *q);
 
 static int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
@@ -157,6 +193,98 @@ static int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
+static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
+				    uint16_t tx_queue_id)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)
+				  (eth_dev->data->tx_queues[tx_queue_id]);
+
+	dev_debug(NULL, "%s: tx_queue_id = %d\n", __func__, tx_queue_id);
+
+	return t4_sge_eth_txq_start(txq);
+}
+
+static int cxgbe_dev_tx_queue_stop(struct rte_eth_dev *eth_dev,
+				   uint16_t tx_queue_id)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)
+				  (eth_dev->data->tx_queues[tx_queue_id]);
+
+	dev_debug(NULL, "%s: tx_queue_id = %d\n", __func__, tx_queue_id);
+
+	return t4_sge_eth_txq_stop(txq);
+}
+
+static int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
+				    uint16_t queue_idx,	uint16_t nb_desc,
+				    unsigned int socket_id,
+				    const struct rte_eth_txconf *tx_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct sge *s = &adapter->sge;
+	struct sge_eth_txq *txq = &s->ethtxq[pi->first_qset + queue_idx];
+	int err = 0;
+	unsigned int temp_nb_desc;
+
+	RTE_SET_USED(tx_conf);
+
+	dev_debug(adapter, "%s: eth_dev->data->nb_tx_queues = %d; queue_idx = %d; nb_desc = %d; socket_id = %d; pi->first_qset = %u\n",
+		  __func__, eth_dev->data->nb_tx_queues, queue_idx, nb_desc,
+		  socket_id, pi->first_qset);
+
+	/*  Free up the existing queue  */
+	if (eth_dev->data->tx_queues[queue_idx]) {
+		cxgbe_dev_tx_queue_release(eth_dev->data->tx_queues[queue_idx]);
+		eth_dev->data->tx_queues[queue_idx] = NULL;
+	}
+
+	eth_dev->data->tx_queues[queue_idx] = (void *)txq;
+
+	/* Sanity Checking
+	 *
+	 * nb_desc should be > 1023 and <= CXGBE_MAX_RING_DESC_SIZE
+	 */
+	temp_nb_desc = nb_desc;
+	if (nb_desc < CXGBE_MIN_RING_DESC_SIZE) {
+		dev_warn(adapter, "%s: number of descriptors must be >= %d. Using default [%d]\n",
+			 __func__, CXGBE_MIN_RING_DESC_SIZE,
+			 CXGBE_DEFAULT_TX_DESC_SIZE);
+		temp_nb_desc = CXGBE_DEFAULT_TX_DESC_SIZE;
+	} else if (nb_desc > CXGBE_MAX_RING_DESC_SIZE) {
+		dev_err(adapter, "%s: number of descriptors must be between %d and %d inclusive. Default [%d]\n",
+			__func__, CXGBE_MIN_RING_DESC_SIZE,
+			CXGBE_MAX_RING_DESC_SIZE, CXGBE_DEFAULT_TX_DESC_SIZE);
+		return -(EINVAL);
+	}
+
+	txq->q.size = temp_nb_desc;
+
+	err = t4_sge_alloc_eth_txq(adapter, txq, eth_dev, queue_idx,
+				   s->fw_evtq.cntxt_id, socket_id);
+
+	dev_debug(adapter, "%s: txq->q.cntxt_id= %d err = %d\n",
+		  __func__, txq->q.cntxt_id, err);
+
+	return err;
+}
+
+static void cxgbe_dev_tx_queue_release(void *q)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)q;
+
+	if (txq) {
+		struct port_info *pi = (struct port_info *)
+				       (txq->eth_dev->data->dev_private);
+		struct adapter *adap = pi->adapter;
+
+		dev_debug(adapter, "%s: pi->port_id = %d; tx_queue_id = %d\n",
+			  __func__, pi->port_id, txq->q.cntxt_id);
+
+		t4_sge_eth_txq_release(adap, txq);
+	}
+}
+
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t rx_queue_id)
 {
@@ -264,6 +392,10 @@ static void cxgbe_dev_rx_queue_release(void *q)
 static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_configure		= cxgbe_dev_configure,
 	.dev_infos_get		= cxgbe_dev_info_get,
+	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
+	.tx_queue_start		= cxgbe_dev_tx_queue_start,
+	.tx_queue_stop		= cxgbe_dev_tx_queue_stop,
+	.tx_queue_release	= cxgbe_dev_tx_queue_release,
 	.rx_queue_setup         = cxgbe_dev_rx_queue_setup,
 	.rx_queue_start		= cxgbe_dev_rx_queue_start,
 	.rx_queue_stop		= cxgbe_dev_rx_queue_stop,
@@ -286,6 +418,7 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)
 
 	eth_dev->dev_ops = &cxgbe_eth_dev_ops;
 	eth_dev->rx_pkt_burst = &cxgbe_recv_pkts;
+	eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts;
 
 	/* for secondary processes, we don't initialise any further as primary
 	 * has already done this work.
drivers/net/cxgbe/cxgbe_main.c +1 -0
index abcef6b..3029b57 100644
@@ -1005,6 +1005,7 @@ allocate_mac:
 		pi->eth_dev->data->dev_private = pi;
 		pi->eth_dev->driver = adapter->eth_dev->driver;
 		pi->eth_dev->dev_ops = adapter->eth_dev->dev_ops;
+		pi->eth_dev->tx_pkt_burst = adapter->eth_dev->tx_pkt_burst;
 		pi->eth_dev->rx_pkt_burst = adapter->eth_dev->rx_pkt_burst;
 		TAILQ_INIT(&pi->eth_dev->link_intr_cbs);
 
drivers/net/cxgbe/sge.c +969 -0

1,005 lines not on this page · raw message

Signature · 1 line
2.4.1
#42 lore raw

PATCH v3 5/9 cxgbe: add device related operations for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds dev_start(), dev_stop(), and dev_close() eth_dev_ops for cxgbe poll mode driver.

---
v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Few changes related to tx bug fixes.

 drivers/net/cxgbe/cxgbe.h        |   4 ++
 drivers/net/cxgbe/cxgbe_ethdev.c | 114 ++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 139 +++++++++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/sge.c          |  58 ++++++++++++++++
 4 files changed, 315 insertions(+)
drivers/net/cxgbe/cxgbe.h +4 -0
index 90d1db0..bf08baf 100644
@@ -44,6 +44,10 @@
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
 int cxgbe_probe(struct adapter *adapter);
+int cxgbe_up(struct adapter *adap);
+int cxgbe_down(struct port_info *pi);
+void cxgbe_close(struct adapter *adapter);
+int link_start(struct port_info *pi);
 void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
 	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
 int setup_sge_fwevtq(struct adapter *adapter);
drivers/net/cxgbe/cxgbe_ethdev.c +114 -0

126 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +139 -0

151 lines not on this page · raw message

drivers/net/cxgbe/sge.c +58 -0

70 lines not on this page · raw message

Signature · 1 line
2.4.1
#43 lore raw

PATCH v3 6/9 cxgbe: add port statistics for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds stats_get() and stats_reset() eth_dev_ops for cxgbe poll mode driver.

---
v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.

 drivers/net/cxgbe/cxgbe.h        |  2 +
 drivers/net/cxgbe/cxgbe_ethdev.c | 83 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 11 ++++++
 3 files changed, 96 insertions(+)
drivers/net/cxgbe/cxgbe.h +2 -0
index bf08baf..97c37d2 100644
@@ -47,6 +47,8 @@ int cxgbe_probe(struct adapter *adapter);
 int cxgbe_up(struct adapter *adap);
 int cxgbe_down(struct port_info *pi);
 void cxgbe_close(struct adapter *adapter);
+void cxgbe_stats_get(struct port_info *pi, struct port_stats *stats);
+void cxgbe_stats_reset(struct port_info *pi);
 int link_start(struct port_info *pi);
 void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
 	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
drivers/net/cxgbe/cxgbe_ethdev.c +83 -0

95 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +11 -0
index 7995d3c..dad0a98 100644
@@ -310,6 +310,17 @@ void cfg_queues(struct rte_eth_dev *eth_dev)
 	}
 }
 
+void cxgbe_stats_get(struct port_info *pi, struct port_stats *stats)
+{
+	t4_get_port_stats_offset(pi->adapter, pi->tx_chan, stats,
+				 &pi->stats_base);
+}
+
+void cxgbe_stats_reset(struct port_info *pi)
+{
+	t4_clr_port_stats(pi->adapter, pi->tx_chan);
+}
+
 static void setup_memwin(struct adapter *adap)
 {
 	u32 mem_win0_base;
Signature · 1 line
2.4.1
#44 lore raw

PATCH v3 7/9 cxgbe: add link related functions for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds link update, promiscuous and multicast related eth_dev_ops for cxgbe poll mode driver.

---
v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Update cxgbe_dev_link_update() to return correct value.

 drivers/net/cxgbe/cxgbe_ethdev.c | 66 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +66 -0
index 600a16c..c0dd5f3 100644
@@ -164,6 +164,67 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	device_info->reta_size = pi->rss_size;
 }
 
+static void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      1, -1, 1, -1, false);
+}
+
+static void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      0, -1, 1, -1, false);
+}
+
+static void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	/* TODO: address filters ?? */
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      -1, 1, 1, -1, false);
+}
+
+static void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	/* TODO: address filters ?? */
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      -1, 0, 1, -1, false);
+}
+
+static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
+				 __rte_unused int wait_to_complete)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct sge *s = &adapter->sge;
+	struct rte_eth_link *old_link = &eth_dev->data->dev_link;
+	unsigned int work_done, budget = 4;
+
+	cxgbe_poll(&s->fw_evtq, NULL, budget, &work_done);
+	if (old_link->link_status == pi->link_cfg.link_ok)
+		return -1;  /* link not changed */
+
+	eth_dev->data->dev_link.link_status = pi->link_cfg.link_ok;
+	eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	eth_dev->data->dev_link.link_speed = pi->link_cfg.speed;
+
+	/* link has changed */
+	return 0;
+}
+
 static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t tx_queue_id);
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
@@ -585,8 +646,13 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_start		= cxgbe_dev_start,
 	.dev_stop		= cxgbe_dev_stop,
 	.dev_close		= cxgbe_dev_close,
+	.promiscuous_enable	= cxgbe_dev_promiscuous_enable,
+	.promiscuous_disable	= cxgbe_dev_promiscuous_disable,
+	.allmulticast_enable	= cxgbe_dev_allmulticast_enable,
+	.allmulticast_disable	= cxgbe_dev_allmulticast_disable,
 	.dev_configure		= cxgbe_dev_configure,
 	.dev_infos_get		= cxgbe_dev_info_get,
+	.link_update		= cxgbe_dev_link_update,
 	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
 	.tx_queue_start		= cxgbe_dev_tx_queue_start,
 	.tx_queue_stop		= cxgbe_dev_tx_queue_stop,
Signature · 1 line
2.4.1
#45 lore raw

PATCH v3 8/9 cxgbe: add flow control functions for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds flow control related eth_dev_ops for cxgbe poll mode driver.

---
v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.

 drivers/net/cxgbe/cxgbe_ethdev.c | 54 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +54 -0
index c0dd5f3..478051a 100644
@@ -642,6 +642,58 @@ static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
 	}
 }
 
+static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_fc_conf *fc_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct link_config *lc = &pi->link_cfg;
+	int rx_pause, tx_pause;
+
+	fc_conf->autoneg = lc->fc & PAUSE_AUTONEG;
+	rx_pause = lc->fc & PAUSE_RX;
+	tx_pause = lc->fc & PAUSE_TX;
+
+	if (rx_pause && tx_pause)
+		fc_conf->mode = RTE_FC_FULL;
+	else if (rx_pause)
+		fc_conf->mode = RTE_FC_RX_PAUSE;
+	else if (tx_pause)
+		fc_conf->mode = RTE_FC_TX_PAUSE;
+	else
+		fc_conf->mode = RTE_FC_NONE;
+	return 0;
+}
+
+static int cxgbe_flow_ctrl_set(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_fc_conf *fc_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct link_config *lc = &pi->link_cfg;
+
+	if (lc->supported & FW_PORT_CAP_ANEG) {
+		if (fc_conf->autoneg)
+			lc->requested_fc |= PAUSE_AUTONEG;
+		else
+			lc->requested_fc &= ~PAUSE_AUTONEG;
+	}
+
+	if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
+	    (fc_conf->mode & RTE_FC_RX_PAUSE))
+		lc->requested_fc |= PAUSE_RX;
+	else
+		lc->requested_fc &= ~PAUSE_RX;
+
+	if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
+	    (fc_conf->mode & RTE_FC_TX_PAUSE))
+		lc->requested_fc |= PAUSE_TX;
+	else
+		lc->requested_fc &= ~PAUSE_TX;
+
+	return t4_link_l1cfg(adapter, adapter->mbox, pi->tx_chan,
+			     &pi->link_cfg);
+}
+
 static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_start		= cxgbe_dev_start,
 	.dev_stop		= cxgbe_dev_stop,
@@ -663,6 +715,8 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.rx_queue_release	= cxgbe_dev_rx_queue_release,
 	.stats_get		= cxgbe_dev_stats_get,
 	.stats_reset		= cxgbe_dev_stats_reset,
+	.flow_ctrl_get		= cxgbe_flow_ctrl_get,
+	.flow_ctrl_set		= cxgbe_flow_ctrl_set,
 };
 
 /*
Signature · 1 line
2.4.1
#46 lore raw

PATCH v3 9/9 doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

In reply to Rahul Lakkireddy

Adds cxgbe poll mode driver documentation under the usual doc/guides/nics/ directory with the rest of the drivers. The documentation covers cxgbe implementation details, features and limitations, prerequisites, configuration, and a sample application usage.

---
v3:
- No changes.

v2:
- Move cxgbe entry to Drivers section in source_org.rst.
- Order the cxgbe entry alphabetically in index.rst.

 doc/guides/nics/cxgbe.rst            | 209 +++++++++++++++++++++++++++++++++++
 doc/guides/nics/index.rst            |   1 +
 doc/guides/prog_guide/source_org.rst |   1 +
 3 files changed, 211 insertions(+)
 create mode 100644 doc/guides/nics/cxgbe.rst
doc/guides/nics/cxgbe.rst new file +209 -0
new file mode 100644
index 0000000..54a019d
@@ -0,0 +1,209 @@
+..  BSD LICENSE
+    Copyright 2015 Chelsio Communications.
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+    * Neither the name of Chelsio Communications nor the names of its
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+CXGBE Poll Mode Driver
+======================
+
+The CXGBE PMD (**librte_pmd_cxgbe**) provides poll mode driver support
+for **Chelsio T5** 10/40 Gbps family of adapters.
+
+More information can be found at `Chelsio Communications
+<http://www.chelsio.com>`_.
+
+Features
+--------
+
+CXGBE PMD has the support for:
+
+- Multiple queues for TX and RX.
+- Receiver Side Steering (RSS).
+- VLAN filtering.
+- Checksum offload.
+- Promiscuous mode.
+- All multicast mode.
+- Port hardware statistics.
+
+Limitations
+-----------
+
+The Chelsio T5 devices provide two/four ports but expose a single PCI bus
+address, thus, librte_pmd_cxgbe registers itself as a
+PCI driver that allocates one Ethernet device per detected port.
+
+For this reason, one cannot white/blacklist a single port without also
+white/blacklisting the others on the same device.
+
+Configuration
+-------------
+
+Compiling CXGBE PMD
+~~~~~~~~~~~~~~~~~~~
+
+These options can be modified in the ``.config`` file.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_PMD`` (default **y**)
+
+  Toggle compilation of librte_pmd_cxgbe driver.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional generic debugging
+  messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional registers related
+  run-time checks and debugging messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional firmware mailbox
+  related run-time checks and debugging messages at the cost of lower
+  performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional transmission data
+  path run-time checks and debugging messages at the cost of lower performance.
+
+- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX`` (default **n**)
+
+  Toggle debugging code. Enabling this option adds additional receiving data
+  path run-time checks and debugging messages at the cost of lower performance.
+
+Prerequisites
+-------------
+
+- Requires firmware version **1.13.32.0** and higher. Visit
+  `Chelsio Communications <http://www.chelsio.com>`_ to get latest firmware.
+
+Sample Application Notes
+-------------------------
+
+This section demonstrates how to launch **testpmd** with Chelsio T5
+devices managed by librte_pmd_cxgbe.
+
+#. Load the kernel module:
+
+   .. code-block:: console
+
+      modprobe cxgb4
+
+#. Get the PCI bus addresses of the interfaces bound to cxgb4 driver:
+
+   .. code-block:: console
+
+      dmesg | tail -2
+
+   Example output:
+
+   .. code-block:: console
+
+      cxgb4 0000:02:00.4 p1p1: renamed from eth0
+      cxgb4 0000:02:00.4 p1p2: renamed from eth1
+
+   .. note::
+
+      Both the interfaces of a Chelsio T5 2-port adapter are bound to the
+      same PCI bus address.
+
+#. Unload the kernel module:
+
+   .. code-block:: console
+
+      modprobe -ar cxgb4 csiostor
+
+#. Request huge pages:
+
+   .. code-block:: console
+
+      echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages/nr_hugepages
+
+#. Load igb_uio or vfio-pci driver:
+
+   .. code-block:: console
+
+      insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
+
+   or
+
+   .. code-block:: console
+
+      modprobe vfio-pci
+
+#. Bind the Chelsio T5 adapters to igb_uio or vfio-pci loaded in the previous
+   step:
+
+   .. code-block:: console
+
+      ./tools/dpdk_nic_bind.py --bind igb_uio 0000:02:00.4
+
+   or
+
+   Setup VFIO permissions for regular users and then bind to vfio-pci:
+
+   .. code-block:: console
+
+      sudo chmod a+x /dev/vfio
+
+      sudo chmod 0666 /dev/vfio/*
+
+      ./tools/dpdk_nic_bind.py --bind vfio-pci 0000:02:00.4
+
+#. Start testpmd with basic parameters:
+
+   .. code-block:: console
+
+      ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 4 -w 0000:02:00.4 -- -i
+
+   Example output:
+
+   .. code-block:: console
+
+      [...]
+      EAL: PCI device 0000:02:00.4 on NUMA socket -1
+      EAL:   probe driver: 1425:5401 rte_cxgbe_pmd
+      EAL:   PCI memory mapped at 0x7fd7c0200000
+      EAL:   PCI memory mapped at 0x7fd77cdfd000
+      EAL:   PCI memory mapped at 0x7fd7c10b7000
+      PMD: rte_cxgbe_pmd: fw: 1.13.33.0, TP: 0.1.4.8
+      PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
+      Interactive-mode selected
+      Configuring Port 0 (socket 0)
+      Port 0: 00:07:43:2D:EA:C0
+      Configuring Port 1 (socket 0)
+      Port 1: 00:07:43:2D:EA:C8
+      Checking link statuses...
+      PMD: rte_cxgbe_pmd: Port0: passive DA port module inserted
+      PMD: rte_cxgbe_pmd: Port1: passive DA port module inserted
+      Port 0 Link Up - speed 10000 Mbps - full-duplex
+      Port 1 Link Up - speed 10000 Mbps - full-duplex
+      Done
+      testpmd>
doc/guides/nics/index.rst +1 -0
index 1ee67fa..d1a92f8 100644
@@ -40,6 +40,7 @@ Network Interface Controller Drivers
     :maxdepth: 3
     :numbered:
 
+    cxgbe
     e1000em
     ixgbe
     intel_vf
doc/guides/prog_guide/source_org.rst +1 -0
index 4f6f489..bfdaa8a 100644
@@ -97,6 +97,7 @@ The drivers directory has a net subdirectory which contains::
     drivers/net
     +-- af_packet          # poll mode driver based on linux af_packet
     +-- bonding            # bonding poll mode driver
+    +-- cxgbe              # Chelsio Terminator 10GbE/40GbE poll mode driver
     +-- e1000              # 1GbE poll mode drivers (igb and em)
     +-- enic               # Cisco VIC Ethernet NIC Poll-mode Driver
     +-- fm10k              # Host interface PMD driver for FM10000 Series
Signature · 1 line
2.4.1
Acked-by on v3 9/9
#47 lore raw

Re: [PATCH v3 9/9] doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Rahul Lakkireddy
Sent: Thursday, June 18, 2015 1:17 PM
To: [email protected]
Cc: Felix Marti; Kumar Sanghvi; Nirranjan Kirubaharan
Subject: [dpdk-dev] [PATCH v3 9/9] doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

Quoted 7 lines

Adds cxgbe poll mode driver documentation under the usual doc/guides/nics/ directory with the rest of the drivers. The documentation covers cxgbe implementation details, features and limitations, prerequisites, configuration, and a sample application usage.

#48 lore raw
In reply to Rahul Lakkireddy
Quoted 39 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Rahul Lakkireddy
Sent: Thursday, June 18, 2015 1:17 PM
To: [email protected]
Cc: Felix Marti; Kumar Sanghvi; Nirranjan Kirubaharan
Subject: [dpdk-dev] [PATCH v3 0/9] Chelsio Terminator 5 (T5) 10G/40G Poll Mode Driver

...
Rahul Lakkireddy (9):
cxgbe: add hardware specific api for all supported Chelsio T5 series
adapters.
cxgbe: add cxgbe poll mode driver.
cxgbe: add device configuration and RX support for cxgbe PMD.
cxgbe: add TX support for cxgbe PMD.
cxgbe: add device related operations for cxgbe PMD.
cxgbe: add port statistics for cxgbe PMD.
cxgbe: add link related functions for cxgbe PMD.
cxgbe: add flow control functions for cxgbe PMD.
doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

 MAINTAINERS                                 |    5 +
 config/common_linuxapp                      |   10 +
 doc/guides/nics/cxgbe.rst                   |  209 +++
 doc/guides/nics/index.rst                   |    1 +
 doc/guides/prog_guide/source_org.rst        |    1 +
 drivers/net/Makefile                        |    1 +
 drivers/net/cxgbe/Makefile                  |   78 +
 drivers/net/cxgbe/base/adapter.h            |  565 ++++++
 drivers/net/cxgbe/base/common.h             |  401 ++++
 drivers/net/cxgbe/base/t4_chip_type.h       |   79 +
 drivers/net/cxgbe/base/t4_hw.c              | 2686 +++++++++++++++++++++++++++
 drivers/net/cxgbe/base/t4_hw.h              |  149 ++
 drivers/net/cxgbe/base/t4_msg.h             |  345 ++++
 drivers/net/cxgbe/base/t4_pci_id_tbl.h      |  148 ++
 drivers/net/cxgbe/base/t4_regs.h            |  779 ++++++++
 drivers/net/cxgbe/base/t4_regs_values.h     |  168 ++
Quoted 8 lines
 drivers/net/cxgbe/base/t4fw_interface.h     | 1730 +++++++++++++++++
 drivers/net/cxgbe/cxgbe.h                   |   60 +
 drivers/net/cxgbe/cxgbe_compat.h            |  266 +++
 drivers/net/cxgbe/cxgbe_ethdev.c            |  802 ++++++++
 drivers/net/cxgbe/cxgbe_main.c              | 1207 ++++++++++++
 drivers/net/cxgbe/rte_pmd_cxgbe_version.map |    4 +
 drivers/net/cxgbe/sge.c                     | 2253 ++++++++++++++++++++++
 mk/rte.app.mk                               |    1 +

Hi,

Some minor feedback to help the patchset on its way.

The patches apply cleanly and compile. There is an compilation initialization warning after patch 2/9 but that is fixed in 3/9. Checkpatch warnings are all minor. Documentation is good. All changes are isolated to drivers/net/cxgbe.

John

#49 lore raw

v4 cover Chelsio Terminator 5 (T5) 10G/40G Poll Mode Driver

In reply to Rahul Lakkireddy

This series of patches add the CXGBE Poll Mode Driver support for Chelsio Terminator 5 series of 10G/40G adapters. The CXGBE PMD is split into multiple patches. The first patch adds the hardware specific api for all supported Chelsio T5 adapters and the patches from 2 to 8 add the actual DPDK CXGBE PMD.

Also, the CXGBE PMD is enabled for compilation and linking by patch 2. MAINTAINERS file is also updated by patch 2 to claim responsibility for the CXGBE PMD.

More information on the CXGBE PMD can be found in the documentation added by patch 9.

v4:
- Fix 32-bit and clang compilation.
- Moved cxgbe doc entry in MAINTAINERS from patch 2 to patch 9 for consistency.

v3:
- Merge patches 10 and 11 with patch 2.
- Add rte_pmd_cxgbe_version.map and add EXPORT_MAP and LIBABIVER to cxgbe Makefile.
- Use RTE_DIM macro for calculating ARRAY_SIZE.

v2:
- Move the driver to drivers/net directory and update all config files and commit logs. Also update MAINTAINERS.
- Break the second patch into more patches; incrementally, adding features to the cxgbe poll mode driver.
- Replace bitwise operations in finding last (most significant) bit set with gcc's __builtin_clz.
- Fix the return value returned by link update eth_dev operation.
- Few bug fixes and code cleanup.

Rahul Lakkireddy (9):
cxgbe: add hardware specific api for all supported Chelsio T5 series
adapters.
cxgbe: add cxgbe poll mode driver.
cxgbe: add device configuration and RX support for cxgbe PMD.
cxgbe: add TX support for cxgbe PMD.
cxgbe: add device related operations for cxgbe PMD.
cxgbe: add port statistics for cxgbe PMD.
cxgbe: add link related functions for cxgbe PMD.
cxgbe: add flow control functions for cxgbe PMD.
doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

 MAINTAINERS                                 |    5 +
 config/common_linuxapp                      |   10 +
 doc/guides/nics/cxgbe.rst                   |  209 +++
 doc/guides/nics/index.rst                   |    1 +
 doc/guides/prog_guide/source_org.rst        |    1 +
 drivers/net/Makefile                        |    1 +
 drivers/net/cxgbe/Makefile                  |   78 +
 drivers/net/cxgbe/base/adapter.h            |  565 ++++++
 drivers/net/cxgbe/base/common.h             |  401 ++++
 drivers/net/cxgbe/base/t4_chip_type.h       |   79 +
 drivers/net/cxgbe/base/t4_hw.c              | 2686 +++++++++++++++++++++++++++
 drivers/net/cxgbe/base/t4_hw.h              |  149 ++
 drivers/net/cxgbe/base/t4_msg.h             |  345 ++++
 drivers/net/cxgbe/base/t4_pci_id_tbl.h      |  148 ++
 drivers/net/cxgbe/base/t4_regs.h            |  779 ++++++++
 drivers/net/cxgbe/base/t4_regs_values.h     |  168 ++
 drivers/net/cxgbe/base/t4fw_interface.h     | 1730 +++++++++++++++++
 drivers/net/cxgbe/cxgbe.h                   |   60 +
 drivers/net/cxgbe/cxgbe_compat.h            |  266 +++
 drivers/net/cxgbe/cxgbe_ethdev.c            |  802 ++++++++
 drivers/net/cxgbe/cxgbe_main.c              | 1207 ++++++++++++
 drivers/net/cxgbe/rte_pmd_cxgbe_version.map |    4 +
 drivers/net/cxgbe/sge.c                     | 2241 ++++++++++++++++++++++
 mk/rte.app.mk                               |    1 +
 24 files changed, 11936 insertions(+)
 create mode 100644 doc/guides/nics/cxgbe.rst
 create mode 100644 drivers/net/cxgbe/Makefile
 create mode 100644 drivers/net/cxgbe/base/adapter.h
 create mode 100644 drivers/net/cxgbe/base/common.h
 create mode 100644 drivers/net/cxgbe/base/t4_chip_type.h
 create mode 100644 drivers/net/cxgbe/base/t4_hw.c
 create mode 100644 drivers/net/cxgbe/base/t4_hw.h
 create mode 100644 drivers/net/cxgbe/base/t4_msg.h
 create mode 100644 drivers/net/cxgbe/base/t4_pci_id_tbl.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs_values.h
 create mode 100644 drivers/net/cxgbe/base/t4fw_interface.h
 create mode 100644 drivers/net/cxgbe/cxgbe.h
 create mode 100644 drivers/net/cxgbe/cxgbe_compat.h
 create mode 100644 drivers/net/cxgbe/cxgbe_ethdev.c
 create mode 100644 drivers/net/cxgbe/cxgbe_main.c
 create mode 100644 drivers/net/cxgbe/rte_pmd_cxgbe_version.map
 create mode 100644 drivers/net/cxgbe/sge.c
Signature · 1 line
2.4.1
#50 lore raw

PATCH v4 1/9 cxgbe: add hardware specific api for all supported Chelsio T5 series adapters.

Adds hardware specific api for all the Chelsio T5 adapters under drivers/net/cxgbe/base directory.

---
v4:
- No changes

v3:
- No changes

v2:
- Move files to new directory under drivers/net/cxgbe/base and update commit log.
- Few bug fixes related to tx.

 drivers/net/cxgbe/base/adapter.h        |  565 +++++++
 drivers/net/cxgbe/base/common.h         |  401 +++++
 drivers/net/cxgbe/base/t4_chip_type.h   |   79 +
 drivers/net/cxgbe/base/t4_hw.c          | 2686 +++++++++++++++++++++++++++++++
 drivers/net/cxgbe/base/t4_hw.h          |  149 ++
 drivers/net/cxgbe/base/t4_msg.h         |  345 ++++
 drivers/net/cxgbe/base/t4_pci_id_tbl.h  |  148 ++
 drivers/net/cxgbe/base/t4_regs.h        |  779 +++++++++
 drivers/net/cxgbe/base/t4_regs_values.h |  168 ++
 drivers/net/cxgbe/base/t4fw_interface.h | 1730 ++++++++++++++++++++
 10 files changed, 7050 insertions(+)
 create mode 100644 drivers/net/cxgbe/base/adapter.h
 create mode 100644 drivers/net/cxgbe/base/common.h
 create mode 100644 drivers/net/cxgbe/base/t4_chip_type.h
 create mode 100644 drivers/net/cxgbe/base/t4_hw.c
 create mode 100644 drivers/net/cxgbe/base/t4_hw.h
 create mode 100644 drivers/net/cxgbe/base/t4_msg.h
 create mode 100644 drivers/net/cxgbe/base/t4_pci_id_tbl.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs.h
 create mode 100644 drivers/net/cxgbe/base/t4_regs_values.h
 create mode 100644 drivers/net/cxgbe/base/t4fw_interface.h
drivers/net/cxgbe/base/adapter.h new file +565 -0
new file mode 100644
index 0000000..0ea1c95
@@ -0,0 +1,565 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2014-2015 Chelsio Communications.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Chelsio Communications nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* This file should not be included directly.  Include common.h instead. */
+
+#ifndef __T4_ADAPTER_H__
+#define __T4_ADAPTER_H__
+
+#include <rte_mbuf.h>
+
+#include "cxgbe_compat.h"
+#include "t4_regs_values.h"
+
+enum {
+	MAX_ETH_QSETS = 64,           /* # of Ethernet Tx/Rx queue sets */
+};
+
+struct adapter;
+struct sge_rspq;
+
+enum {
+	PORT_RSS_DONE = (1 << 0),
+};
+
+struct port_info {
+	struct adapter *adapter;        /* adapter that this port belongs to */
+	struct rte_eth_dev *eth_dev;    /* associated rte eth device */
+	struct port_stats stats_base;   /* port statistics base */
+	struct link_config link_cfg;    /* link configuration info */
+
+	unsigned long flags;            /* port related flags */
+	short int xact_addr_filt;       /* index of exact MAC address filter */
+
+	u16    viid;                    /* associated virtual interface id */
+	s8     mdio_addr;               /* address of the PHY */
+	u8     port_type;               /* firmware port type */
+	u8     mod_type;                /* firmware module type */
+	u8     port_id;                 /* physical port ID */
+	u8     tx_chan;                 /* associated channel */
+
+	u8     n_rx_qsets;              /* # of rx qsets */
+	u8     n_tx_qsets;              /* # of tx qsets */
+	u8     first_qset;              /* index of first qset */
+
+	u16    *rss;                    /* rss table */
+	u8     rss_mode;                /* rss mode */
+	u16    rss_size;                /* size of VI's RSS table slice */
+};
+
+/* Enable or disable autonegotiation.  If this is set to enable,
+ * the forced link modes above are completely ignored.
+ */
+#define AUTONEG_DISABLE         0x00
+#define AUTONEG_ENABLE          0x01
+
+enum {                                 /* adapter flags */
+	FULL_INIT_DONE     = (1 << 0),
+	USING_MSI          = (1 << 1),
+	USING_MSIX         = (1 << 2),
+	FW_QUEUE_BOUND     = (1 << 3),
+	FW_OK              = (1 << 4),
+	CFG_QUEUES	   = (1 << 5),
+	MASTER_PF          = (1 << 6),
+};
+
+struct rx_sw_desc {                /* SW state per Rx descriptor */
+	void *buf;                 /* struct page or mbuf */
+	dma_addr_t dma_addr;
+};
+
+struct sge_fl {                     /* SGE free-buffer queue state */
+	/* RO fields */
+	struct rx_sw_desc *sdesc;   /* address of SW Rx descriptor ring */
+
+	dma_addr_t addr;            /* bus address of HW ring start */
+	__be64 *desc;               /* address of HW Rx descriptor ring */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cntxt_id;      /* SGE relative QID for the free list */
+	unsigned int size;          /* capacity of free list */
+
+	unsigned int avail;         /* # of available Rx buffers */
+	unsigned int pend_cred;     /* new buffers since last FL DB ring */
+	unsigned int cidx;          /* consumer index */
+	unsigned int pidx;          /* producer index */
+
+	unsigned long alloc_failed; /* # of times buffer allocation failed */
+	unsigned long low;          /* # of times momentarily starving */
+};
+
+#define MAX_MBUF_FRAGS (16384 / 512 + 2)
+
+/* A packet gather list */
+struct pkt_gl {
+	union {
+		struct rte_mbuf *mbufs[MAX_MBUF_FRAGS];
+	} /* UNNAMED */;
+	void *va;                         /* virtual address of first byte */
+	unsigned int nfrags;              /* # of fragments */
+	unsigned int tot_len;             /* total length of fragments */
+	bool usembufs;                    /* use mbufs for fragments */
+};
+
+typedef int (*rspq_handler_t)(struct sge_rspq *q, const __be64 *rsp,
+			      const struct pkt_gl *gl);
+
+struct sge_rspq {                   /* state for an SGE response queue */
+	struct adapter *adapter;      /* adapter that this queue belongs to */
+	struct rte_eth_dev *eth_dev;  /* associated rte eth device */
+	struct rte_mempool  *mb_pool; /* associated mempool */
+
+	dma_addr_t phys_addr;       /* physical address of the ring */
+	__be64 *desc;               /* address of HW response ring */
+	const __be64 *cur_desc;     /* current descriptor in queue */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cidx;          /* consumer index */
+	unsigned int iqe_len;       /* entry size */
+	unsigned int size;          /* capacity of response queue */
+	int offset;                 /* offset into current Rx buffer */
+
+	u8 gen;                     /* current generation bit */
+	u8 intr_params;             /* interrupt holdoff parameters */
+	u8 next_intr_params;        /* holdoff params for next interrupt */
+	u8 pktcnt_idx;              /* interrupt packet threshold */
+	u8 idx;                     /* queue index within its group */
+	u16 cntxt_id;               /* SGE relative QID for the response Q */
+	u16 abs_id;                 /* absolute SGE id for the response q */
+
+	rspq_handler_t handler;     /* associated handler for this response q */
+};
+
+struct sge_eth_rx_stats {	/* Ethernet rx queue statistics */
+	u64 pkts;		/* # of ethernet packets */
+	u64 rx_bytes;		/* # of ethernet bytes */
+	u64 rx_cso;		/* # of Rx checksum offloads */
+	u64 vlan_ex;		/* # of Rx VLAN extractions */
+	u64 rx_drops;		/* # of packets dropped due to no mem */
+};
+
+struct sge_eth_rxq {                /* a SW Ethernet Rx queue */
+	struct sge_rspq rspq;
+	struct sge_fl fl;
+	struct sge_eth_rx_stats stats;
+	bool usembufs;               /* one ingress packet per mbuf FL buffer */
+} __rte_cache_aligned;
+
+/*
+ * Currently there are two types of coalesce WR. Type 0 needs 48 bytes per
+ * packet (if one sgl is present) and type 1 needs 32 bytes. This means
+ * that type 0 can fit a maximum of 10 packets per WR and type 1 can fit
+ * 15 packets. We need to keep track of the mbuf pointers in a coalesce WR
+ * to be able to free those mbufs when we get completions back from the FW.
+ * Allocating the maximum number of pointers in every tx desc is a waste
+ * of memory resources so we only store 2 pointers per tx desc which should
+ * be enough since a tx desc can only fit 2 packets in the best case
+ * scenario where a packet needs 32 bytes.
+ */
+#define ETH_COALESCE_PKT_NUM 15
+#define ETH_COALESCE_PKT_PER_DESC 2
+
+struct tx_eth_coal_desc {
+	struct rte_mbuf *mbuf[ETH_COALESCE_PKT_PER_DESC];
+	struct ulptx_sgl *sgl[ETH_COALESCE_PKT_PER_DESC];
+	int idx;
+};
+
+struct tx_desc {
+	__be64 flit[8];
+};
+
+struct tx_sw_desc {                /* SW state per Tx descriptor */
+	struct rte_mbuf *mbuf;
+	struct ulptx_sgl *sgl;
+	struct tx_eth_coal_desc coalesce;
+};
+
+enum {
+	EQ_STOPPED = (1 << 0),
+};
+
+struct eth_coalesce {
+	unsigned char *ptr;
+	unsigned char type;
+	unsigned int idx;
+	unsigned int len;
+	unsigned int flits;
+	unsigned int max;
+};
+
+struct sge_txq {
+	struct tx_desc *desc;       /* address of HW Tx descriptor ring */
+	struct tx_sw_desc *sdesc;   /* address of SW Tx descriptor ring */
+	struct sge_qstat *stat;     /* queue status entry */
+	struct eth_coalesce coalesce; /* coalesce info */
+
+	uint64_t phys_addr;         /* physical address of the ring */
+
+	void __iomem *bar2_addr;    /* address of BAR2 Queue registers */
+	unsigned int bar2_qid;      /* Queue ID for BAR2 Queue registers */
+
+	unsigned int cntxt_id;     /* SGE relative QID for the Tx Q */
+	unsigned int in_use;       /* # of in-use Tx descriptors */
+	unsigned int size;         /* # of descriptors */
+	unsigned int cidx;         /* SW consumer index */
+	unsigned int pidx;         /* producer index */
+	unsigned int dbidx;	   /* last idx when db ring was done */
+	unsigned int equeidx;	   /* last sent credit request */
+	unsigned int last_pidx;	   /* last pidx recorded by tx monitor */
+	unsigned int last_coal_idx;/* last coal-idx recorded by tx monitor */
+
+	int db_disabled;            /* doorbell state */
+	unsigned short db_pidx;     /* doorbell producer index */
+	unsigned short db_pidx_inc; /* doorbell producer increment */
+};
+
+struct sge_eth_tx_stats {	/* Ethernet tx queue statistics */
+	u64 pkts;		/* # of ethernet packets */
+	u64 tx_bytes;		/* # of ethernet bytes */
+	u64 tso;		/* # of TSO requests */
+	u64 tx_cso;		/* # of Tx checksum offloads */
+	u64 vlan_ins;		/* # of Tx VLAN insertions */
+	u64 mapping_err;	/* # of I/O MMU packet mapping errors */
+	u64 coal_wr;            /* # of coalesced wr */
+	u64 coal_pkts;          /* # of coalesced packets */
+};
+
+struct sge_eth_txq {                   /* state for an SGE Ethernet Tx queue */
+	struct sge_txq q;
+	struct rte_eth_dev *eth_dev;   /* port that this queue belongs to */
+	struct sge_eth_tx_stats stats; /* queue statistics */
+	rte_spinlock_t txq_lock;
+
+	unsigned int flags;            /* flags for state of the queue */
+} __rte_cache_aligned;
+
+struct sge {
+	struct sge_eth_txq ethtxq[MAX_ETH_QSETS];
+	struct sge_eth_rxq ethrxq[MAX_ETH_QSETS];
+	struct sge_rspq fw_evtq __rte_cache_aligned;
+
+	u16 max_ethqsets;           /* # of available Ethernet queue sets */
+	u32 stat_len;               /* length of status page at ring end */
+	u32 pktshift;               /* padding between CPL & packet data */
+
+	/* response queue interrupt parameters */
+	u16 timer_val[SGE_NTIMERS];
+	u8  counter_val[SGE_NCOUNTERS];
+
+	u32 fl_align;               /* response queue message alignment */
+	u32 fl_pg_order;            /* large page allocation size */
+	u32 fl_starve_thres;        /* Free List starvation threshold */
+};
+
+#define T4_OS_NEEDS_MBOX_LOCKING 1
+
+/*
+ * OS Lock/List primitives for those interfaces in the Common Code which
+ * need this.
+ */
+
+struct mbox_entry {
+	TAILQ_ENTRY(mbox_entry) next;
+};
+
+TAILQ_HEAD(mbox_list, mbox_entry);
+
+struct adapter {
+	struct rte_pci_device *pdev;       /* associated rte pci device */
+	struct rte_eth_dev *eth_dev;       /* first port's rte eth device */
+	struct adapter_params params;      /* adapter parameters */
+	struct port_info port[MAX_NPORTS]; /* ports belonging to this adapter */
+	struct sge sge;                    /* associated SGE */
+
+	/* support for single-threading access to adapter mailbox registers */
+	struct mbox_list mbox_list;
+	rte_spinlock_t mbox_lock;
+
+	u8 *regs;              /* pointer to registers region */
+	u8 *bar2;              /* pointer to bar2 region */
+	unsigned long flags;   /* adapter flags */
+	unsigned int mbox;     /* associated mailbox */
+	unsigned int pf;       /* associated physical function id */
+
+	int use_unpacked_mode; /* unpacked rx mode state */
+};
+
+#define CXGBE_PCI_REG(reg) (*((volatile uint32_t *)(reg)))
+
+static inline uint64_t cxgbe_read_addr64(volatile void *addr)
+{
+	uint64_t val = CXGBE_PCI_REG(addr);
+	uint64_t val2 = CXGBE_PCI_REG(((volatile uint8_t *)(addr) + 4));
+
+	val2 = (uint64_t)(val2 << 32);
+	val += val2;
+	return val;
+}
+
+static inline uint32_t cxgbe_read_addr(volatile void *addr)
+{
+	return CXGBE_PCI_REG(addr);
+}
+
+#define CXGBE_PCI_REG_ADDR(adap, reg) \
+	((volatile uint32_t *)((char *)(adap)->regs + (reg)))
+
+#define CXGBE_READ_REG(adap, reg) \
+	cxgbe_read_addr(CXGBE_PCI_REG_ADDR((adap), (reg)))
+
+#define CXGBE_READ_REG64(adap, reg) \
+	cxgbe_read_addr64(CXGBE_PCI_REG_ADDR((adap), (reg)))
+
+#define CXGBE_PCI_REG_WRITE(reg, value) ({ \
+	CXGBE_PCI_REG((reg)) = (value); })
+
+#define CXGBE_WRITE_REG(adap, reg, value) \
+	CXGBE_PCI_REG_WRITE(CXGBE_PCI_REG_ADDR((adap), (reg)), (value))
+
+static inline uint64_t cxgbe_write_addr64(volatile void *addr, uint64_t val)
+{
+	CXGBE_PCI_REG(addr) = val;
+	CXGBE_PCI_REG(((volatile uint8_t *)(addr) + 4)) = (val >> 32);
+	return val;
+}
+
+#define CXGBE_WRITE_REG64(adap, reg, value) \
+	cxgbe_write_addr64(CXGBE_PCI_REG_ADDR((adap), (reg)), (value))
+
+/**
+ * t4_read_reg - read a HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ *
+ * Returns the 32-bit value of the given HW register.
+ */
+static inline u32 t4_read_reg(struct adapter *adapter, u32 reg_addr)
+{
+	u32 val = CXGBE_READ_REG(adapter, reg_addr);
+
+	CXGBE_DEBUG_REG(adapter, "read register 0x%x value 0x%x\n", reg_addr,
+			val);
+	return val;
+}
+
+/**
+ * t4_write_reg - write a HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ * @val: the value to write
+ *
+ * Write a 32-bit value into the given HW register.
+ */
+static inline void t4_write_reg(struct adapter *adapter, u32 reg_addr, u32 val)
+{
+	CXGBE_DEBUG_REG(adapter, "setting register 0x%x to 0x%x\n", reg_addr,
+			val);
+	CXGBE_WRITE_REG(adapter, reg_addr, val);
+}
+
+/**
+ * t4_read_reg64 - read a 64-bit HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ *
+ * Returns the 64-bit value of the given HW register.
+ */
+static inline u64 t4_read_reg64(struct adapter *adapter, u32 reg_addr)
+{
+	u64 val = CXGBE_READ_REG64(adapter, reg_addr);
+
+	CXGBE_DEBUG_REG(adapter, "64-bit read register %#x value %#llx\n",
+			reg_addr, (unsigned long long)val);
+	return val;
+}
+
+/**
+ * t4_write_reg64 - write a 64-bit HW register
+ * @adapter: the adapter
+ * @reg_addr: the register address
+ * @val: the value to write
+ *
+ * Write a 64-bit value into the given HW register.
+ */
+static inline void t4_write_reg64(struct adapter *adapter, u32 reg_addr,
+				  u64 val)
+{
+	CXGBE_DEBUG_REG(adapter, "setting register %#x to %#llx\n", reg_addr,
+			(unsigned long long)val);
+
+	CXGBE_WRITE_REG64(adapter, reg_addr, val);
+}
+
+/**
+ * t4_os_set_hw_addr - store a port's MAC address in SW
+ * @adapter: the adapter
+ * @port_idx: the port index
+ * @hw_addr: the Ethernet address
+ *
+ * Store the Ethernet address of the given port in SW.  Called by the
+ * common code when it retrieves a port's Ethernet address from EEPROM.
+ */
+static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx,
+				     u8 hw_addr[])
+{
+	struct port_info *pi = &adapter->port[port_idx];
+
+	ether_addr_copy((struct ether_addr *)hw_addr,
+			&pi->eth_dev->data->mac_addrs[0]);
+}
+
+/**
+ * t4_os_lock_init - initialize spinlock
+ * @lock: the spinlock
+ */
+static inline void t4_os_lock_init(rte_spinlock_t *lock)
+{
+	rte_spinlock_init(lock);
+}
+
+/**
+ * t4_os_lock - spin until lock is acquired
+ * @lock: the spinlock
+ */
+static inline void t4_os_lock(rte_spinlock_t *lock)
+{
+	rte_spinlock_lock(lock);
+}
+
+/**
+ * t4_os_unlock - unlock a spinlock
+ * @lock: the spinlock
+ */
+static inline void t4_os_unlock(rte_spinlock_t *lock)
+{
+	rte_spinlock_unlock(lock);
+}
+
+/**
+ * t4_os_init_list_head - initialize
+ * @head: head of list to initialize [to empty]
+ */
+static inline void t4_os_init_list_head(struct mbox_list *head)
+{
+	TAILQ_INIT(head);
+}
+
+static inline struct mbox_entry *t4_os_list_first_entry(struct mbox_list *head)
+{
+	return TAILQ_FIRST(head);
+}
+
+/**
+ * t4_os_atomic_add_tail - Enqueue list element atomically onto list
+ * @new: the entry to be addded to the queue
+ * @head: current head of the linked list
+ * @lock: lock to use to guarantee atomicity
+ */
+static inline void t4_os_atomic_add_tail(struct mbox_entry *entry,
+					 struct mbox_list *head,
+					 rte_spinlock_t *lock)
+{
+	t4_os_lock(lock);
+	TAILQ_INSERT_TAIL(head, entry, next);
+	t4_os_unlock(lock);
+}
+
+/**
+ * t4_os_atomic_list_del - Dequeue list element atomically from list
+ * @entry: the entry to be remove/dequeued from the list.
+ * @lock: the spinlock
+ */
+static inline void t4_os_atomic_list_del(struct mbox_entry *entry,
+					 struct mbox_list *head,
+					 rte_spinlock_t *lock)
+{
+	t4_os_lock(lock);
+	TAILQ_REMOVE(head, entry, next);
+	t4_os_unlock(lock);
+}
+
+/**
+ * adap2pinfo - return the port_info of a port
+ * @adap: the adapter
+ * @idx: the port index
+ *
+ * Return the port_info structure for the port of the given index.
+ */
+static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
+{
+	return &adap->port[idx];
+}
+
+void *t4_alloc_mem(size_t size);
+void t4_free_mem(void *addr);
+#define t4_os_alloc(_size)     t4_alloc_mem((_size))
+#define t4_os_free(_ptr)       t4_free_mem((_ptr))
+
+void t4_os_portmod_changed(const struct adapter *adap, int port_id);
+void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
+
+void reclaim_completed_tx(struct sge_txq *q);
+void t4_free_sge_resources(struct adapter *adap);
+void t4_sge_tx_monitor_start(struct adapter *adap);
+void t4_sge_tx_monitor_stop(struct adapter *adap);
+int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf);
+int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
+		     const struct pkt_gl *gl);
+int t4_sge_init(struct adapter *adap);
+int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
+			 struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			 unsigned int iqid, int socket_id);
+int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *rspq, bool fwevtq,
+		     struct rte_eth_dev *eth_dev, int intr_idx,
+		     struct sge_fl *fl, rspq_handler_t handler,
+		     int cong, struct rte_mempool *mp, int queue_id,
+		     int socket_id);
+int t4_sge_eth_txq_start(struct sge_eth_txq *txq);
+int t4_sge_eth_txq_stop(struct sge_eth_txq *txq);
+void t4_sge_eth_txq_release(struct adapter *adap, struct sge_eth_txq *txq);
+int t4_sge_eth_rxq_start(struct adapter *adap, struct sge_rspq *rq);
+int t4_sge_eth_rxq_stop(struct adapter *adap, struct sge_rspq *rq);
+void t4_sge_eth_rxq_release(struct adapter *adap, struct sge_eth_rxq *rxq);
+void t4_sge_eth_clear_queues(struct port_info *pi);
+int cxgb4_set_rspq_intr_params(struct sge_rspq *q, unsigned int us,
+			       unsigned int cnt);
+int cxgbe_poll(struct sge_rspq *q, struct rte_mbuf **rx_pkts,
+	       unsigned int budget, unsigned int *work_done);
+int cxgb4_write_rss(const struct port_info *pi, const u16 *queues);
+
+#endif /* __T4_ADAPTER_H__ */
drivers/net/cxgbe/base/common.h new file +401 -0

401 lines not on this page · raw message

drivers/net/cxgbe/base/t4_chip_type.h new file +79 -0

79 lines not on this page · raw message

drivers/net/cxgbe/base/t4_hw.c new file +2686 -0

1,955 lines not on this page · raw message

drivers/net/cxgbe/base/t4_hw.h new file +149 -0

149 lines not on this page · raw message

drivers/net/cxgbe/base/t4_msg.h new file +345 -0

345 lines not on this page · raw message

drivers/net/cxgbe/base/t4_pci_id_tbl.h new file +148 -0

148 lines not on this page · raw message

drivers/net/cxgbe/base/t4_regs.h new file +779 -0

779 lines not on this page · raw message

drivers/net/cxgbe/base/t4_regs_values.h new file +168 -0

168 lines not on this page · raw message

drivers/net/cxgbe/base/t4fw_interface.h new file +1730 -0

1,730 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.4.1

Part of the diff is not shown here. View the raw message.

#51 lore raw

PATCH v4 2/9 cxgbe: add cxgbe poll mode driver.

In reply to Rahul Lakkireddy

Adds cxgbe poll mode driver for DPDK under drivers/net/cxgbe directory. This patch:

1. Adds the Makefile to compile cxgbe pmd.
2. Registers and initializes the cxgbe pmd driver.

Enable cxgbe PMD for compilation and linking with changes to:
1. config/common_linuxapp to add macros for cxgbe pmd.
2. drivers/net/Makefile to add cxgbe pmd to the compile list.
3. mk/rte.app.mk to add cxgbe pmd to link.

Update MAINTAINERS file to claim responsibility for the cxgbe PMD.

---
v4:
- Moved cxgbe doc entry in MAINTAINERS from patch 2 to patch 9 for consistency.

v3:
- Merge patches 10 and 11 with this patch to enable compilation and update MAINTAINERS. Also, update commit log.
- Add rte_pmd_cxgbe_version.map and add EXPORT_MAP and LIBABIVER to cxgbe Makefile.
- Use RTE_DIM macro for calculating ARRAY_SIZE.

v2:
- Move files to new directory under drivers/net/cxgbe and update commit log.
- Move eth_dev_ops to separate patches.
- Update cxgbe Makefile to use relative rather than absolute path of pmd.
- Replace bitwise operations in fls() with gcc's __builtin_clz().
- Fix an issue in adap_init0_tweaks() related to rx_dma_offset.

 MAINTAINERS                                 |   4 +
 config/common_linuxapp                      |  10 +
 drivers/net/Makefile                        |   1 +
 drivers/net/cxgbe/Makefile                  |  78 +++
 drivers/net/cxgbe/cxgbe.h                   |  48 ++
 drivers/net/cxgbe/cxgbe_compat.h            | 266 +++++++++++
 drivers/net/cxgbe/cxgbe_ethdev.c            | 169 +++++++
 drivers/net/cxgbe/cxgbe_main.c              | 706 ++++++++++++++++++++++++++++
 drivers/net/cxgbe/rte_pmd_cxgbe_version.map |   4 +
 drivers/net/cxgbe/sge.c                     | 311 ++++++++++++
 mk/rte.app.mk                               |   1 +
 11 files changed, 1598 insertions(+)
 create mode 100644 drivers/net/cxgbe/Makefile
 create mode 100644 drivers/net/cxgbe/cxgbe.h
 create mode 100644 drivers/net/cxgbe/cxgbe_compat.h
 create mode 100644 drivers/net/cxgbe/cxgbe_ethdev.c
 create mode 100644 drivers/net/cxgbe/cxgbe_main.c
 create mode 100644 drivers/net/cxgbe/rte_pmd_cxgbe_version.map
 create mode 100644 drivers/net/cxgbe/sge.c
MAINTAINERS +4 -0
index 54f0973..ba99f4b 100644
@@ -210,6 +210,10 @@ Linux AF_PACKET
 M: John W. Linville <[email protected]>
 F: drivers/net/af_packet/
 
+Chelsio cxgbe
+M: Rahul Lakkireddy <[email protected]>
+F: drivers/net/cxgbe/
+
 Cisco enic
 F: drivers/net/enic/
 
config/common_linuxapp +10 -0
index aae22f4..5a16214 100644
@@ -213,6 +213,16 @@ CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8
 CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1
 
 #
+# Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD
+#
+CONFIG_RTE_LIBRTE_CXGBE_PMD=y
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n
+
+#
 # Compile burst-oriented Cisco ENIC PMD driver
 #
 CONFIG_RTE_LIBRTE_ENIC_PMD=y
drivers/net/Makefile +1 -0
index 1e6648a..644cacb 100644
@@ -33,6 +33,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += bonding
+DIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe
 DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000
 DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic
 DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
drivers/net/cxgbe/Makefile new file +78 -0

78 lines not on this page · raw message

drivers/net/cxgbe/cxgbe.h new file +48 -0

48 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_compat.h new file +266 -0

266 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_ethdev.c new file +169 -0

169 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c new file +706 -0

706 lines not on this page · raw message

drivers/net/cxgbe/rte_pmd_cxgbe_version.map new file +4 -0
new file mode 100644
index 0000000..bd8138a
@@ -0,0 +1,4 @@
+DPDK_2.1 {
+
+	local: *;
+};
drivers/net/cxgbe/sge.c new file +311 -0

311 lines not on this page · raw message

mk/rte.app.mk +1 -0
index 1a2043a..bba6ddc 100644
@@ -122,6 +122,7 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)    += -lrte_pmd_vmxnet3_uio
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD)     += -lrte_pmd_virtio
+_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD)      += -lrte_pmd_cxgbe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD)       += -lrte_pmd_enic
 _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)       += -lrte_pmd_i40e
 _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)      += -lrte_pmd_fm10k
Signature · 1 line
2.4.1
#52 lore raw

PATCH v4 3/9 cxgbe: add device configuration and RX support for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds RX support for the cxgbe poll mode driver. This patch:

1. Adds rx queue related eth_dev_ops.
2. Adds RSS support.
3. Adds dev_configure() and dev_infos_get() eth_dev_ops.
4. Adds rx_pkt_burst for receiving packets.

---
v4:
- Fix 32-bit compilation.

v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Cleanup some RX related macros and code.

 drivers/net/cxgbe/cxgbe.h        |   6 +
 drivers/net/cxgbe/cxgbe_ethdev.c | 183 ++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 350 +++++++++++++++
 drivers/net/cxgbe/sge.c          | 915 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 1454 insertions(+)
drivers/net/cxgbe/cxgbe.h +6 -0
index 44d48dc..90d1db0 100644
@@ -44,5 +44,11 @@
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
 int cxgbe_probe(struct adapter *adapter);
+void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
+	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
+int setup_sge_fwevtq(struct adapter *adapter);
+void cfg_queues(struct rte_eth_dev *eth_dev);
+int cfg_queue_count(struct rte_eth_dev *eth_dev);
+int setup_rss(struct port_info *pi);
 
 #endif /* _CXGBE_H_ */
drivers/net/cxgbe/cxgbe_ethdev.c +183 -0

196 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +350 -0

382 lines not on this page · raw message

drivers/net/cxgbe/sge.c +915 -0

927 lines not on this page · raw message

Signature · 1 line
2.4.1
#53 lore raw

PATCH v4 4/9 cxgbe: add TX support for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds TX support for the cxgbe poll mode driver. This patch:

1. Adds tx queue related eth_dev_ops.
2. Adds tx_pkt_burst for transmitting packets.

---
v4:
- Remove unused code to fix clang compilation.

v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Few bug fixes for tx path.

 drivers/net/cxgbe/cxgbe_ethdev.c | 133 ++++++
 drivers/net/cxgbe/cxgbe_main.c   |   1 +
 drivers/net/cxgbe/sge.c          | 957 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 1091 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +133 -0
index 1c69973..b6e17e4 100644
@@ -85,6 +85,39 @@
  */
 #include "t4_pci_id_tbl.h"
 
+static uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+				uint16_t nb_pkts)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)tx_queue;
+	uint16_t pkts_sent, pkts_remain;
+	uint16_t total_sent = 0;
+	int ret = 0;
+
+	CXGBE_DEBUG_TX(adapter, "%s: txq = %p; tx_pkts = %p; nb_pkts = %d\n",
+		       __func__, txq, tx_pkts, nb_pkts);
+
+	t4_os_lock(&txq->txq_lock);
+	/* free up desc from already completed tx */
+	reclaim_completed_tx(&txq->q);
+	while (total_sent < nb_pkts) {
+		pkts_remain = nb_pkts - total_sent;
+
+		for (pkts_sent = 0; pkts_sent < pkts_remain; pkts_sent++) {
+			ret = t4_eth_xmit(txq, tx_pkts[total_sent + pkts_sent]);
+			if (ret < 0)
+				break;
+		}
+		if (!pkts_sent)
+			break;
+		total_sent += pkts_sent;
+		/* reclaim as much as possible */
+		reclaim_completed_tx(&txq->q);
+	}
+
+	t4_os_unlock(&txq->txq_lock);
+	return total_sent;
+}
+
 static uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts)
 {
@@ -131,8 +164,11 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	device_info->reta_size = pi->rss_size;
 }
 
+static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
+				    uint16_t tx_queue_id);
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t tx_queue_id);
+static void cxgbe_dev_tx_queue_release(void *q);
 static void cxgbe_dev_rx_queue_release(void *q);
 
 static int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
@@ -157,6 +193,98 @@ static int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
+static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
+				    uint16_t tx_queue_id)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)
+				  (eth_dev->data->tx_queues[tx_queue_id]);
+
+	dev_debug(NULL, "%s: tx_queue_id = %d\n", __func__, tx_queue_id);
+
+	return t4_sge_eth_txq_start(txq);
+}
+
+static int cxgbe_dev_tx_queue_stop(struct rte_eth_dev *eth_dev,
+				   uint16_t tx_queue_id)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)
+				  (eth_dev->data->tx_queues[tx_queue_id]);
+
+	dev_debug(NULL, "%s: tx_queue_id = %d\n", __func__, tx_queue_id);
+
+	return t4_sge_eth_txq_stop(txq);
+}
+
+static int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
+				    uint16_t queue_idx,	uint16_t nb_desc,
+				    unsigned int socket_id,
+				    const struct rte_eth_txconf *tx_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct sge *s = &adapter->sge;
+	struct sge_eth_txq *txq = &s->ethtxq[pi->first_qset + queue_idx];
+	int err = 0;
+	unsigned int temp_nb_desc;
+
+	RTE_SET_USED(tx_conf);
+
+	dev_debug(adapter, "%s: eth_dev->data->nb_tx_queues = %d; queue_idx = %d; nb_desc = %d; socket_id = %d; pi->first_qset = %u\n",
+		  __func__, eth_dev->data->nb_tx_queues, queue_idx, nb_desc,
+		  socket_id, pi->first_qset);
+
+	/*  Free up the existing queue  */
+	if (eth_dev->data->tx_queues[queue_idx]) {
+		cxgbe_dev_tx_queue_release(eth_dev->data->tx_queues[queue_idx]);
+		eth_dev->data->tx_queues[queue_idx] = NULL;
+	}
+
+	eth_dev->data->tx_queues[queue_idx] = (void *)txq;
+
+	/* Sanity Checking
+	 *
+	 * nb_desc should be > 1023 and <= CXGBE_MAX_RING_DESC_SIZE
+	 */
+	temp_nb_desc = nb_desc;
+	if (nb_desc < CXGBE_MIN_RING_DESC_SIZE) {
+		dev_warn(adapter, "%s: number of descriptors must be >= %d. Using default [%d]\n",
+			 __func__, CXGBE_MIN_RING_DESC_SIZE,
+			 CXGBE_DEFAULT_TX_DESC_SIZE);
+		temp_nb_desc = CXGBE_DEFAULT_TX_DESC_SIZE;
+	} else if (nb_desc > CXGBE_MAX_RING_DESC_SIZE) {
+		dev_err(adapter, "%s: number of descriptors must be between %d and %d inclusive. Default [%d]\n",
+			__func__, CXGBE_MIN_RING_DESC_SIZE,
+			CXGBE_MAX_RING_DESC_SIZE, CXGBE_DEFAULT_TX_DESC_SIZE);
+		return -(EINVAL);
+	}
+
+	txq->q.size = temp_nb_desc;
+
+	err = t4_sge_alloc_eth_txq(adapter, txq, eth_dev, queue_idx,
+				   s->fw_evtq.cntxt_id, socket_id);
+
+	dev_debug(adapter, "%s: txq->q.cntxt_id= %d err = %d\n",
+		  __func__, txq->q.cntxt_id, err);
+
+	return err;
+}
+
+static void cxgbe_dev_tx_queue_release(void *q)
+{
+	struct sge_eth_txq *txq = (struct sge_eth_txq *)q;
+
+	if (txq) {
+		struct port_info *pi = (struct port_info *)
+				       (txq->eth_dev->data->dev_private);
+		struct adapter *adap = pi->adapter;
+
+		dev_debug(adapter, "%s: pi->port_id = %d; tx_queue_id = %d\n",
+			  __func__, pi->port_id, txq->q.cntxt_id);
+
+		t4_sge_eth_txq_release(adap, txq);
+	}
+}
+
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t rx_queue_id)
 {
@@ -264,6 +392,10 @@ static void cxgbe_dev_rx_queue_release(void *q)
 static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_configure		= cxgbe_dev_configure,
 	.dev_infos_get		= cxgbe_dev_info_get,
+	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
+	.tx_queue_start		= cxgbe_dev_tx_queue_start,
+	.tx_queue_stop		= cxgbe_dev_tx_queue_stop,
+	.tx_queue_release	= cxgbe_dev_tx_queue_release,
 	.rx_queue_setup         = cxgbe_dev_rx_queue_setup,
 	.rx_queue_start		= cxgbe_dev_rx_queue_start,
 	.rx_queue_stop		= cxgbe_dev_rx_queue_stop,
@@ -286,6 +418,7 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)
 
 	eth_dev->dev_ops = &cxgbe_eth_dev_ops;
 	eth_dev->rx_pkt_burst = &cxgbe_recv_pkts;
+	eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts;
 
 	/* for secondary processes, we don't initialise any further as primary
 	 * has already done this work.
drivers/net/cxgbe/cxgbe_main.c +1 -0
index abcef6b..3029b57 100644
@@ -1005,6 +1005,7 @@ allocate_mac:
 		pi->eth_dev->data->dev_private = pi;
 		pi->eth_dev->driver = adapter->eth_dev->driver;
 		pi->eth_dev->dev_ops = adapter->eth_dev->dev_ops;
+		pi->eth_dev->tx_pkt_burst = adapter->eth_dev->tx_pkt_burst;
 		pi->eth_dev->rx_pkt_burst = adapter->eth_dev->rx_pkt_burst;
 		TAILQ_INIT(&pi->eth_dev->link_intr_cbs);
 
drivers/net/cxgbe/sge.c +957 -0

993 lines not on this page · raw message

Signature · 1 line
2.4.1
#54 lore raw

PATCH v4 5/9 cxgbe: add device related operations for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds dev_start(), dev_stop(), and dev_close() eth_dev_ops for cxgbe poll mode driver.

---
v4:
- No changes.

v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Few changes related to tx bug fixes.

 drivers/net/cxgbe/cxgbe.h        |   4 ++
 drivers/net/cxgbe/cxgbe_ethdev.c | 114 ++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 139 +++++++++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/sge.c          |  58 ++++++++++++++++
 4 files changed, 315 insertions(+)
drivers/net/cxgbe/cxgbe.h +4 -0
index 90d1db0..bf08baf 100644
@@ -44,6 +44,10 @@
 #define CXGBE_DEFAULT_RX_DESC_SIZE    1024 /* Default RX ring size */
 
 int cxgbe_probe(struct adapter *adapter);
+int cxgbe_up(struct adapter *adap);
+int cxgbe_down(struct port_info *pi);
+void cxgbe_close(struct adapter *adapter);
+int link_start(struct port_info *pi);
 void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
 	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
 int setup_sge_fwevtq(struct adapter *adapter);
drivers/net/cxgbe/cxgbe_ethdev.c +114 -0

126 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +139 -0

151 lines not on this page · raw message

drivers/net/cxgbe/sge.c +58 -0

70 lines not on this page · raw message

Signature · 1 line
2.4.1
#55 lore raw

PATCH v4 6/9 cxgbe: add port statistics for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds stats_get() and stats_reset() eth_dev_ops for cxgbe poll mode driver.

---
v4:
- No changes.

v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.

 drivers/net/cxgbe/cxgbe.h        |  2 +
 drivers/net/cxgbe/cxgbe_ethdev.c | 83 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/cxgbe_main.c   | 11 ++++++
 3 files changed, 96 insertions(+)
drivers/net/cxgbe/cxgbe.h +2 -0
index bf08baf..97c37d2 100644
@@ -47,6 +47,8 @@ int cxgbe_probe(struct adapter *adapter);
 int cxgbe_up(struct adapter *adap);
 int cxgbe_down(struct port_info *pi);
 void cxgbe_close(struct adapter *adapter);
+void cxgbe_stats_get(struct port_info *pi, struct port_stats *stats);
+void cxgbe_stats_reset(struct port_info *pi);
 int link_start(struct port_info *pi);
 void init_rspq(struct adapter *adap, struct sge_rspq *q, unsigned int us,
 	       unsigned int cnt, unsigned int size, unsigned int iqe_size);
drivers/net/cxgbe/cxgbe_ethdev.c +83 -0

95 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +11 -0
index 7995d3c..dad0a98 100644
@@ -310,6 +310,17 @@ void cfg_queues(struct rte_eth_dev *eth_dev)
 	}
 }
 
+void cxgbe_stats_get(struct port_info *pi, struct port_stats *stats)
+{
+	t4_get_port_stats_offset(pi->adapter, pi->tx_chan, stats,
+				 &pi->stats_base);
+}
+
+void cxgbe_stats_reset(struct port_info *pi)
+{
+	t4_clr_port_stats(pi->adapter, pi->tx_chan);
+}
+
 static void setup_memwin(struct adapter *adap)
 {
 	u32 mem_win0_base;
Signature · 1 line
2.4.1
#56 lore raw

PATCH v4 7/9 cxgbe: add link related functions for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds link update, promiscuous and multicast related eth_dev_ops for cxgbe poll mode driver.

---
v4:
- No changes.

v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.
- Update cxgbe_dev_link_update() to return correct value.

 drivers/net/cxgbe/cxgbe_ethdev.c | 66 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +66 -0
index 600a16c..c0dd5f3 100644
@@ -164,6 +164,67 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	device_info->reta_size = pi->rss_size;
 }
 
+static void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      1, -1, 1, -1, false);
+}
+
+static void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      0, -1, 1, -1, false);
+}
+
+static void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	/* TODO: address filters ?? */
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      -1, 1, 1, -1, false);
+}
+
+static void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+
+	/* TODO: address filters ?? */
+
+	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+		      -1, 0, 1, -1, false);
+}
+
+static int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
+				 __rte_unused int wait_to_complete)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct sge *s = &adapter->sge;
+	struct rte_eth_link *old_link = &eth_dev->data->dev_link;
+	unsigned int work_done, budget = 4;
+
+	cxgbe_poll(&s->fw_evtq, NULL, budget, &work_done);
+	if (old_link->link_status == pi->link_cfg.link_ok)
+		return -1;  /* link not changed */
+
+	eth_dev->data->dev_link.link_status = pi->link_cfg.link_ok;
+	eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	eth_dev->data->dev_link.link_speed = pi->link_cfg.speed;
+
+	/* link has changed */
+	return 0;
+}
+
 static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
 				    uint16_t tx_queue_id);
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
@@ -585,8 +646,13 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_start		= cxgbe_dev_start,
 	.dev_stop		= cxgbe_dev_stop,
 	.dev_close		= cxgbe_dev_close,
+	.promiscuous_enable	= cxgbe_dev_promiscuous_enable,
+	.promiscuous_disable	= cxgbe_dev_promiscuous_disable,
+	.allmulticast_enable	= cxgbe_dev_allmulticast_enable,
+	.allmulticast_disable	= cxgbe_dev_allmulticast_disable,
 	.dev_configure		= cxgbe_dev_configure,
 	.dev_infos_get		= cxgbe_dev_info_get,
+	.link_update		= cxgbe_dev_link_update,
 	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
 	.tx_queue_start		= cxgbe_dev_tx_queue_start,
 	.tx_queue_stop		= cxgbe_dev_tx_queue_stop,
Signature · 1 line
2.4.1
#57 lore raw

PATCH v4 8/9 cxgbe: add flow control functions for cxgbe PMD.

In reply to Rahul Lakkireddy

Adds flow control related eth_dev_ops for cxgbe poll mode driver.

---
v4:
- No changes.

v3:
- No changes.

v2:
- This patch is a subset of patch 2/5 submitted in v1.

 drivers/net/cxgbe/cxgbe_ethdev.c | 54 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
drivers/net/cxgbe/cxgbe_ethdev.c +54 -0
index c0dd5f3..478051a 100644
@@ -642,6 +642,58 @@ static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
 	}
 }
 
+static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_fc_conf *fc_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct link_config *lc = &pi->link_cfg;
+	int rx_pause, tx_pause;
+
+	fc_conf->autoneg = lc->fc & PAUSE_AUTONEG;
+	rx_pause = lc->fc & PAUSE_RX;
+	tx_pause = lc->fc & PAUSE_TX;
+
+	if (rx_pause && tx_pause)
+		fc_conf->mode = RTE_FC_FULL;
+	else if (rx_pause)
+		fc_conf->mode = RTE_FC_RX_PAUSE;
+	else if (tx_pause)
+		fc_conf->mode = RTE_FC_TX_PAUSE;
+	else
+		fc_conf->mode = RTE_FC_NONE;
+	return 0;
+}
+
+static int cxgbe_flow_ctrl_set(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_fc_conf *fc_conf)
+{
+	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct adapter *adapter = pi->adapter;
+	struct link_config *lc = &pi->link_cfg;
+
+	if (lc->supported & FW_PORT_CAP_ANEG) {
+		if (fc_conf->autoneg)
+			lc->requested_fc |= PAUSE_AUTONEG;
+		else
+			lc->requested_fc &= ~PAUSE_AUTONEG;
+	}
+
+	if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
+	    (fc_conf->mode & RTE_FC_RX_PAUSE))
+		lc->requested_fc |= PAUSE_RX;
+	else
+		lc->requested_fc &= ~PAUSE_RX;
+
+	if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
+	    (fc_conf->mode & RTE_FC_TX_PAUSE))
+		lc->requested_fc |= PAUSE_TX;
+	else
+		lc->requested_fc &= ~PAUSE_TX;
+
+	return t4_link_l1cfg(adapter, adapter->mbox, pi->tx_chan,
+			     &pi->link_cfg);
+}
+
 static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.dev_start		= cxgbe_dev_start,
 	.dev_stop		= cxgbe_dev_stop,
@@ -663,6 +715,8 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = {
 	.rx_queue_release	= cxgbe_dev_rx_queue_release,
 	.stats_get		= cxgbe_dev_stats_get,
 	.stats_reset		= cxgbe_dev_stats_reset,
+	.flow_ctrl_get		= cxgbe_flow_ctrl_get,
+	.flow_ctrl_set		= cxgbe_flow_ctrl_set,
 };
 
 /*
Signature · 1 line
2.4.1
#58 lore raw

PATCH v4 9/9 doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

In reply to Rahul Lakkireddy

Adds cxgbe poll mode driver documentation under the usual doc/guides/nics/ directory with the rest of the drivers. The documentation covers cxgbe implementation details, features and limitations, prerequisites, configuration, and a sample application usage.

---
v4:
- Add cxgbe doc entry to MAINTAINERS.

v3:
- No changes.

v2:
- Move cxgbe entry to Drivers section in source_org.rst.
- Order the cxgbe entry alphabetically in index.rst.

 MAINTAINERS                          |   1 +
 doc/guides/nics/cxgbe.rst            | 209 +++++++++++++++++++++++++++++++++++
 doc/guides/nics/index.rst            |   1 +
 doc/guides/prog_guide/source_org.rst |   1 +
 4 files changed, 212 insertions(+)
 create mode 100644 doc/guides/nics/cxgbe.rst
MAINTAINERS +1 -0
index ba99f4b..659672e 100644
@@ -213,6 +213,7 @@ F: drivers/net/af_packet/
 Chelsio cxgbe
 M: Rahul Lakkireddy <[email protected]>
 F: drivers/net/cxgbe/
+F: doc/guides/nics/cxgbe.rst
 
 Cisco enic
 F: drivers/net/enic/
doc/guides/nics/cxgbe.rst new file +209 -0

209 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index 1ee67fa..d1a92f8 100644
@@ -40,6 +40,7 @@ Network Interface Controller Drivers
     :maxdepth: 3
     :numbered:
 
+    cxgbe
     e1000em
     ixgbe
     intel_vf
doc/guides/prog_guide/source_org.rst +1 -0
index 4f6f489..bfdaa8a 100644
@@ -97,6 +97,7 @@ The drivers directory has a net subdirectory which contains::
     drivers/net
     +-- af_packet          # poll mode driver based on linux af_packet
     +-- bonding            # bonding poll mode driver
+    +-- cxgbe              # Chelsio Terminator 10GbE/40GbE poll mode driver
     +-- e1000              # 1GbE poll mode drivers (igb and em)
     +-- enic               # Cisco VIC Ethernet NIC Poll-mode Driver
     +-- fm10k              # Host interface PMD driver for FM10000 Series
Signature · 1 line
2.4.1
#59 lore raw
In reply to Rahul Lakkireddy

2015-06-30 04:58, Rahul Lakkireddy:

Quoted 32 lines

This series of patches add the CXGBE Poll Mode Driver support for Chelsio Terminator 5 series of 10G/40G adapters. The CXGBE PMD is split into multiple patches. The first patch adds the hardware specific api for all supported Chelsio T5 adapters and the patches from 2 to 8 add the actual DPDK CXGBE PMD.

Also, the CXGBE PMD is enabled for compilation and linking by patch 2. MAINTAINERS file is also updated by patch 2 to claim responsibility for the CXGBE PMD.

More information on the CXGBE PMD can be found in the documentation added by patch 9.

v4:
- Fix 32-bit and clang compilation.
- Moved cxgbe doc entry in MAINTAINERS from patch 2 to patch 9 for consistency.

v3:
- Merge patches 10 and 11 with patch 2.
- Add rte_pmd_cxgbe_version.map and add EXPORT_MAP and LIBABIVER to cxgbe Makefile.
- Use RTE_DIM macro for calculating ARRAY_SIZE.

v2:
- Move the driver to drivers/net directory and update all config files and commit logs. Also update MAINTAINERS.
- Break the second patch into more patches; incrementally, adding features to the cxgbe poll mode driver.
- Replace bitwise operations in finding last (most significant) bit set with gcc's __builtin_clz.
- Fix the return value returned by link update eth_dev operation.
- Few bug fixes and code cleanup.

Quoted 11 lines

Rahul Lakkireddy (9):
cxgbe: add hardware specific api for all supported Chelsio T5 series
adapters.
cxgbe: add cxgbe poll mode driver.
cxgbe: add device configuration and RX support for cxgbe PMD.
cxgbe: add TX support for cxgbe PMD.
cxgbe: add device related operations for cxgbe PMD.
cxgbe: add port statistics for cxgbe PMD.
cxgbe: add link related functions for cxgbe PMD.
cxgbe: add flow control functions for cxgbe PMD.
doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

Applied, thanks for the good work and welcome :)

#60 lore raw
Quoted 45 lines · Thomas Monjalon

2015-06-30 04:58, Rahul Lakkireddy:

Quoted 32 lines

This series of patches add the CXGBE Poll Mode Driver support for Chelsio Terminator 5 series of 10G/40G adapters. The CXGBE PMD is split into multiple patches. The first patch adds the hardware specific api for all supported Chelsio T5 adapters and the patches from 2 to 8 add the actual DPDK CXGBE PMD.

Also, the CXGBE PMD is enabled for compilation and linking by patch 2. MAINTAINERS file is also updated by patch 2 to claim responsibility for the CXGBE PMD.

More information on the CXGBE PMD can be found in the documentation added by patch 9.

v4:
- Fix 32-bit and clang compilation.
- Moved cxgbe doc entry in MAINTAINERS from patch 2 to patch 9 for consistency.

v3:
- Merge patches 10 and 11 with patch 2.
- Add rte_pmd_cxgbe_version.map and add EXPORT_MAP and LIBABIVER to cxgbe Makefile.
- Use RTE_DIM macro for calculating ARRAY_SIZE.

v2:
- Move the driver to drivers/net directory and update all config files and commit logs. Also update MAINTAINERS.
- Break the second patch into more patches; incrementally, adding features to the cxgbe poll mode driver.
- Replace bitwise operations in finding last (most significant) bit set with gcc's __builtin_clz.
- Fix the return value returned by link update eth_dev operation.
- Few bug fixes and code cleanup.

Quoted 11 lines

Rahul Lakkireddy (9):
cxgbe: add hardware specific api for all supported Chelsio T5 series
adapters.
cxgbe: add cxgbe poll mode driver.
cxgbe: add device configuration and RX support for cxgbe PMD.
cxgbe: add TX support for cxgbe PMD.
cxgbe: add device related operations for cxgbe PMD.
cxgbe: add port statistics for cxgbe PMD.
cxgbe: add link related functions for cxgbe PMD.
cxgbe: add flow control functions for cxgbe PMD.
doc: add cxgbe PMD documentation under doc/guides/nics/cxgbe.rst

Quoted 1 line

Applied, thanks for the good work and welcome :)

Thank you very much. We are very glad to be on board.

Thanks,
Rahul