octeontx2-vf: Add network driver for virtual function
cover octeontx2-vf: Add network driver for virtual function
From: Sunil Goutham <[email protected]>
This patch series adds network driver for the virtual functions of OcteonTX2 SOC's resource virtualization unit (RVU).
Geetha sowjanya (2):
octeontx2-pf: Handle VF function level reset
octeontx2-pf: Cleanup all receive buffers in SG descriptor
Sunil Goutham (1):
octeontx2-pf: Enable SRIOV and added VF mbox handling
Tomasz Duszynski (3):
octeontx2-vf: Virtual function driver dupport
octeontx2-vf: Ethtool support
octeontx2-vf: Link event notification support
drivers/net/ethernet/marvell/octeontx2/Kconfig | 6 + .../net/ethernet/marvell/octeontx2/nic/Makefile | 2 + .../ethernet/marvell/octeontx2/nic/otx2_common.c | 23 +- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 27 + .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 131 +++- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 771 +++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_reg.h | 13 + .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 35 +- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 674 ++++++++++++++++++ 9 files changed, 1671 insertions(+), 11 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
Signature · 1 line
2.7.4
PATCH 1/6 octeontx2-pf: Enable SRIOV and added VF mbox handling
From: Sunil Goutham <[email protected]>
Added 'sriov_configure' to enable/disable virtual functions (VFs). Also added handling of mailbox messages from these VFs.
Admin function (AF) is the only one with all priviliges to configure HW, alloc resources etc etc, PFs and it's VFs have to request AF via mbox for all their needs. But unlike PFs, their VFs cannot send a mbox request directly. A VF shares a mailbox region with it's parent PF, so VF sends a mailbox msg to PF and then PF forwards it to AF. Then AF after processing sends response to PF which it again forwards to VF.
This patch adds support for this 'VF <=> PF <=> AF' mailbox communication.
--- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 3 + .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 446 +++++++++++++++++++++ 2 files changed, 449 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +3 -0
@@ -215,8 +215,11 @@ struct otx2_nic {/* Mbox */ struct mbox mbox; +struct mbox *mbox_pfvf;struct workqueue_struct *mbox_wq; +struct workqueue_struct *mbox_pfvf_wq; +u8 total_vfs;u16 pcifunc;/* RVU PF_FUNC */ u16 bpid[NIX_MAX_BPID_CHAN ];struct cgx_link_user_info linfo;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +446 -0
482 lines not on this page · raw message
Signature · 1 line
2.7.4
Jakub Kicinski
maintainerRe: [PATCH net-next 1/6] octeontx2-pf: Enable SRIOV and added VF mbox handling
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 1711
Quoted 12 lines · On Wed, 11 Mar 2020 00:17:20 +0530 [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +8
-0@@ -1313,6 +1701,61 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)return err; } +static int otx2_sriov_enable (struct pci_dev *pdev,int numvfs) +{ +struct net_device *netdev =pci_get_drvdata (pdev); +struct otx2_nic *pf =netdev_priv (netdev); +int ret; + +if (numvfs > pf->total_vfs) + numvfs = pf->total_vfs;
Core should do this kind of checking for you, please remove.
PATCH 2/6 octeontx2-pf: Handle VF function level reset
In reply to [email protected]From: Geetha sowjanya <[email protected]>
When FLR is initiated for a VF (PCI function level reset), the parent PF gets a interrupt. PF then sends a message to admin function (AF), which then cleanups all resources attached to that VF.
Also handled IRQs triggered when master enable bit is cleared or set for VFs. This handler just clears the transaction pending ie TRPEND bit.
--- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 7 + .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 233 ++++++++++++++++++++- 2 files changed, 239 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +7 -0
@@ -191,6 +191,11 @@ struct otx2_hw {u64 cgx_tx_stats[CGX_TX_STATS_COUNT ]; }; +struct flr_work { +struct work_struct work; +struct otx2_nic *pf; +}; +struct refill_work {struct delayed_work pool_refill_work;struct otx2_nic *pf;
@@ -226,6 +231,8 @@ struct otx2_nic {u64 reset_count;struct work_struct reset_task; +struct workqueue_struct *flr_wq; +struct flr_work *flr_wrk;struct refill_work *refill_wrk;/* Ethtool stuff */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +232 -1
255 lines not on this page · raw message
Signature · 1 line
2.7.4
Jakub Kicinski
maintainerRe: [PATCH net-next 2/6] octeontx2-pf: Handle VF function level reset
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c static int otx2_change_mtu(struct net_device *netdev, int new_mtu) · line 262
Quoted 6 lines · On Wed, 11 Mar 2020 00:17:21 +0530 [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +6
-0+static int otx2_pf_flr_init (struct otx2_nic *pf,int num_vfs) +{ +int vf; + + pf->flr_wq =alloc_workqueue ("otx2_pf_flr_wq" ,WQ_UNBOUND |WQ_HIGHPRI + |WQ_MEM_RECLAIM ,1 );
Are you sure WQ_MEM_RECLAIM is necessary? AFAIU sending FLRs is not part of memory reclaim, and therefore this flag isn't needed?
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c static int otx2_change_mtu(struct net_device *netdev, int new_mtu) · line 267
Quoted 5 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +5
-0+if (!pf->flr_wq) +return -ENOMEM ; + + pf->flr_wrk =devm_kcalloc (pf->dev, num_vfs, +sizeof (struct flr_work ),GFP_KERNEL );
Since SR-IOV can be enabled and disabled multiple times you should free this memory explicitly when it's disabled. Otherwise the driver will hold onto it until remove.
Quoted 12 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +12
-0+if (!pf->flr_wrk) { +destroy_workqueue (pf->flr_wq); +return -ENOMEM ; + } + +for (vf =0 ; vf < num_vfs; vf++) { + pf->flr_wrk[vf].pf = pf; +INIT_WORK (&pf->flr_wrk[vf].work, otx2_flr_handler); + } + +return 0 ; +}
PATCH 3/6 octeontx2-vf: Virtual function driver dupport
In reply to [email protected]From: Tomasz Duszynski <[email protected]>
On OcteonTx2 silicon there two two types VFs, VFs that share the physical link with their parent SR-IOV PF and the VFs which work in pairs using internal HW loopback channels (LBK). Except for the underlying Rx/Tx channel mapping from netdev functionality perspective they are almost identical. This patch adds netdev driver support for these VFs.
Unlike it's parent PF a VF cannot directly communicate with admin function (AF) and it has to go through PF for the same. The mailbox communication with AF works like 'VF <=> PF <=> AF'.
Also functionality wise VF and PF are identical, hence to avoid code duplication PF driver's APIs are resued here for HW initialization, packet handling etc etc ie almost everything. For VF driver to compile as module exported few of the existing PF driver APIs.
--- drivers/net/ethernet/marvell/octeontx2/Kconfig | 6 + .../net/ethernet/marvell/octeontx2/nic/Makefile | 2 + .../ethernet/marvell/octeontx2/nic/otx2_common.c | 14 + .../ethernet/marvell/octeontx2/nic/otx2_common.h | 9 + .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 10 + .../net/ethernet/marvell/octeontx2/nic/otx2_reg.h | 13 + .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 1 + .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 670 +++++++++++++++++++++ 8 files changed, 725 insertions(+) create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
drivers/net/ethernet/marvell/octeontx2/Kconfig +6 -0
@@ -33,3 +33,9 @@ config OCTEONTX2_PF depends on PCI help This driver supports Marvell's OcteonTX2 NIC physical function. + +config OCTEONTX2_VF + tristate "Marvell OcteonTX2 NIC Virtual Function driver" + depends on OCTEONTX2_PF + help + This driver supports Marvell's OcteonTX2 NIC virtual function.
drivers/net/ethernet/marvell/octeontx2/nic/Makefile +2 -0
@@ -4,7 +4,9 @@ # obj-$(CONFIG_OCTEONTX2_PF) += octeontx2_nicpf.o +obj-$(CONFIG_OCTEONTX2_VF) += octeontx2_nicvf.o octeontx2_nicpf-y := otx2_pf.o otx2_common.o otx2_txrx.o otx2_ethtool.o +octeontx2_nicvf-y := otx2_vf.o ccflags-y += -I$(srctree)/drivers/net/ethernet/marvell/octeontx2/af
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +14 -0
@@ -128,6 +128,7 @@ void otx2_get_stats64(struct net_device *netdev, stats->tx_packets = dev_stats->tx_frames; stats->tx_dropped = dev_stats->tx_drops; } +EXPORT_SYMBOL (otx2_get_stats64);/* Sync MAC address with RVU AF */ static int otx2_hw_set_mac_addr (struct otx2_nic *pfvf,u8 *mac)
@@ -197,6 +198,7 @@ int otx2_set_mac_address(struct net_device *netdev, void *p)return 0 ; } +EXPORT_SYMBOL (otx2_set_mac_address);int otx2_hw_set_mtu (struct otx2_nic *pfvf,int mtu) {
@@ -225,6 +227,9 @@ int otx2_config_pause_frm(struct otx2_nic *pfvf)struct cgx_pause_frm_cfg *req;int err; +if (is_otx2_lbkvf (pfvf->pdev)) +return 0 ; +otx2_mbox_lock (&pfvf->mbox); req =otx2_mbox_alloc_msg_cgx_cfg_pause_frm (&pfvf->mbox);if (!req)
@@ -413,6 +418,7 @@ void otx2_tx_timeout(struct net_device *netdev, unsigned int txq)schedule_work (&pfvf->reset_task); } +EXPORT_SYMBOL (otx2_tx_timeout);void otx2_get_mac_from_af (struct net_device *netdev) {
@@ -427,6 +433,7 @@ void otx2_get_mac_from_af(struct net_device *netdev)if (!is_valid_ether_addr (netdev->dev_addr))eth_hw_addr_random (netdev); } +EXPORT_SYMBOL (otx2_get_mac_from_af);static int otx2_get_link (struct otx2_nic *pfvf) {
@@ -1260,6 +1267,7 @@ int otx2_detach_resources(struct mbox *mbox)otx2_mbox_unlock (mbox);return 0 ; } +EXPORT_SYMBOL (otx2_detach_resources);int otx2_attach_npa_nix (struct otx2_nic *pfvf) {
@@ -1316,6 +1324,7 @@ int otx2_attach_npa_nix(struct otx2_nic *pfvf)return 0 ; } +EXPORT_SYMBOL (otx2_attach_npa_nix);void otx2_ctx_disable (struct mbox *mbox,int type,bool npa) {
@@ -1384,6 +1393,7 @@ void mbox_handler_nix_txsch_alloc(struct otx2_nic *pf, pf->hw.txschq_list[lvl][schq] = rsp->schq_list[lvl][schq]; } +EXPORT_SYMBOL (mbox_handler_nix_txsch_alloc);void mbox_handler_npa_lf_alloc (struct otx2_nic *pfvf,struct npa_lf_alloc_rsp *rsp)
@@ -1391,6 +1401,7 @@ void mbox_handler_npa_lf_alloc(struct otx2_nic *pfvf, pfvf->hw.stack_pg_ptrs = rsp->stack_pg_ptrs; pfvf->hw.stack_pg_bytes = rsp->stack_pg_bytes; } +EXPORT_SYMBOL (mbox_handler_npa_lf_alloc);void mbox_handler_nix_lf_alloc (struct otx2_nic *pfvf,struct nix_lf_alloc_rsp *rsp)
@@ -1401,6 +1412,7 @@ void mbox_handler_nix_lf_alloc(struct otx2_nic *pfvf, pfvf->hw.lso_tsov4_idx = rsp->lso_tsov4_idx; pfvf->hw.lso_tsov6_idx = rsp->lso_tsov6_idx; } +EXPORT_SYMBOL (mbox_handler_nix_lf_alloc);void mbox_handler_msix_offset (struct otx2_nic *pfvf,struct msix_offset_rsp *rsp)
@@ -1408,6 +1420,7 @@ void mbox_handler_msix_offset(struct otx2_nic *pfvf, pfvf->hw.npa_msixoff = rsp->npa_msixoff; pfvf->hw.nix_msixoff = rsp->nix_msixoff; } +EXPORT_SYMBOL (mbox_handler_msix_offset);void mbox_handler_nix_bp_enable (struct otx2_nic *pfvf,struct nix_bp_cfg_rsp *rsp)
@@ -1419,6 +1432,7 @@ void mbox_handler_nix_bp_enable(struct otx2_nic *pfvf, pfvf->bpid[chan_id] = rsp->chan_bpid[chan] &0x3FF ; } } +EXPORT_SYMBOL (mbox_handler_nix_bp_enable);void otx2_free_cints (struct otx2_nic *pfvf,int n) {
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +9 -0
@@ -20,6 +20,8 @@/* PCI device IDs */ #define PCI_DEVID_OCTEONTX2_RVU_PF 0xA063 +#define PCI_DEVID_OCTEONTX2_RVU_VF 0xA064 +#define PCI_DEVID_OCTEONTX2_RVU_AFVF 0xA0F8#define PCI_SUBSYS_DEVID_96XX_RVU_PFVF 0xB200
@@ -242,6 +244,11 @@ struct otx2_nic {int nix_blkaddr; }; +static inline bool is_otx2_lbkvf (struct pci_dev *pdev) +{ +return pdev->device ==PCI_DEVID_OCTEONTX2_RVU_AFVF ; +} +static inline bool is_96xx_A0 (struct pci_dev *pdev) { return (pdev->revision == 0x00) &&
@@ -627,6 +634,8 @@ void otx2_set_ethtool_ops(struct net_device *netdev);int otx2_open (struct net_device *netdev);int otx2_stop (struct net_device *netdev); +int otx2vf_open (struct net_device *netdev); +int otx2vf_stop (struct net_device *netdev);int otx2_set_real_num_queues (struct net_device *netdev,int tx_queues,int rx_queues);#endif /* OTX2_COMMON_H */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +10 -0
@@ -1087,6 +1087,7 @@ int otx2_set_real_num_queues(struct net_device *netdev, "Failed to set no of Rx queues: %d\n", rx_queues);return err; } +EXPORT_SYMBOL (otx2_set_real_num_queues);static irqreturn_t otx2_q_intr_handler (int irq,void *data) {
@@ -1522,6 +1523,9 @@ int otx2_open(struct net_device *netdev)if (pf->linfo.link_up && !(pf->pcifunc &RVU_PFVF_FUNC_MASK ))otx2_handle_link_event (pf); +/* Restore pause frame settings */ +otx2_config_pause_frm (pf); + err =otx2_rxtx_enable (pf, true);if (err) goto err_free_cints;
@@ -1545,6 +1549,7 @@ int otx2_open(struct net_device *netdev)kfree (qset->napi);return err; } +EXPORT_SYMBOL (otx2_open);int otx2_stop (struct net_device *netdev) {
@@ -1605,6 +1610,7 @@ int otx2_stop(struct net_device *netdev) sizeof(*qset) - offsetof(struct otx2_qset, sqe_cnt));return 0 ; } +EXPORT_SYMBOL (otx2_stop);static netdev_tx_t otx2_xmit (struct sk_buff *skb,struct net_device *netdev) {
@@ -1900,6 +1906,10 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)/* Enable link notifications */ otx2_cgx_config_linkevents (pf, true); +/* Enable pause frames by default */ + pf->flags |=OTX2_FLAG_RX_PAUSE_ENABLED ; + pf->flags |=OTX2_FLAG_TX_PAUSE_ENABLED ; +return 0 ; err_detach_rsrc:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h +13 -0
@@ -45,6 +45,19 @@#define RVU_PF_MSIX_VECX_CTL (a) (0x008 | (a) << 4)#define RVU_PF_MSIX_PBAX (a) (0xF0000 | (a) << 3) +/* RVU VF registers */ +#define RVU_VF_VFPF_MBOX0 (0x00000) +#define RVU_VF_VFPF_MBOX1 (0x00008) +#define RVU_VF_VFPF_MBOXX (a) (0x00 | (a) << 3) +#define RVU_VF_INT (0x20) +#define RVU_VF_INT_W1S (0x28) +#define RVU_VF_INT_ENA_W1S (0x30) +#define RVU_VF_INT_ENA_W1C (0x38) +#define RVU_VF_BLOCK_ADDRX_DISC (a) (0x200 | (a) << 3) +#define RVU_VF_MSIX_VECX_ADDR (a) (0x000 | (a) << 4) +#define RVU_VF_MSIX_VECX_CTL (a) (0x008 | (a) << 4) +#define RVU_VF_MSIX_PBAX (a) (0xF0000 | (a) << 3) +#define RVU_FUNC_BLKADDR_SHIFT 20#define RVU_FUNC_BLKADDR_MASK 0x1FULL
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +1 -0
@@ -778,6 +778,7 @@ bool otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue *sq,return true; } +EXPORT_SYMBOL (otx2_sq_append_skb);void otx2_cleanup_rx_cqes (struct otx2_nic *pfvf,struct otx2_cq_queue *cq) {
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +670 -0
670 lines not on this page · raw message
Signature · 1 line
2.7.4
Jakub Kicinski
maintainerRe: [PATCH net-next 3/6] octeontx2-vf: Virtual function driver dupport
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 20
Quoted 3 lines · On Wed, 11 Mar 2020 00:17:22 +0530 [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +3
-0+#define DRV_NAME "octeontx2-nicvf" +#define DRV_STRING "Marvell OcteonTX2 NIC Virtual Function Driver" +#define DRV_VERSION "1.0"
Please drop the driver version, kernel version should be used upstream.
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 28
Quoted 8 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +8
-0+ +static const struct pci_device_id otx2_vf_id_table[] = { + {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_AFVF ) }, + {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_VF ) }, + { } +}; + +MODULE_AUTHOR ("Marvell International Ltd." );
Only people can be authors, please put your name here or remove this.
Quoted 5 lines
(quoted diff) +4
-0+MODULE_DESCRIPTION(DRV_STRING); +MODULE_LICENSE("GPL v2"); +MODULE_VERSION(DRV_VERSION); +MODULE_DEVICE_TABLE(pci, otx2_vf_id_table);
Review
Quoted 10 lines
(quoted diff) +10
-0+static netdev_tx_t otx2vf_xmit(struct sk_buff *skb, struct net_device *netdev) +{ + struct otx2_nic *vf = netdev_priv(netdev); + int qidx = skb_get_queue_mapping(skb); + struct otx2_snd_queue *sq; + struct netdev_queue *txq; + + /* Check for minimum and maximum packet length */ + if (skb->len <= ETH_HLEN || + (!skb_shinfo(skb)->gso_size && skb->len > vf->max_frs)) {
These should never happen (if they do we need to fix the stack, not sprinkle all the drivers with checks like this).
Quoted 22 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +21
-0+dev_kfree_skb (skb); +return NETDEV_TX_OK ; + } + + sq = &vf->qset.sq[qidx]; + txq =netdev_get_tx_queue (netdev, qidx); + +if (!otx2_sq_append_skb (netdev, sq, skb, qidx)) { +netif_tx_stop_queue (txq); + +/* Check again, incase SQBs got freed up */ +smp_mb (); +if (((sq->num_sqbs - *sq->aura_fc_addr) * sq->sqe_per_sqb) + > sq->sqe_thresh) +netif_tx_wake_queue (txq); + +return NETDEV_TX_BUSY ; + } + +return NETDEV_TX_OK ; +}
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 433
Quoted 10 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +10
-0+static void otx2vf_reset_task (struct work_struct *work) +{ + struct otx2_nic *vf = container_of(work, struct otx2_nic, reset_task); + +if (!netif_running (vf->netdev)) +return ; + +otx2vf_stop (vf->netdev); + vf->reset_count++; +otx2vf_open (vf->netdev);
What's the locking around here? Can user call open/stop while this is running?
Quoted 4 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +3
-0+netif_trans_update (vf->netdev); +} +static int otx2vf_realloc_msix_vectors (struct otx2_nic *vf)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 457
Quoted 10 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +10
-0+{ +struct otx2_hw *hw = &vf->hw; +int num_vec, err; + + num_vec = hw->nix_msixoff; + num_vec +=NIX_LF_CINT_VEC_START + hw->max_queues; + +otx2vf_disable_mbox_intr (vf); +pci_free_irq_vectors (hw->pdev); +pci_free_irq_vectors (hw->pdev);
Why free IRQs twice?
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 467
Quoted 3 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +3
-0+ err =otx2vf_register_mbox_intr (vf, false); +if (err) +return err;
return otx2vf_re..
Re: [PATCH net-next 3/6] octeontx2-vf: Virtual function driver dupport
Quoted 8 lines · Jakub Kicinski
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 20
Quoted 3 lines · On Wed, 11 Mar 2020 00:17:22 +0530 [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +3
-0+#define DRV_NAME "octeontx2-nicvf" +#define DRV_STRING "Marvell OcteonTX2 NIC Virtual Function Driver" +#define DRV_VERSION "1.0"Please drop the driver version, kernel version should be used upstream.
Okay, will do.
Quoted 11 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 28
Quoted 8 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +8
-0+ +static const struct pci_device_id otx2_vf_id_table[] = { + {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_AFVF ) }, + {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_VF ) }, + { } +}; + +MODULE_AUTHOR ("Marvell International Ltd." );Only people can be authors, please put your name here or remove this.
Just for my understanding, is this due to a decision taken in netdev recently ? I have searched through all drivers in netdev and there is a mix of organizations and individuals as AUTHORS.
Here we used org name to avoid specifying multiple names.
Quoted 9 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 401
Quoted 5 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +5
-0+static netdev_tx_t otx2vf_xmit (struct sk_buff *skb,struct net_device *netdev) +{ +/* Check for minimum and maximum packet length */ +if (skb->len <=ETH_HLEN || + (!skb_shinfo (skb)->gso_size && skb->len > vf->max_frs)) {These should never happen (if they do we need to fix the stack, not sprinkle all the drivers with checks like this).
HW has limitation on minimum number of bytes being transmitted, hence the check. Even i wasn't sure if it would be possible, but saw similar limitation/checks in few other drivers, hence added.
Regarding maximum length check, i did see pkts with > MTU (when pathMTU is considered).
But anyways due to changes patch6 of this series HW should shouldn't complain, i will remove this.
Should have removed earlier itself, sorry for the trouble.
Quoted 14 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 433
Quoted 11 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +10
-0+static void otx2vf_reset_task (struct work_struct *work) +{ + struct otx2_nic *vf = container_of(work, struct otx2_nic, reset_task); + +if (!netif_running (vf->netdev)) +return ; + +otx2vf_stop (vf->netdev); + vf->reset_count++; +otx2vf_open (vf->netdev);What's the locking around here? Can user call open/stop while this is running?
Yes, possible, thanks, will fix.
Quoted 17 lines
Quoted 4 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +3
-0+netif_trans_update (vf->netdev); +} +static int otx2vf_realloc_msix_vectors (struct otx2_nic *vf)drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 457
Quoted 10 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +10
-0+{ +struct otx2_hw *hw = &vf->hw; +int num_vec, err; + + num_vec = hw->nix_msixoff; + num_vec +=NIX_LF_CINT_VEC_START + hw->max_queues; + +otx2vf_disable_mbox_intr (vf); +pci_free_irq_vectors (hw->pdev); +pci_free_irq_vectors (hw->pdev);Why free IRQs twice?
hmm.. will fix.
Quoted 5 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 467
Quoted 3 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +3
-0+ err =otx2vf_register_mbox_intr (vf, false); +if (err) +return err;return
otx2vf_re..
Okay, will change.
Thanks,
Sunil.
Re: [PATCH net-next 3/6] octeontx2-vf: Virtual function driver dupport
Quoted 24 lines · Sunil Kovvuri
Quoted 8 lines · Jakub Kicinski
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 20
Quoted 3 lines · On Wed, 11 Mar 2020 00:17:22 +0530 [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +3
-0+#define DRV_NAME "octeontx2-nicvf" +#define DRV_STRING "Marvell OcteonTX2 NIC Virtual Function Driver" +#define DRV_VERSION "1.0"Please drop the driver version, kernel version should be used upstream.
Okay, will do.
Quoted 11 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 28
Quoted 8 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +8
-0+ +static const struct pci_device_id otx2_vf_id_table[] = { + {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_AFVF ) }, + {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_VF ) }, + { } +}; + +MODULE_AUTHOR ("Marvell International Ltd." );Only people can be authors, please put your name here or remove this.
Quoted 4 lines
Just for my understanding, is this due to a decision taken in netdev recently ? I have searched through all drivers in netdev and there is a mix of organizations and individuals as AUTHORS.
Here we used org name to avoid specifying multiple names.
It was always the case in all subsystems. The authorship belongs to the developer and not to the company. In opposite to the copyright.
Thanks
Jakub Kicinski
maintainerRe: [PATCH net-next 3/6] octeontx2-vf: Virtual function driver dupport
Quoted 13 lines · On Wed, 11 Mar 2020 12:16:46 +0200 Leon Romanovsky wrote:
Quoted 12 lines · Sunil Kovvuri
Quoted 10 lines · Jakub Kicinski
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c line 28
Quoted 7 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c new file +7
-0+static const struct pci_device_id otx2_vf_id_table[] = { + {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_AFVF ) }, + {PCI_DEVICE (PCI_VENDOR_ID_CAVIUM ,PCI_DEVID_OCTEONTX2_RVU_VF ) }, + { } +}; + +MODULE_AUTHOR ("Marvell International Ltd." );Only people can be authors, please put your name here or remove this.
Quoted 7 lines
Quoted 4 lines
Just for my understanding, is this due to a decision taken in netdev recently ? I have searched through all drivers in netdev and there is a mix of organizations and individuals as AUTHORS.
Here we used org name to avoid specifying multiple names.It was always the case in all subsystems. The authorship belongs to the developer and not to the company. In opposite to the copyright.
Yup. The enforcement hasn't been perfect since it's a hard thing to add to checkpatch etc. But since it jumped out I thought I'd mention it.
Here's me complaining on another Marvell driver submission recently ;)
PATCH 4/6 octeontx2-vf: Ethtool support
In reply to [email protected]From: Tomasz Duszynski <[email protected]>
Added ethtool support for VF devices for
- Driver stats, Tx/Rx perqueue stats
- Set/show Rx/Tx queue count
- Set/show Rx/Tx ring sizes
- Set/show IRQ coalescing parameters
- RSS configuration etc
It's the PF which owns the interface, hence VF cannot display underlying CGX interface stats. Except for this rest ethtool support reuses PF's APIs.
--- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 1 + .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 131 ++++++++++++++++++++- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 4 + 3 files changed, 134 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -0
@@ -631,6 +631,7 @@ void otx2_update_lmac_stats(struct otx2_nic *pfvf);int otx2_update_rq_stats (struct otx2_nic *pfvf,int qidx);int otx2_update_sq_stats (struct otx2_nic *pfvf,int qidx);void otx2_set_ethtool_ops (struct net_device *netdev); +void otx2vf_set_ethtool_ops (struct net_device *netdev);int otx2_open (struct net_device *netdev);int otx2_stop (struct net_device *netdev);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +129 -2
170 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +4 -0
@@ -383,11 +383,13 @@ int otx2vf_open(struct net_device *netdev)return 0 ; } +EXPORT_SYMBOL (otx2vf_open);int otx2vf_stop (struct net_device *netdev) {return otx2_stop (netdev); } +EXPORT_SYMBOL (otx2vf_stop);static netdev_tx_t otx2vf_xmit (struct sk_buff *skb,struct net_device *netdev) {
@@ -603,6 +605,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_detach_rsrc; } +otx2vf_set_ethtool_ops (netdev); +/* Enable pause frames by default */ vf->flags |=OTX2_FLAG_RX_PAUSE_ENABLED ; vf->flags |=OTX2_FLAG_TX_PAUSE_ENABLED ;
Signature · 1 line
2.7.4
Re: [PATCH net-next 4/6] octeontx2-vf: Ethtool support
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c static const unsigned int otx2_n_dev_stats = ARRAY_SIZE(otx2_dev_stats); · line 75
Quoted 9 lines · On Wed, Mar 11, 2020 at 12:17:23AM +0530, [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +9
-0+int __weak otx2vf_open (struct net_device *netdev) +{ +return 0 ; +} + +int __weak otx2vf_stop (struct net_device *netdev) +{ +return 0 ; +}
Hi Sunil
weak symbols are very unusual in a driver. Why are they required?
Thanks
Andrew
Re: [PATCH net-next 4/6] octeontx2-vf: Ethtool support
Quoted 14 lines · Andrew Lunn
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c static const unsigned int otx2_n_dev_stats = ARRAY_SIZE(otx2_dev_stats); · line 75
Quoted 9 lines · On Wed, Mar 11, 2020 at 12:17:23AM +0530, [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +9
-0+int __weak otx2vf_open (struct net_device *netdev) +{ +return 0 ; +} + +int __weak otx2vf_stop (struct net_device *netdev) +{ +return 0 ; +}Hi Sunil
Quoted 4 lines
weak symbols are very unusual in a driver. Why are they required?
Thanks
Andrew
For ethtool configs which need interface reinitialization of interface we need to either call PF or VF open/close fn()s.
If VF driver is not compiled in, then PF driver compilation will fail without these weak symbols.
They are there just for compilation purpose, no other use.
Thanks,
Sunil.
Re: [PATCH net-next 4/6] octeontx2-vf: Ethtool support
Quoted 17 lines · Sunil Kovvuri
Quoted 16 lines · Andrew Lunn
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c static const unsigned int otx2_n_dev_stats = ARRAY_SIZE(otx2_dev_stats); · line 75
Quoted 9 lines · On Wed, Mar 11, 2020 at 12:17:23AM +0530, [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +9
-0+int __weak otx2vf_open (struct net_device *netdev) +{ +return 0 ; +} + +int __weak otx2vf_stop (struct net_device *netdev) +{ +return 0 ; +}Hi Sunil
weak symbols are very unusual in a driver. Why are they required?
Quoted 8 lines
Quoted 2 lines
Thanks
AndrewFor ethtool configs which need interface reinitialization of interface we need to either call PF or VF open/close fn()s.
If VF driver is not compiled in, then PF driver compilation will fail without these weak symbols.
They are there just for compilation purpose, no other use.
It doesn't make sense, your PF driver should be changed to allow compilation with those empty functions.
Thanks
Quoted 3 lines
Thanks,
Sunil.
Re: [PATCH net-next 4/6] octeontx2-vf: Ethtool support
Quoted 28 lines · Leon Romanovsky
Quoted 17 lines · Sunil Kovvuri
Quoted 16 lines · Andrew Lunn
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c static const unsigned int otx2_n_dev_stats = ARRAY_SIZE(otx2_dev_stats); · line 75
Quoted 9 lines · On Wed, Mar 11, 2020 at 12:17:23AM +0530, [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +9
-0+int __weak otx2vf_open (struct net_device *netdev) +{ +return 0 ; +} + +int __weak otx2vf_stop (struct net_device *netdev) +{ +return 0 ; +}Hi Sunil
weak symbols are very unusual in a driver. Why are they required?
Quoted 8 lines
Quoted 2 lines
Thanks
AndrewFor ethtool configs which need interface reinitialization of interface we need to either call PF or VF open/close fn()s.
If VF driver is not compiled in, then PF driver compilation will fail without these weak symbols.
They are there just for compilation purpose, no other use.
Quoted 5 lines
It doesn't make sense, your PF driver should be changed to allow compilation with those empty functions.
Thanks
I didn't get, if VF driver is not compiled in then there are no otx2vf_open/stop fn()s defined.
Either i have add weak fn()s or add empty ones based on VF CONFIG option, anyother option ?
Thanks,
Sunil.
Re: [PATCH net-next 4/6] octeontx2-vf: Ethtool support
Quoted 32 lines · Sunil Kovvuri
Quoted 31 lines · Leon Romanovsky
Quoted 17 lines · Sunil Kovvuri
Quoted 16 lines · Andrew Lunn
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c static const unsigned int otx2_n_dev_stats = ARRAY_SIZE(otx2_dev_stats); · line 75
Quoted 9 lines · On Wed, Mar 11, 2020 at 12:17:23AM +0530, [email protected] wrote:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +9
-0+int __weak otx2vf_open (struct net_device *netdev) +{ +return 0 ; +} + +int __weak otx2vf_stop (struct net_device *netdev) +{ +return 0 ; +}Hi Sunil
weak symbols are very unusual in a driver. Why are they required?
Quoted 8 lines
Quoted 2 lines
Thanks
AndrewFor ethtool configs which need interface reinitialization of interface we need to either call PF or VF open/close fn()s.
If VF driver is not compiled in, then PF driver compilation will fail without these weak symbols.
They are there just for compilation purpose, no other use.It doesn't make sense, your PF driver should be changed to allow compilation with those empty functions.
Quoted 7 lines
Quoted 2 lines
Thanks
I didn't get, if VF driver is not compiled in then there are no otx2vf_open/stop fn()s defined.
Either i have add weak fn()s or add empty ones based on VF CONFIG option, anyother option ?
I have no access to your implementation. But in general case:
If those fn() are accessed through pointer ->fn(), you need add checks like this "if (..>fn) ..->fn()". If you call directly, add empty declarations in the .h and enable them in case VF is not compiled.
Thanks
Quoted 3 lines
Thanks,
Sunil.
Jakub Kicinski
maintainerRe: [PATCH net-next 4/6] octeontx2-vf: Ethtool support
In reply to [email protected]Quoted 1 line · On Wed, 11 Mar 2020 00:17:23 +0530 [email protected] wrote:
+static const struct
ethtool_opsotx2vf_ethtool_ops= {
Please specify .supported_coalesce_params
Quoted 22 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +22
-0+ .get_link = otx2_get_link, + .get_drvinfo = otx2vf_get_drvinfo, + .get_strings = otx2vf_get_strings, + .get_ethtool_stats = otx2vf_get_ethtool_stats, + .get_sset_count = otx2vf_get_sset_count, + .set_channels = otx2_set_channels, + .get_channels = otx2_get_channels, + .get_rxnfc = otx2_get_rxnfc, + .set_rxnfc = otx2_set_rxnfc, + .get_rxfh_key_size = otx2_get_rxfh_key_size, + .get_rxfh_indir_size = otx2_get_rxfh_indir_size, + .get_rxfh = otx2_get_rxfh, + .set_rxfh = otx2_set_rxfh, + .get_ringparam = otx2_get_ringparam, + .set_ringparam = otx2_set_ringparam, + .get_coalesce = otx2_get_coalesce, + .set_coalesce = otx2_set_coalesce, + .get_msglevel = otx2_get_msglevel, + .set_msglevel = otx2_set_msglevel, + .get_pauseparam = otx2_get_pauseparam, + .set_pauseparam = otx2_set_pauseparam, +};
Re: [PATCH net-next 4/6] octeontx2-vf: Ethtool support
Quoted 6 lines · Jakub Kicinski
Quoted 1 line · On Wed, 11 Mar 2020 00:17:23 +0530 [email protected] wrote:
+static const struct
ethtool_opsotx2vf_ethtool_ops= {Please specify .supported_coalesce_params
Thanks, will do.
Sunil.
PATCH 5/6 octeontx2-vf: Link event notification support
In reply to [email protected]From: Tomasz Duszynski <[email protected]>
VF shares physical link with PF. Admin function (AF) sends notification to PF whenever a link change event happens. PF has to forward the same notification to each of the enabled VF.
PF traps START/STOP_RX messages sent by VF to AF to keep track of VF's enabled/disabled state.
--- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 7 ++ .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 88 +++++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +7 -0
@@ -193,6 +193,12 @@ struct otx2_hw {u64 cgx_tx_stats[CGX_TX_STATS_COUNT ]; }; +struct otx2_vf_config { +struct otx2_nic *pf; +struct delayed_work link_event_work; +bool intf_down;/* interface was either configured or not */ +}; +struct flr_work {struct work_struct work;struct otx2_nic *pf;
@@ -229,6 +235,7 @@ struct otx2_nic {u8 total_vfs;u16 pcifunc;/* RVU PF_FUNC */ u16 bpid[NIX_MAX_BPID_CHAN ]; +struct otx2_vf_config *vf_configs;struct cgx_link_user_info linfo;u64 reset_count;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +86 -2
145 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 6/6 octeontx2-pf: Cleanup all receive buffers in SG descriptor
In reply to [email protected]From: Geetha sowjanya <[email protected]>
With MTU sized receive buffers it is not expected to have CQE_RX with multiple receive buffer pointers. But since same physcial link is shared by PF and it's VFs, the max receive packet configured at link could be morethan MTU. Hence there is a chance of receiving plts morethan MTU which then gets DMA'ed into multiple buffers and notified in a single CQE_RX. This patch treats such pkts as errors and frees up receive buffers pointers back to hardware.
Also on the transmit side this patch sets SMQ MAXLEN to max value to avoid HW length errors for the packets whose size > MTU, eg due to path MTU.
--- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 9 +++--- .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 34 ++++++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +5 -4
@@ -212,8 +212,6 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)return -ENOMEM ; } -/* SMQ config limits maximum pkt size that can be transmitted */ - req->update_smq = true; pfvf->max_frs = mtu +OTX2_ETH_HLEN ; req->maxlen = pfvf->max_frs;
@@ -469,7 +467,7 @@ int otx2_txschq_config(struct otx2_nic *pfvf, int lvl)/* Set topology e.t.c configuration */ if (lvl ==NIX_TXSCH_LVL_SMQ ) { req->reg[0 ] =NIX_AF_SMQX_CFG (schq); - req->regval[0 ] = ((pfvf->netdev->mtu +OTX2_ETH_HLEN ) <<8 ) | + req->regval[0 ] = ((OTX2_MAX_MTU +OTX2_ETH_HLEN ) <<8 ) |OTX2_MIN_MTU ; req->regval[0] |= (0x20ULL << 51) | (0x80ULL << 39) |
@@ -579,17 +577,19 @@ void otx2_sqb_flush(struct otx2_nic *pfvf) {int qidx, sqe_tail, sqe_head;u64 incr, *ptr, val; +int timeout =1000 ; ptr = (u64 *)otx2_get_regaddr (pfvf,NIX_LF_SQ_OP_STATUS );for (qidx =0 ; qidx < pfvf->hw.tx_queues; qidx++) { incr = (u64 )qidx <<32 ; -while (1 ) { +while (timeout) { val =otx2_atomic64_add (incr, ptr); sqe_head = (val >>20 ) &0x3F ; sqe_tail = (val >>28 ) &0x3F ;if (sqe_head == sqe_tail)break ;usleep_range (1 ,3 ); + timeout--; } } }
@@ -985,6 +985,7 @@ void otx2_aura_pool_free(struct otx2_nic *pfvf)qmem_free (pfvf->dev, pool->fc_addr); }devm_kfree (pfvf->dev, pfvf->qset.pool); + pfvf->qset.pool =NULL ; } static int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +29 -5
@@ -138,6 +138,25 @@ static void otx2_set_rxhash(struct otx2_nic *pfvf,skb_set_hash (skb, hash, hash_type); } +static void otx2_free_rcv_seg (struct otx2_nic *pfvf,struct nix_cqe_rx_s *cqe, +int qidx) +{ +struct nix_rx_sg_s *sg = &cqe->sg; +void *end, *start; +u64 *seg_addr; +int seg; + + start = (void *)sg; + end = start + ((cqe->parse.desc_sizem1 +1 ) *16 ); +while (start < end) { + sg = (struct nix_rx_sg_s *)start; + seg_addr = &sg->seg_addr; +for (seg =0 ; seg < sg->segs; seg++, seg_addr++) +otx2_aura_freeptr (pfvf, qidx, *seg_addr & ~0x07ULL ); + start +=sizeof (*sg); + } +} +static bool otx2_check_rcv_errors (struct otx2_nic *pfvf,struct nix_cqe_rx_s *cqe,int qidx) {
@@ -189,16 +208,17 @@ static bool otx2_check_rcv_errors(struct otx2_nic *pfvf,/* For now ignore all the NPC parser errors and * pass the packets to stack. */ -return false; +if (cqe->sg.segs ==1 ) +return false; }/* If RXALL is enabled pass on packets to stack. */ -if (cqe->sg.segs && (pfvf->netdev->features &NETIF_F_RXALL )) +if (cqe->sg.segs ==1 && (pfvf->netdev->features &NETIF_F_RXALL ))return false;/* Free buffer back to pool */ if (cqe->sg.segs) -otx2_aura_freeptr (pfvf, qidx, cqe->sg.seg_addr & ~0x07ULL ); +otx2_free_rcv_seg (pfvf, cqe, qidx);return true; }
@@ -210,7 +230,7 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,struct nix_rx_parse_s *parse = &cqe->parse;struct sk_buff *skb =NULL ; -if (unlikely (parse->errlev || parse->errcode)) { +if (unlikely (parse->errlev || parse->errcode || cqe->sg.segs >1 )) {if (otx2_check_rcv_errors (pfvf, cqe, cq->cq_idx))return ; }
@@ -789,11 +809,15 @@ void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)while ((cqe = (struct nix_cqe_rx_s *)otx2_get_next_cqe (cq))) {if (!cqe->sg.subdc)continue ; + processed_cqe++; +if (cqe->sg.segs >1 ) { +otx2_free_rcv_seg (pfvf, cqe, cq->cq_idx); +continue ; + } iova = cqe->sg.seg_addr -OTX2_HEAD_ROOM ; pa =otx2_iova_to_phys (pfvf->iommu_domain, iova);otx2_dma_unmap_page (pfvf, iova, pfvf->rbsize,DMA_FROM_DEVICE );put_page (virt_to_page (phys_to_virt (pa))); - processed_cqe++; }/* Free CQEs to HW */
Signature · 1 line
2.7.4