fm10k: revised series
Subsystems (2)
cover fm10k: revised series
This series has been revised to include suggestions from Alexander Duyck. Changed patches have -rc1 in their patch description.
Alexander Duyck (1):
fm10k: Only trigger data path reset if fabric is up
Jacob Keller (9):
fm10k: remove is_slot_appropriate
fm10k: allow creation of vlan interfaces even while down
fm10k: don't store sw_vid at reset
fm10k: TRIVIAL fix up ordering of __always_unused and style
fm10k: add support for extra debug statistics
fm10k: send traffic on default vid to vlan device if we have one
fm10k: TRIVIAL fix typo in fm10k_netdev.c
fm10k: re-enable VF after a full reset on detection of a Malicious
event
fm10k: fix iov_msg_mac_vlan_pf VID checks
drivers/net/ethernet/intel/fm10k/fm10k.h | 19 ++ drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c | 5 +- drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 224 +++++++++++++++++++---- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 8 +- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 20 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 20 +- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 52 +++++- drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 105 ++++++----- drivers/net/ethernet/intel/fm10k/fm10k_type.h | 7 +- drivers/net/ethernet/intel/fm10k/fm10k_vf.c | 14 -- 10 files changed, 362 insertions(+), 112 deletions(-)
Signature · 1 line
2.4.3
PATCH 1/10 fm10k: remove is_slot_appropriate
This function is no longer used now that we have updated fm10k_slot_warn functionality.
--- drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 14 -------------- drivers/net/ethernet/intel/fm10k/fm10k_type.h | 1 - drivers/net/ethernet/intel/fm10k/fm10k_vf.c | 14 -------------- 3 files changed, 29 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pf.c +0 -14
@@ -185,19 +185,6 @@ static s32 fm10k_init_hw_pf(struct fm10k_hw *hw) }/** -* fm10k_is_slot_appropriate_pf - Indicate appropriate slot for this SKU -* @hw: pointer to hardware structure -* -* Looks at the PCIe bus info to confirm whether or not this slot can support -* the necessary bandwidth for this device. -**/ -static bool fm10k_is_slot_appropriate_pf (struct fm10k_hw *hw) -{ -return (hw->bus.speed == hw->bus_caps.speed) && - (hw->bus.width == hw->bus_caps.width); -} - -/** * fm10k_update_vlan_pf - Update status of VLAN ID in VLAN filter table * @hw: pointer to hardware structure * @vid: VLAN ID to add to table
@@ -1849,7 +1836,6 @@ static struct fm10k_mac_ops mac_ops_pf = { .init_hw = &fm10k_init_hw_pf, .start_hw = &fm10k_start_hw_generic, .stop_hw = &fm10k_stop_hw_generic, - .is_slot_appropriate = &fm10k_is_slot_appropriate_pf, .update_vlan = &fm10k_update_vlan_pf, .read_mac_addr = &fm10k_read_mac_addr_pf, .update_uc_addr = &fm10k_update_uc_addr_pf,
drivers/net/ethernet/intel/fm10k/fm10k_type.h +0 -1
@@ -521,7 +521,6 @@ struct fm10k_mac_ops {s32 (*stop_hw)(struct fm10k_hw *);s32 (*get_bus_info)(struct fm10k_hw *);s32 (*get_host_state)(struct fm10k_hw *,bool *); -bool (*is_slot_appropriate)(struct fm10k_hw *);s32 (*update_vlan)(struct fm10k_hw *,u32 ,u8 ,bool );s32 (*read_mac_addr)(struct fm10k_hw *); s32 (*update_uc_addr)(struct fm10k_hw *, u16, const u8 *,
drivers/net/ethernet/intel/fm10k/fm10k_vf.c +0 -14
@@ -131,19 +131,6 @@ static s32 fm10k_init_hw_vf(struct fm10k_hw *hw)return 0 ; } -/** -* fm10k_is_slot_appropriate_vf - Indicate appropriate slot for this SKU -* @hw: pointer to hardware structure -* -* Looks at the PCIe bus info to confirm whether or not this slot can support -* the necessary bandwidth for this device. Since the VF has no control over -* the "slot" it is in, always indicate that the slot is appropriate. -**/ -static bool fm10k_is_slot_appropriate_vf (struct fm10k_hw *hw) -{ -return true; -} -/* This structure defines the attibutes to be parsed below */ const struct fm10k_tlv_attr fm10k_mac_vlan_msg_attr[] = {FM10K_TLV_ATTR_U32 (FM10K_MAC_VLAN_MSG_VLAN ),
@@ -552,7 +539,6 @@ static struct fm10k_mac_ops mac_ops_vf = { .init_hw = &fm10k_init_hw_vf, .start_hw = &fm10k_start_hw_generic, .stop_hw = &fm10k_stop_hw_vf, - .is_slot_appropriate = &fm10k_is_slot_appropriate_vf, .update_vlan = &fm10k_update_vlan_vf, .read_mac_addr = &fm10k_read_mac_addr_vf, .update_uc_addr = &fm10k_update_uc_addr_vf,
Signature · 1 line
2.4.3
PATCH 2/10 fm10k: allow creation of vlan interfaces even while down
In reply to Jacob KellerWe re-sync upon going up, so there is little reason to worry about not syncing immediately with switch. This prevents an error that occurs if you add a vlan interface while down.
--- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +6 -0
@@ -779,6 +779,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)if (!set && vid == hw->mac.default_vid)return 0 ; +/* Do not throw an error if the interface is down. We will sync once +* we come up +*/ +if (test_bit (__FM10K_DOWN, &interface->state)) +return 0 ; +fm10k_mbx_lock (interface);/* only need to update the VLAN if not in promiscuous mode */
Signature · 1 line
2.4.3
Singh
PATCH 2/10 fm10k: allow creation of vlan interfaces even while down
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Wednesday, June 24, 2015 1:35 PM
To: Intel Wired LAN <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next rc1 02/10] fm10k: allow creation of vlan interfaces even while down
We re-sync upon going up, so there is little reason to worry about not syncing immediately with switch. This prevents an error that occurs if you add a vlan interface while down.
---
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH 3/10 fm10k: don't store sw_vid at reset
In reply to Jacob KellerIf we store the sw_vid at reset of PF, then we accidentally prevent the VF from receiving the message to update its default VID. This can occur if VFs are created before the PF is brought up, such as before ip link set <device> up.
This fixes an issue where we request the incorrect MAC/VLAN combinations, and prevents us from accidentally reporting some frames as vlan tagged.
-rc1
* Fixed up patch description
--- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_iov.c +0 -3
@@ -228,9 +228,6 @@ int fm10k_iov_resume(struct pci_dev *pdev) hw->iov.ops.set_lport (hw, vf_info, i,FM10K_VF_FLAG_MULTI_CAPABLE ); -/* assign our default vid to the VF following reset */ - vf_info->sw_vid = hw->mac.default_vid; -/* mailbox is disconnected so we don't send a message */ hw->iov.ops.assign_default_mac_vlan (hw, vf_info);
Signature · 1 line
2.4.3
Singh
PATCH 3/10 fm10k: don't store sw_vid at reset
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Wednesday, June 24, 2015 1:35 PM
To: Intel Wired LAN <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next rc1 03/10] fm10k: don't store sw_vid at reset
If we store the sw_vid at reset of PF, then we accidentally prevent the VF from receiving the message to update its default VID. This can occur if VFs are created before the PF is brought up, such as before ip link set <device> up.
This fixes an issue where we request the incorrect MAC/VLAN combinations, and prevents us from accidentally reporting some frames as vlan tagged.
-rc1
* Fixed up patch description
---
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH 4/10 fm10k: TRIVIAL fix up ordering of __always_unused and style
In reply to Jacob KellerFix some style issues in debugfs code, and correct ordering of void and __always_unused. Technically, the order does not matter, but preferred style is to put the macro between the type and name.
--- drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c +3 -2
@@ -37,7 +37,8 @@ static void *fm10k_dbg_desc_seq_start(struct seq_file *s, loff_t *pos) }static void *fm10k_dbg_desc_seq_next (struct seq_file *s, -void __always_unused *v,loff_t *pos) +void __always_unused *v, +loff_t *pos) {struct fm10k_ring *ring = s->private;
@@ -45,7 +46,7 @@ static void *fm10k_dbg_desc_seq_next(struct seq_file *s, }static void fm10k_dbg_desc_seq_stop (struct seq_file __always_unused *s, -__always_unused void *v) +void __always_unused *v) {/* Do nothing. */ }
Signature · 1 line
2.4.3
PATCH 5/10 fm10k: add support for extra debug statistics
In reply to Jacob KellerAdd a private ethtool flag to enable display of these statistics, which are generally less useful. However, sometimes it can be useful for debugging purposes. The most useful portion is the ability to see what the PF thinks the VF mailboxes look like.
--- drivers/net/ethernet/intel/fm10k/fm10k.h | 19 ++ drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 224 +++++++++++++++++++---- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 5 +- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 15 ++ drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 18 ++ drivers/net/ethernet/intel/fm10k/fm10k_type.h | 6 + 6 files changed, 246 insertions(+), 41 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k.h +19 -0
@@ -101,12 +101,19 @@ struct fm10k_tx_queue_stats {u64 csum_err;u64 tx_busy;u64 tx_done_old; +u64 csum_good; };struct fm10k_rx_queue_stats {u64 alloc_failed;u64 csum_err;u64 errors; +u64 csum_good; +u64 switch_errors; +u64 drops; +u64 pp_errors; +u64 link_errors; +u64 length_errors; };struct fm10k_ring {
@@ -251,6 +258,7 @@ struct fm10k_intfc {#define FM10K_FLAG_RSS_FIELD_IPV6_UDP (u32)(1 << 2)#define FM10K_FLAG_RX_TS_ENABLED (u32)(1 << 3)#define FM10K_FLAG_SWPRI_CONFIG (u32)(1 << 4) +#define FM10K_FLAG_DEBUG_STATS (u32)(1 << 5)int xcast_mode;/* Tx fast path data */
@@ -277,6 +285,17 @@ struct fm10k_intfc {u64 rx_drops_nic;u64 rx_overrun_pf;u64 rx_overrun_vf; + +/* Debug Statistics */ +u64 hw_sm_mbx_full; +u64 hw_csum_tx_good; +u64 hw_csum_rx_good; +u64 rx_switch_errors; +u64 rx_drops; +u64 rx_pp_errors; +u64 rx_link_errors; +u64 rx_length_errors; +u32 tx_timeout_count;/* RX */
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c +184 -40
307 lines not on this page · raw message
drivers/net/ethernet/intel/fm10k/fm10k_iov.c +4 -1
@@ -137,8 +137,11 @@ process_mbx: }/* guarantee we have free space in the SM mailbox */ -if (!hw->mbx.ops.tx_ready (&hw->mbx,FM10K_VFMBX_MSG_MTU )) +if (!hw->mbx.ops.tx_ready (&hw->mbx,FM10K_VFMBX_MSG_MTU )) { +/* keep track of how many times this occurs */ + interface->hw_sm_mbx_full++;break ; + }/* cleanup mailbox and process received messages */ mbx->ops.process (hw, mbx);
drivers/net/ethernet/intel/fm10k/fm10k_main.c +15 -0
@@ -398,6 +398,8 @@ static inline void fm10k_rx_checksum(struct fm10k_ring *ring,return ; skb->ip_summed =CHECKSUM_UNNECESSARY ; + + ring->rx_stats.csum_good++; }#define FM10K_RSS_L4_TYPES_MASK \
@@ -553,6 +555,18 @@ static bool fm10k_cleanup_headers(struct fm10k_ring *rx_ring, {if (unlikely ((fm10k_test_staterr (rx_desc,FM10K_RXD_STATUS_RXE )))) { +#define FM10K_TEST_RXD_BIT (rxd, bit) \ + ((rxd)->w.csum_err & cpu_to_le16(bit)) +if (FM10K_TEST_RXD_BIT (rx_desc,FM10K_RXD_ERR_SWITCH_ERROR )) + rx_ring->rx_stats.switch_errors++; +if (FM10K_TEST_RXD_BIT (rx_desc,FM10K_RXD_ERR_NO_DESCRIPTOR )) + rx_ring->rx_stats.drops++; +if (FM10K_TEST_RXD_BIT (rx_desc,FM10K_RXD_ERR_PP_ERROR )) + rx_ring->rx_stats.pp_errors++; +if (FM10K_TEST_RXD_BIT (rx_desc,FM10K_RXD_ERR_SWITCH_READY )) + rx_ring->rx_stats.link_errors++; +if (FM10K_TEST_RXD_BIT (rx_desc,FM10K_RXD_ERR_TOO_BIG )) + rx_ring->rx_stats.length_errors++;dev_kfree_skb_any (skb); rx_ring->rx_stats.errors++;return true;
@@ -878,6 +892,7 @@ static void fm10k_tx_csum(struct fm10k_ring *tx_ring,/* update TX checksum flag */ first->tx_flags |=FM10K_TX_FLAGS_CSUM ; + tx_ring->tx_stats.csum_good++; no_csum:/* populate Tx descriptor header size and mss */
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +18 -0
@@ -328,6 +328,9 @@ void fm10k_update_stats(struct fm10k_intfc *interface) {struct net_device_stats *net_stats = &interface->netdev->stats;struct fm10k_hw *hw = &interface->hw; +u64 hw_csum_tx_good =0 , hw_csum_rx_good =0 , rx_length_errors =0 ; +u64 rx_switch_errors =0 , rx_drops =0 , rx_pp_errors =0 ; +u64 rx_link_errors =0 ;u64 rx_errors =0 , rx_csum_errors =0 , tx_csum_errors =0 ;u64 restart_queue =0 , tx_busy =0 , alloc_failed =0 ;u64 rx_bytes_nic =0 , rx_pkts_nic =0 , rx_drops_nic =0 ;
@@ -347,6 +350,7 @@ void fm10k_update_stats(struct fm10k_intfc *interface) tx_csum_errors += tx_ring->tx_stats.csum_err; bytes += tx_ring->stats.bytes; pkts += tx_ring->stats.packets; + hw_csum_tx_good += tx_ring->tx_stats.csum_good; } interface->restart_queue = restart_queue;
@@ -354,6 +358,8 @@ void fm10k_update_stats(struct fm10k_intfc *interface) net_stats->tx_bytes = bytes; net_stats->tx_packets = pkts; interface->tx_csum_errors = tx_csum_errors; + interface->hw_csum_tx_good = hw_csum_tx_good; +/* gather some stats to the interface struct that are per queue */ for (bytes =0 , pkts =0 , i =0 ; i < interface->num_rx_queues; i++) {struct fm10k_ring *rx_ring = interface->rx_ring[i];
@@ -363,12 +369,24 @@ void fm10k_update_stats(struct fm10k_intfc *interface) alloc_failed += rx_ring->rx_stats.alloc_failed; rx_csum_errors += rx_ring->rx_stats.csum_err; rx_errors += rx_ring->rx_stats.errors; + hw_csum_rx_good += rx_ring->rx_stats.csum_good; + rx_switch_errors += rx_ring->rx_stats.switch_errors; + rx_drops += rx_ring->rx_stats.drops; + rx_pp_errors += rx_ring->rx_stats.pp_errors; + rx_link_errors += rx_ring->rx_stats.link_errors; + rx_length_errors += rx_ring->rx_stats.length_errors; } net_stats->rx_bytes = bytes; net_stats->rx_packets = pkts; interface->alloc_failed = alloc_failed; interface->rx_csum_errors = rx_csum_errors; + interface->hw_csum_rx_good = hw_csum_rx_good; + interface->rx_switch_errors = rx_switch_errors; + interface->rx_drops = rx_drops; + interface->rx_pp_errors = rx_pp_errors; + interface->rx_link_errors = rx_link_errors; + interface->rx_length_errors = rx_length_errors; hw->mac.ops.update_hw_stats (hw, &interface->stats);
drivers/net/ethernet/intel/fm10k/fm10k_type.h +6 -0
@@ -762,6 +762,12 @@ enum fm10k_rxdesc_xc {#define FM10K_RXD_STATUS_L4E 0x4000/* L4 csum error */ #define FM10K_RXD_STATUS_IPE 0x8000/* IPv4 csum error */ +#define FM10K_RXD_ERR_SWITCH_ERROR 0x0001/* Switch found bad packet */ +#define FM10K_RXD_ERR_NO_DESCRIPTOR 0x0002/* No descriptor available */ +#define FM10K_RXD_ERR_PP_ERROR 0x0004/* RAM error during processing */ +#define FM10K_RXD_ERR_SWITCH_READY 0x0008/* Link transition mid-packet */ +#define FM10K_RXD_ERR_TOO_BIG 0x0010/* Pkt too big for single buf */ +struct fm10k_ftag {__be16 swpri_type_user;__be16 vlan;
Signature · 1 line
2.4.3
PATCH 6/10 fm10k: send traffic on default vid to vlan device if we have one
In reply to Jacob KellerThis patch ensures that vlan traffic on the default vid will go to the corresponding vlan device if it exists. To do this, mask the rx_ring vid if we have an active vlan on that vid.
For this to work correctly, we need to update fm10k_process_skb_fields to correctly mask off the VLAN_PRIO_MASK bits and compare them separately, otherwise we incorrectly compare the priority bits with the cleared flag. This also happens to fix a related bug where having priority bits set causes us to incorrectly classify traffic.
-rc1
* Fix fm10k_process_skb_fields
--- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 5 ++++- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 12 ++++++++++++ drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/fm10k/fm10k_main.c +4 -1
@@ -499,8 +499,11 @@ static unsigned int fm10k_process_skb_fields(struct fm10k_ring *rx_ring,if (rx_desc->w.vlan) {u16 vid =le16_to_cpu (rx_desc->w.vlan); -if (vid != rx_ring->vid) +if ((vid &VLAN_VID_MASK ) != rx_ring->vid)__vlan_hwaccel_put_tag (skb,htons (ETH_P_8021Q ), vid); +else if (vid &VLAN_PRIO_MASK ) +__vlan_hwaccel_put_tag (skb,htons (ETH_P_8021Q ), + vid &VLAN_PRIO_MASK ); }fm10k_type_trans (rx_ring, rx_desc, skb);
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +12 -0
@@ -758,6 +758,7 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)struct fm10k_intfc *interface =netdev_priv (netdev);struct fm10k_hw *hw = &interface->hw;s32 err; +int i;/* updates do not apply to VLAN 0 */ if (!vid)
@@ -775,6 +776,17 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)if (!set)clear_bit (vid, interface->active_vlans); +/* disable the default vid on ring if we have an active vlan */ +for (i =0 ; i < interface->num_rx_queues; i++) { +struct fm10k_ring *rx_ring = interface->rx_ring[i]; +u16 rx_vid = rx_ring->vid & (VLAN_N_VID -1 ); + +if (test_bit (rx_vid, interface->active_vlans)) + rx_ring->vid |=FM10K_VLAN_CLEAR ; +else + rx_ring->vid &= ~FM10K_VLAN_CLEAR ; + } +/* Do not remove default VID related entries from VLAN and MAC tables */ if (!set && vid == hw->mac.default_vid)return 0 ;
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +4 -0
@@ -694,6 +694,10 @@ static void fm10k_configure_rx_ring(struct fm10k_intfc *interface,/* assign default VLAN to queue */ ring->vid = hw->mac.default_vid; +/* if we have an active VLAN, disable default vid */ +if (test_bit (hw->mac.default_vid, interface->active_vlans)) + ring->vid |=FM10K_VLAN_CLEAR ; +/* Map interrupt */ if (ring->q_vector) { rxint = ring->q_vector->v_idx +NON_Q_VECTORS (hw);
Signature · 1 line
2.4.3
PATCH 7/10 fm10k: TRIVIAL fix typo in fm10k_netdev.c
In reply to Jacob Keller--- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +1 -1
@@ -1048,7 +1048,7 @@ void fm10k_restore_rx_state(struct fm10k_intfc *interface) vid, true, 0); } -/* update xcast mode before syncronizing addresses */ +/* update xcast mode before synchronizing addresses */ hw->mac.ops.update_xcast_mode (hw, glort, xcast_mode);/* synchronize all of the addresses */
Signature · 1 line
2.4.3
PATCH 8/10 fm10k: re-enable VF after a full reset on detection of a Malicious event
In reply to Jacob KellerModify behavior of Malicious Driver Detection events. Presently, the hardware disables the VF queues and re-assigns them to the PF. This causes the VF in question to continuously Tx hang, because it assumes that it can transmit over the queues in question. For transient events, this results in continuous logging of malicious events.
New behavior is to reset the LPORT and VF state, so that the VF will have to reset and re-enable itself. This does mean that malicious VFs will possibly be able to continue and attempt malicious events again. However, it is expected that system administrators will step in and manually remove or disable the VF in question.
--- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 30 ++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +28 -2
@@ -896,10 +896,12 @@ void fm10k_netpoll(struct net_device *netdev)#endif #define FM10K_ERR_MSG (type) case (type): error = #type; break -static void fm10k_print_fault (struct fm10k_intfc *interface,int type, +static void fm10k_handle_fault (struct fm10k_intfc *interface,int type,struct fm10k_fault *fault) {struct pci_dev *pdev = interface->pdev; +struct fm10k_hw *hw = &interface->hw; +struct fm10k_iov_data *iov_data = interface->iov_data;char *error;switch (type) {
@@ -953,6 +955,30 @@ static void fm10k_print_fault(struct fm10k_intfc *interface, int type,"%s Address: 0x%llx SpecInfo: 0x%x Func: %02x.%0x\n" , error, fault->address, fault->specinfo, PCI_SLOT(fault->func), PCI_FUNC(fault->func)); + +/* For VF faults, clear out the respective LPORT, reset the queue +* resources, and then reconnect to the mailbox. This allows the +* VF in question to resume behavior. For transient faults that are +* the result of non-malicious behavior this will log the fault and +* allow the VF to resume functionality. Obviously for malicious VFs +* they will be able to attempt malicious behavior again. In this +* case, the system administrator will need to step in and manually +* remove or disable the VF in question. +*/ +if (fault->func && iov_data) { +int vf = fault->func -1 ; +struct fm10k_vf_info *vf_info = &iov_data->vf_info[vf]; + + hw->iov.ops.reset_lport (hw, vf_info); + hw->iov.ops.reset_resources (hw, vf_info); + +/* reset_lport disables the VF, so re-enable it */ + hw->iov.ops.set_lport (hw, vf_info, vf, +FM10K_VF_FLAG_MULTI_CAPABLE ); + +/* reset_resources will disconnect from the mbx */ + vf_info->mbx.ops.connect (hw, &vf_info->mbx); + } }static void fm10k_report_fault (struct fm10k_intfc *interface,u32 eicr)
@@ -976,7 +1002,7 @@ static void fm10k_report_fault(struct fm10k_intfc *interface, u32 eicr)continue ; } -fm10k_print_fault (interface, type, &fault); +fm10k_handle_fault (interface, type, &fault); } }
Signature · 1 line
2.4.3
PATCH 9/10 fm10k: Only trigger data path reset if fabric is up
In reply to Jacob KellerFrom: Alexander Duyck <[email protected]>
This change makes it so that we only trigger the data path reset if the fabric is ready to handle traffic. The general idea is to avoid triggering the reset unless the switch API is ready for us. Otherwise we can just postpone the reset until we receive a switch ready notification.
--- drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/fm10k/fm10k_pf.c +6 -0
@@ -59,6 +59,11 @@ static s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)if (reg & (FM10K_DMA_CTRL_TX_ACTIVE |FM10K_DMA_CTRL_RX_ACTIVE ))return FM10K_ERR_DMA_PENDING ; +/* verify the switch is ready for reset */ + reg =fm10k_read_reg (hw,FM10K_DMA_CTRL2 ); +if (!(reg &FM10K_DMA_CTRL2_SWITCH_READY )) + goto out; +/* Inititate data path reset */ reg |=FM10K_DMA_CTRL_DATAPATH_RESET ;fm10k_write_reg (hw,FM10K_DMA_CTRL , reg);
@@ -72,6 +77,7 @@ static s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)if (!(reg &FM10K_IP_NOTINRESET )) err =FM10K_ERR_RESET_FAILED ; +out:return err; }
Signature · 1 line
2.4.3
PATCH 10/10 fm10k: fix iov_msg_mac_vlan_pf VID checks
In reply to Jacob KellerThe VF will send a message to request multicast addresses with the default vid. In the current code, if the PF has statically assigned a VLAN to a VF, then the VF will not get the multicast addresses. Fix up all of the various vlan messages to use identical checks (since each check was different). Also use set as a variable, so that it simplifies our check for whether vlan matches the pf_vid.
The new logic will allow set of a vlan if it is zero, automatically converting to the default vid. Otherwise it will allow setting the PF vid, or any VLAN if PF has not statically assigned a VLAN. This is consistent behavior, and allows VF to request either 0 or the default_vid without silently failing.
Note that we need the check for zero since VFs might not get the default VID message in time to actually request non-zero VLANs.
- rc1
* Create function fm10k_iov_select_vid to remove code duplication
--- drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 85 ++++++++++++++++++----------- 1 file changed, 52 insertions(+), 33 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_pf.c +52 -33
@@ -1155,6 +1155,24 @@ s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 **results, }/** +* fm10k_iov_select_vid - Select correct default vid +* @hw: Pointer to hardware structure +* @vid: vid to correct +* +* Will report an error if vid is out of range. For vid = 0, it will return +* either the pf_vid or sw_vid depending on which one is set. +*/ +static inline s32 fm10k_iov_select_vid (struct fm10k_vf_info *vf_info,u16 vid) +{ +if (!vid) +return vf_info->pf_vid ? vf_info->pf_vid : vf_info->sw_vid; +else if (vf_info->pf_vid && vid != vf_info->pf_vid) +return FM10K_ERR_PARAM ; +else +return vid; +} + +/** * fm10k_iov_msg_mac_vlan_pf - Message handler for MAC/VLAN request from VF * @hw: Pointer to hardware structure * @results: Pointer array to message, results[0] is pointer to message
@@ -1168,9 +1186,10 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results, struct fm10k_mbx_info *mbx) {struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx; -int err =0 ;u8 mac[ETH_ALEN ];u32 *result; +int err =0 ; +bool set;u16 vlan;u32 vid;
@@ -1186,19 +1205,21 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,if (err)return err; -/* if VLAN ID is 0, set the default VLAN ID instead of 0 */ -if (!vid || (vid ==FM10K_VLAN_CLEAR )) { -if (vf_info->pf_vid) - vid |= vf_info->pf_vid; -else - vid |= vf_info->sw_vid; - }else if (vid != vf_info->pf_vid) { +/* verify upper 16 bits are zero */ +if (vid >>16 )return FM10K_ERR_PARAM ; - } + + set = !(vid &FM10K_VLAN_CLEAR ); + vid &= ~FM10K_VLAN_CLEAR ; + + err =fm10k_iov_select_vid (vf_info, vid); +if (err <0 ) +return err; +else + vid = err;/* update VSI info for VF in regards to VLAN table */ - err = hw->mac.ops.update_vlan (hw, vid, vf_info->vsi, - !(vid &FM10K_VLAN_CLEAR )); + err = hw->mac.ops.update_vlan (hw, vid, vf_info->vsi, set); }if (!err && !!results[FM10K_MAC_VLAN_MSG_MAC ]) {
@@ -1214,19 +1235,18 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results, memcmp(mac, vf_info->mac, ETH_ALEN))return FM10K_ERR_PARAM ; -/* if VLAN ID is 0, set the default VLAN ID instead of 0 */ -if (!vlan || (vlan ==FM10K_VLAN_CLEAR )) { -if (vf_info->pf_vid) - vlan |= vf_info->pf_vid; -else - vlan |= vf_info->sw_vid; - }else if (vf_info->pf_vid) { -return FM10K_ERR_PARAM ; - } + set = !(vlan &FM10K_VLAN_CLEAR ); + vlan &= ~FM10K_VLAN_CLEAR ; + + err =fm10k_iov_select_vid (vf_info, vlan); +if (err <0 ) +return err; +else + vlan = err;/* notify switch of request for new unicast address */ - err = hw->mac.ops.update_uc_addr (hw, vf_info->glort, mac, vlan, - !(vlan &FM10K_VLAN_CLEAR ),0 ); + err = hw->mac.ops.update_uc_addr (hw, vf_info->glort, + mac, vlan, set,0 ); }if (!err && !!results[FM10K_MAC_VLAN_MSG_MULTICAST ]) {
@@ -1241,19 +1261,18 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,if (!(vf_info->vf_flags &FM10K_VF_FLAG_MULTI_ENABLED ))return FM10K_ERR_PARAM ; -/* if VLAN ID is 0, set the default VLAN ID instead of 0 */ -if (!vlan || (vlan ==FM10K_VLAN_CLEAR )) { -if (vf_info->pf_vid) - vlan |= vf_info->pf_vid; -else - vlan |= vf_info->sw_vid; - }else if (vf_info->pf_vid) { -return FM10K_ERR_PARAM ; - } + set = !(vlan &FM10K_VLAN_CLEAR ); + vlan &= ~FM10K_VLAN_CLEAR ; + + err =fm10k_iov_select_vid (vf_info, vlan); +if (err <0 ) +return err; +else + vlan = err;/* notify switch of request for new multicast address */ - err = hw->mac.ops.update_mc_addr (hw, vf_info->glort, mac, vlan, - !(vlan &FM10K_VLAN_CLEAR )); + err = hw->mac.ops.update_mc_addr (hw, vf_info->glort, + mac, vlan, set); }return err;
Signature · 1 line
2.4.3