Loading drivers/net/ethernet/aquantia/Kconfig +3 −1 Original line number Diff line number Diff line Loading @@ -23,10 +23,12 @@ config AQTION config AQFWD tristate "aQuantia Forwarding driver" depends on PCI && (X86_64 || ARM64) depends on PCI && (X86_64 || ARM64 || ARM) ---help--- This enables the support for forwarding driver for the aQuantia AQtion(tm) Ethernet card. source "drivers/net/ethernet/aquantia/atlantic-fwd/Kconfig" config AQFWD_QCOM bool "QTI MSM/MDM target support" depends on AQFWD Loading drivers/net/ethernet/aquantia/atlantic-fwd/Kconfig 0 → 100644 +44 −0 Original line number Diff line number Diff line # # Aquantia atlantic-forwarding driver config # if AQFWD config ATLFWD_FWD bool "Enable forwarding-engine API" default n ---help--- Say Y to enable the forwarding-engine API config ATLFWD_FWD_RXBUF int prompt "Rx buffer space for forwarding engine's rings" if ATLFWD_FWD range 0 320 default 160 if ATLFWD_FWD default 0 ---help--- Amount of Rx buffer to reserve for the forwarding-engine rings. This sets the default value of the fwd_rx_buf_reserve module option. Value in kiB, 0 to 320, defaults to 160 if forwarding-engine API enabled, 0 otherwise. config ATLFWD_FWD_TXBUF int prompt "Tx buffer space for forwarding engine's rings" if ATLFWD_FWD range 0 160 default 80 if ATLFWD_FWD default 0 ---help--- Amount of Tx buffer to reserve for the forwarding-engine rings. This sets the default value of the fwd_tx_buf_reserve module option. Value in kiB, 0 to 320, defaults to 80 if forwarding-engine API enabled, 0 otherwise. endif drivers/net/ethernet/aquantia/atlantic-fwd/Makefile +2 −1 Original line number Diff line number Diff line Loading @@ -35,10 +35,11 @@ atlantic-fwd-objs := atl_fw.o \ atl_ring.o \ atl_ethtool.o \ atl_trace.o \ atl_fwd.o \ atl_compat.o \ atl_hwmon.o atlantic-fwd-$(CONFIG_ATLFWD_FWD) += atl_fwd.o atlantic-fwd-$(CONFIG_OF) += atl_of.o atlantic-fwd-$(CONFIG_AQFWD_QCOM) += atl_qcom.o Loading drivers/net/ethernet/aquantia/atlantic-fwd/atl_common.h +30 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ #include <linux/netdevice.h> #include <linux/moduleparam.h> #define ATL_VERSION "1.0.15" #define ATL_VERSION "1.0.16" struct atl_nic; Loading Loading @@ -92,6 +92,8 @@ enum { ATL_RXF_ETYPE_MAX = ATL_ETYPE_FLT_NUM, ATL_RXF_NTUPLE_BASE = ATL_RXF_ETYPE_BASE + ATL_RXF_ETYPE_MAX, ATL_RXF_NTUPLE_MAX = ATL_NTUPLE_FLT_NUM, ATL_RXF_FLEX_BASE = ATL_RXF_NTUPLE_BASE + ATL_RXF_NTUPLE_MAX, ATL_RXF_FLEX_MAX = 1, }; enum atl_rxf_common_cmd { Loading Loading @@ -173,6 +175,19 @@ struct atl_rxf_etype { int count; }; enum atl_flex_cmd { ATL_FLEX_EN = ATL_RXF_EN, ATL_FLEX_RXQ = BIT(30), ATL_FLEX_RXQ_SHIFT = 20, ATL_FLEX_RXQ_MASK = ATL_RXF_RXQ_MSK << ATL_FLEX_RXQ_SHIFT, ATL_FLEX_ACT_SHIFT = ATL_RXF_ACT_SHIFT, }; struct atl_rxf_flex { uint32_t cmd[ATL_RXF_FLEX_MAX]; int count; }; struct atl_queue_vec; #define ATL_NUM_FWD_RINGS ATL_MAX_QUEUES Loading Loading @@ -217,11 +232,14 @@ struct atl_nic { spinlock_t stats_lock; struct work_struct work; #ifdef CONFIG_ATLFWD_FWD struct atl_fwd fwd; #endif struct atl_rxf_ntuple rxf_ntuple; struct atl_rxf_vlan rxf_vlan; struct atl_rxf_etype rxf_etype; struct atl_rxf_flex rxf_flex; }; /* Flags only modified with RTNL lock held */ Loading Loading @@ -318,6 +336,17 @@ extern unsigned atl_min_intr_delay; #define atl_module_param(_name, _type, _mode) \ module_param_named(_name, atl_ ## _name, _type, _mode) static inline void atl_intr_enable_non_ring(struct atl_nic *nic) { struct atl_hw *hw = &nic->hw; uint32_t mask = hw->intr_mask; #ifdef CONFIG_ATLFWD_FWD mask |= (uint32_t)(nic->fwd.msi_map); #endif atl_intr_enable(hw, mask); } netdev_tx_t atl_start_xmit(struct sk_buff *skb, struct net_device *ndev); int atl_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid); int atl_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid); Loading drivers/net/ethernet/aquantia/atlantic-fwd/atl_compat.c +4 −75 Original line number Diff line number Diff line Loading @@ -15,7 +15,8 @@ #include <linux/cpu.h> #include <linux/interrupt.h> #ifdef ATL_COMPAT_PCI_IRQ_VECTOR #ifdef ATL_COMPAT_PCI_ALLOC_IRQ_VECTORS /* From commit aff171641d181ea573380efc3f559c9de4741fc5 */ int atl_compat_pci_irq_vector(struct pci_dev *dev, unsigned int nr) { Loading Loading @@ -45,83 +46,11 @@ int atl_compat_pci_irq_vector(struct pci_dev *dev, unsigned int nr) return dev->irq + nr; } #endif #ifdef ATL_COMPAT_PCI_ALLOC_IRQ_VECTORS_AFFINITY void atl_compat_set_affinity(int vector, struct atl_queue_vec *qvec) { cpumask_t *cpumask = qvec ? &qvec->affinity_hint : NULL; irq_set_affinity_hint(vector, cpumask); } void atl_compat_calc_affinities(struct atl_nic *nic) { struct pci_dev *pdev = nic->hw.pdev; int i; unsigned int cpu; get_online_cpus(); cpu = cpumask_first(cpu_online_mask); for (i = 0; i < nic->nvecs; i++) { cpumask_t *cpumask = &nic->qvecs[i].affinity_hint; int vector; /* If some cpus went offline since allocating * vectors, leave the remaining vectors' affininty * unset. */ if (cpu >= nr_cpumask_bits) break; cpumask_clear(cpumask); cpumask_set_cpu(cpu, cpumask); cpu = cpumask_next(cpu, cpu_online_mask); vector = pci_irq_vector(pdev, i + ATL_NUM_NON_RING_IRQS); } put_online_cpus(); } /* from commit 6f9a22bc5775d231ab8fbe2c2f3c88e45e3e7c28 */ static int irq_calc_affinity_vectors(int minvec, int maxvec, const struct irq_affinity *affd) { int resv = affd->pre_vectors + affd->post_vectors; int vecs = maxvec - resv; int cpus; if (resv > minvec) return 0; /* Stabilize the cpumasks */ get_online_cpus(); cpus = cpumask_weight(cpu_online_mask); put_online_cpus(); return min(cpus, vecs) + resv; } /* based on commit 402723ad5c625ee052432698ae5e56b02d38d4ec */ int atl_compat_pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, unsigned int max_vecs, unsigned int flags, const struct irq_affinity *affd) int atl_compat_pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, unsigned int max_vecs, unsigned int flags) { static const struct irq_affinity msi_default_affd; int vecs = -ENOSPC; if (flags & PCI_IRQ_AFFINITY) { if (!affd) affd = &msi_default_affd; } else { if (WARN_ON(affd)) affd = NULL; } if (affd) max_vecs = irq_calc_affinity_vectors(min_vecs, max_vecs, affd); if (flags & PCI_IRQ_MSIX) { struct msix_entry *entries; int i; Loading Loading
drivers/net/ethernet/aquantia/Kconfig +3 −1 Original line number Diff line number Diff line Loading @@ -23,10 +23,12 @@ config AQTION config AQFWD tristate "aQuantia Forwarding driver" depends on PCI && (X86_64 || ARM64) depends on PCI && (X86_64 || ARM64 || ARM) ---help--- This enables the support for forwarding driver for the aQuantia AQtion(tm) Ethernet card. source "drivers/net/ethernet/aquantia/atlantic-fwd/Kconfig" config AQFWD_QCOM bool "QTI MSM/MDM target support" depends on AQFWD Loading
drivers/net/ethernet/aquantia/atlantic-fwd/Kconfig 0 → 100644 +44 −0 Original line number Diff line number Diff line # # Aquantia atlantic-forwarding driver config # if AQFWD config ATLFWD_FWD bool "Enable forwarding-engine API" default n ---help--- Say Y to enable the forwarding-engine API config ATLFWD_FWD_RXBUF int prompt "Rx buffer space for forwarding engine's rings" if ATLFWD_FWD range 0 320 default 160 if ATLFWD_FWD default 0 ---help--- Amount of Rx buffer to reserve for the forwarding-engine rings. This sets the default value of the fwd_rx_buf_reserve module option. Value in kiB, 0 to 320, defaults to 160 if forwarding-engine API enabled, 0 otherwise. config ATLFWD_FWD_TXBUF int prompt "Tx buffer space for forwarding engine's rings" if ATLFWD_FWD range 0 160 default 80 if ATLFWD_FWD default 0 ---help--- Amount of Tx buffer to reserve for the forwarding-engine rings. This sets the default value of the fwd_tx_buf_reserve module option. Value in kiB, 0 to 320, defaults to 80 if forwarding-engine API enabled, 0 otherwise. endif
drivers/net/ethernet/aquantia/atlantic-fwd/Makefile +2 −1 Original line number Diff line number Diff line Loading @@ -35,10 +35,11 @@ atlantic-fwd-objs := atl_fw.o \ atl_ring.o \ atl_ethtool.o \ atl_trace.o \ atl_fwd.o \ atl_compat.o \ atl_hwmon.o atlantic-fwd-$(CONFIG_ATLFWD_FWD) += atl_fwd.o atlantic-fwd-$(CONFIG_OF) += atl_of.o atlantic-fwd-$(CONFIG_AQFWD_QCOM) += atl_qcom.o Loading
drivers/net/ethernet/aquantia/atlantic-fwd/atl_common.h +30 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ #include <linux/netdevice.h> #include <linux/moduleparam.h> #define ATL_VERSION "1.0.15" #define ATL_VERSION "1.0.16" struct atl_nic; Loading Loading @@ -92,6 +92,8 @@ enum { ATL_RXF_ETYPE_MAX = ATL_ETYPE_FLT_NUM, ATL_RXF_NTUPLE_BASE = ATL_RXF_ETYPE_BASE + ATL_RXF_ETYPE_MAX, ATL_RXF_NTUPLE_MAX = ATL_NTUPLE_FLT_NUM, ATL_RXF_FLEX_BASE = ATL_RXF_NTUPLE_BASE + ATL_RXF_NTUPLE_MAX, ATL_RXF_FLEX_MAX = 1, }; enum atl_rxf_common_cmd { Loading Loading @@ -173,6 +175,19 @@ struct atl_rxf_etype { int count; }; enum atl_flex_cmd { ATL_FLEX_EN = ATL_RXF_EN, ATL_FLEX_RXQ = BIT(30), ATL_FLEX_RXQ_SHIFT = 20, ATL_FLEX_RXQ_MASK = ATL_RXF_RXQ_MSK << ATL_FLEX_RXQ_SHIFT, ATL_FLEX_ACT_SHIFT = ATL_RXF_ACT_SHIFT, }; struct atl_rxf_flex { uint32_t cmd[ATL_RXF_FLEX_MAX]; int count; }; struct atl_queue_vec; #define ATL_NUM_FWD_RINGS ATL_MAX_QUEUES Loading Loading @@ -217,11 +232,14 @@ struct atl_nic { spinlock_t stats_lock; struct work_struct work; #ifdef CONFIG_ATLFWD_FWD struct atl_fwd fwd; #endif struct atl_rxf_ntuple rxf_ntuple; struct atl_rxf_vlan rxf_vlan; struct atl_rxf_etype rxf_etype; struct atl_rxf_flex rxf_flex; }; /* Flags only modified with RTNL lock held */ Loading Loading @@ -318,6 +336,17 @@ extern unsigned atl_min_intr_delay; #define atl_module_param(_name, _type, _mode) \ module_param_named(_name, atl_ ## _name, _type, _mode) static inline void atl_intr_enable_non_ring(struct atl_nic *nic) { struct atl_hw *hw = &nic->hw; uint32_t mask = hw->intr_mask; #ifdef CONFIG_ATLFWD_FWD mask |= (uint32_t)(nic->fwd.msi_map); #endif atl_intr_enable(hw, mask); } netdev_tx_t atl_start_xmit(struct sk_buff *skb, struct net_device *ndev); int atl_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid); int atl_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid); Loading
drivers/net/ethernet/aquantia/atlantic-fwd/atl_compat.c +4 −75 Original line number Diff line number Diff line Loading @@ -15,7 +15,8 @@ #include <linux/cpu.h> #include <linux/interrupt.h> #ifdef ATL_COMPAT_PCI_IRQ_VECTOR #ifdef ATL_COMPAT_PCI_ALLOC_IRQ_VECTORS /* From commit aff171641d181ea573380efc3f559c9de4741fc5 */ int atl_compat_pci_irq_vector(struct pci_dev *dev, unsigned int nr) { Loading Loading @@ -45,83 +46,11 @@ int atl_compat_pci_irq_vector(struct pci_dev *dev, unsigned int nr) return dev->irq + nr; } #endif #ifdef ATL_COMPAT_PCI_ALLOC_IRQ_VECTORS_AFFINITY void atl_compat_set_affinity(int vector, struct atl_queue_vec *qvec) { cpumask_t *cpumask = qvec ? &qvec->affinity_hint : NULL; irq_set_affinity_hint(vector, cpumask); } void atl_compat_calc_affinities(struct atl_nic *nic) { struct pci_dev *pdev = nic->hw.pdev; int i; unsigned int cpu; get_online_cpus(); cpu = cpumask_first(cpu_online_mask); for (i = 0; i < nic->nvecs; i++) { cpumask_t *cpumask = &nic->qvecs[i].affinity_hint; int vector; /* If some cpus went offline since allocating * vectors, leave the remaining vectors' affininty * unset. */ if (cpu >= nr_cpumask_bits) break; cpumask_clear(cpumask); cpumask_set_cpu(cpu, cpumask); cpu = cpumask_next(cpu, cpu_online_mask); vector = pci_irq_vector(pdev, i + ATL_NUM_NON_RING_IRQS); } put_online_cpus(); } /* from commit 6f9a22bc5775d231ab8fbe2c2f3c88e45e3e7c28 */ static int irq_calc_affinity_vectors(int minvec, int maxvec, const struct irq_affinity *affd) { int resv = affd->pre_vectors + affd->post_vectors; int vecs = maxvec - resv; int cpus; if (resv > minvec) return 0; /* Stabilize the cpumasks */ get_online_cpus(); cpus = cpumask_weight(cpu_online_mask); put_online_cpus(); return min(cpus, vecs) + resv; } /* based on commit 402723ad5c625ee052432698ae5e56b02d38d4ec */ int atl_compat_pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, unsigned int max_vecs, unsigned int flags, const struct irq_affinity *affd) int atl_compat_pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, unsigned int max_vecs, unsigned int flags) { static const struct irq_affinity msi_default_affd; int vecs = -ENOSPC; if (flags & PCI_IRQ_AFFINITY) { if (!affd) affd = &msi_default_affd; } else { if (WARN_ON(affd)) affd = NULL; } if (affd) max_vecs = irq_calc_affinity_vectors(min_vecs, max_vecs, affd); if (flags & PCI_IRQ_MSIX) { struct msix_entry *entries; int i; Loading