net/fm10k: update base code.
cover net/fm10k: update base code.
The patch set update to latest fm10k base code, there is no significent features be added, but include couple enhancement like clean up the logic for tlv attr parse, improve VF multi-bit VLAN handle etc, also with some code/comment clean as well.
Qi Zhang (17):
net/fm10k/base: add a flag to indicate VF trust mode net/fm10k/base: reset multicaset mode when deleting lport net/fm10k/base: expose macros needed by DPDK net/fm10k/base: add error code
net/fm10k/base: clean up the logic
net/fm10k/base: add new item to lport msg attr net/fm10k/base: use 8 bit notation instead of 10bit notation net/fm10k/base: use different name for override bit net/fm10k/base: update comment regarding reserved bits check net/fm10k/base: improve VF's multi-bit VLAN update requests net/fm10k/base: enable lport map request net/fm10k/base: add macros for global interrupt net/fm10k/base: don't stop reset
net/fm10k/base: add marcro for geneve tunnel net/fm10k/base: improve re-map queues handle net/fm10k/base: replace marcos
net/fm10k/base: equest reset when mbx->state changes
drivers/net/fm10k/base/fm10k_common.c | 11 ++- drivers/net/fm10k/base/fm10k_mbx.c | 10 ++- drivers/net/fm10k/base/fm10k_mbx.h | 2 + drivers/net/fm10k/base/fm10k_osdep.h | 17 ----- drivers/net/fm10k/base/fm10k_pf.c | 140 ++++++++++++++++++++-------------- drivers/net/fm10k/base/fm10k_pf.h | 2 + drivers/net/fm10k/base/fm10k_tlv.c | 16 ++-- drivers/net/fm10k/base/fm10k_type.h | 71 +++++++++++++++-- drivers/net/fm10k/base/fm10k_vf.c | 24 +++--- 9 files changed, 189 insertions(+), 104 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/17 net/fm10k/base: add a flag to indicate VF trust mode
Adds boolean flag in fm10k_vf_info to support configuring a VF to be trusted.
--- drivers/net/fm10k/base/fm10k_type.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/fm10k/base/fm10k_type.h +3 -0
@@ -676,6 +676,9 @@ struct fm10k_vf_info {u8 vf_flags;/* flags indicating what modes * are supported for the port */ +#ifndef NO_FM10K_VF_TRUSTED_MODE +bool trusted;/* VF trust mode */ +#endif };#define FM10K_VF_FLAG_ALLMULTI_CAPABLE (u8)(BIT(FM10K_XCAST_MODE_ALLMULTI))
Signature · 1 line
2.9.3
PATCH 2/17 net/fm10k/base: reset multicaset mode when deleting lport
In reply to Qi ZhangDeleting lport when multicast mod is configured to FM10K_XCAST_MODE_ALLMULTI or FM10K_XCAST_MODE_PROMISC will result in generating orphaned multicast-group entries in the switch manager.
Before deleting the lport, reset multicast mode to FM10K_XCAST_MODE_NONE to flush out these multicast-group entries.
--- drivers/net/fm10k/base/fm10k_pf.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/fm10k/base/fm10k_pf.c +4 -0
@@ -536,6 +536,10 @@ STATIC s32 fm10k_update_lport_state_pf(struct fm10k_hw *hw, u16 glort,if (!fm10k_glort_valid_pf (hw, glort))return FM10K_ERR_PARAM ; +/* reset multicast mode if deleting lport */ +if (!enable) +fm10k_update_xcast_mode_pf (hw, glort,FM10K_XCAST_MODE_NONE ); +/* construct the lport message from the 2 pieces of data we have */ lport_msg = ((u32 )count <<16 ) | glort;
Signature · 1 line
2.9.3
Re: [PATCH 02/17] net/fm10k/base: reset multicaset mode when deleting lport
On 3/3/2017 3:17 AM, Qi Zhang wrote:
patch title: s/multicaset/multicast
Quoted 9 lines
Deleting lport when multicast mod is configured to
FM10K_XCAST_MODE_ALLMULTIorFM10K_XCAST_MODE_PROMISCwill result in generating orphaned multicast-group entries in the switch manager.
Before deleting the lport, reset multicast mode toFM10K_XCAST_MODE_NONEto flush out these multicast-group entries.Signed-off-by Qi Zhang <[email protected]>
<...>
PATCH 3/17 net/fm10k/base: expose macros needed by DPDK
In reply to Qi ZhangSome defines were previously wrapped to strip them from opensource driver builds, but these are required by DPDK. Change the wrapping of these so that the DPDK gets them as long as DPDK_SUPPORT is correctly added as a strip flag, while we can remove the reduandant ones in fm10k_osdep.h.
--- drivers/net/fm10k/base/fm10k_osdep.h | 17 ------------ drivers/net/fm10k/base/fm10k_type.h | 50 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 17 deletions(-)
drivers/net/fm10k/base/fm10k_osdep.h +0 -17
@@ -163,23 +163,6 @@ typedef int bool;#define FM10K_RXD_PKTTYPE_MASK 0x03F0#define FM10K_RXD_PKTTYPE_SHIFT 4 -enum fm10k_rdesc_pkt_type { -/* L3 type */ -FM10K_PKTTYPE_OTHER =0x00 , -FM10K_PKTTYPE_IPV4 =0x01 , -FM10K_PKTTYPE_IPV4_EX =0x02 , -FM10K_PKTTYPE_IPV6 =0x03 , -FM10K_PKTTYPE_IPV6_EX =0x04 , - -/* L4 type */ -FM10K_PKTTYPE_TCP =0x08 , -FM10K_PKTTYPE_UDP =0x10 , -FM10K_PKTTYPE_GRE =0x18 , -FM10K_PKTTYPE_VXLAN =0x20 , -FM10K_PKTTYPE_NVGRE =0x28 , -FM10K_PKTTYPE_GENEVE =0x30 -}; -#define FM10K_RXD_STATUS_IPCS 0x0008/* Indicates IPv4 csum */ #define FM10K_RXD_STATUS_HBO 0x0400/* header buffer overrun */
drivers/net/fm10k/base/fm10k_type.h +50 -0
103 lines not on this page · raw message
Signature · 1 line
2.9.3
Re: [PATCH 03/17] net/fm10k/base: expose macros needed by DPDK
Quoted 4 lines · Qi Zhang
Some defines were previously wrapped to strip them from opensource driver builds, but these are required by DPDK. Change the wrapping of these so that the DPDK gets them as long as
DPDK_SUPPORTis correctly added as a strip flag, while we can remove the reduandant ones infm10k_osdep.h.
s/reduandant/redundant
Quoted 2 lines
Signed-off-by Qi Zhang <[email protected]>
<...>
Quoted 11 lines
drivers/net/fm10k/base/fm10k_type.h +1
-0@@ -40,6 +40,9 @@ struct fm10k_hw;#include "fm10k_osdep.h" #include "fm10k_mbx.h" +#if !defined(EXTERNAL_RELEASE ) || defined(DPDK_SUPPORT )From commit log what I understand is, released code is coming from a
shared code by some #ifdefs stripped based on a strip flag configuration.
If that is the case, these #ifdefs should not be released code, they should be stripped but only #defines should remain, is this correct?
Quoted 5 lines
drivers/net/fm10k/base/fm10k_type.h +2
-0+#define FM10K_INTEL_VENDOR_ID 0x8086 +#endif #define FM10K_DEV_ID_PF 0x15A4#define FM10K_DEV_ID_VF 0x15A5#ifdef BOULDER_RAPIDS_HW
<...>
PATCH 4/17 net/fm10k/base: add error code
In reply to Qi ZhangAdd API error code for when PEP is not scheduled.
--- drivers/net/fm10k/base/fm10k_pf.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/fm10k/base/fm10k_pf.h +2 -0
@@ -91,6 +91,8 @@ enum fm10k_pf_tlv_attr_id_v1 {#define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16#define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16 +#define FM10K_MSG_ERR_PEP_NOT_SCHEDULED 280 +/* The following data structures are overlayed directly onto TLV mailbox * messages, and must not break 4 byte alignment. Ensure the structures line * up correctly as per their TLV definition.
Signature · 1 line
2.9.3
PATCH 5/17 net/fm10k/base: clean up the logic
In reply to Qi ZhangClean up the logic in fm10k_tlv_attr_parse, we should not reply on that FM10K_NOT_IMPLEMENTED is greater than zero, as this can easily cause confusion. The patch also correct a minor document error.
--- drivers/net/fm10k/base/fm10k_tlv.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/fm10k/base/fm10k_tlv.c +9 -7
@@ -520,7 +520,8 @@ STATIC s32 fm10k_tlv_attr_validate(u32 *attr,* up into an array of pointers stored in results. The function will * return FM10K_ERR_PARAM on any input or message error, * FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array -* and 0 on success. +* and 0 on success. Any attributes not found in tlv_attr will be silently +* ignored. **/ static s32 fm10k_tlv_attr_parse (u32 *attr,u32 **results,const struct fm10k_tlv_attr *tlv_attr)
@@ -559,14 +560,15 @@ static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,while (offset < len) { attr_id = *attr &FM10K_TLV_ID_MASK ; -if (attr_id <FM10K_TLV_RESULTS_MAX ) - err =fm10k_tlv_attr_validate (attr, tlv_attr); -else - err =FM10K_NOT_IMPLEMENTED ; +if (attr_id >=FM10K_TLV_RESULTS_MAX ) +return FM10K_NOT_IMPLEMENTED ; -if (err <0 ) + err =fm10k_tlv_attr_validate (attr, tlv_attr); +if (err ==FM10K_NOT_IMPLEMENTED ) + ;/* silently ignore non-implemented attributes */ +else if (err)return err; -if (!err) +else results[attr_id] = attr;/* update offset */
Signature · 1 line
2.9.3
PATCH 6/17 net/fm10k/base: add new item to lport msg attr
In reply to Qi ZhangAdd FM10K_PF_ATTR_ID_ERR, since it is possible for the switch manager to send out an error message indicating status of the LPORT_MAP due to zero allocated bandwidth.
--- drivers/net/fm10k/base/fm10k_pf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/fm10k/base/fm10k_pf.c +2 -0
@@ -1705,6 +1705,8 @@ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)/* This structure defines the attibutes to be parsed below */ const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[] = { +FM10K_TLV_ATTR_LE_STRUCT (FM10K_PF_ATTR_ID_ERR , +sizeof (struct fm10k_swapi_error )),FM10K_TLV_ATTR_U32 (FM10K_PF_ATTR_ID_LPORT_MAP ),FM10K_TLV_ATTR_LAST };
Signature · 1 line
2.9.3
PATCH 7/17 net/fm10k/base: use 8 bit notation instead of 10bit notation
In reply to Qi ZhangThe diagram represents bit layout of the multi-bit VLAN update message format. Re-draw the numbers using base 8, and mark the bit values every 8 bits at the top. This should make it more easy to grasp the table quickly.
--- drivers/net/fm10k/base/fm10k_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +2 -2
@@ -255,8 +255,8 @@ STATIC s32 fm10k_update_vlan_pf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)/* VLAN multi-bit write: * The multi-bit write has several parts to it. -* 3 2 1 0 -* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +* 24 16 8 0 +* 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | RSVD0 | Length |C|RSVD0| VLAN ID | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Signature · 1 line
2.9.3
Re: [PATCH 07/17] net/fm10k/base: use 8 bit notation instead of 10bit notation
Quoted 4 lines · Qi Zhang
The diagram represents bit layout of the multi-bit VLAN update message format. Re-draw the numbers using base 8, and mark the bit values every 8 bits at the top. This should make it more easy to grasp the table quickly.
Can you please somehow mention in the patch title that this is a comment update.
Quoted 2 lines
Signed-off-by Qi Zhang <[email protected]>
<...>
PATCH 8/17 net/fm10k/base: use different name for override bit
In reply to Qi ZhangUse a new #define FM10K_VLAN_OVERRIDE even though we're using the exact same bit. The reason for this is clarity in the code, otherwise you can read FM10K_VLAN_CLEAR and think it should be removed. Also add a comment explaining why the FM10K_VLAN_OVERRIDE bit is set.
--- drivers/net/fm10k/base/fm10k_pf.c | 12 ++++++------ drivers/net/fm10k/base/fm10k_type.h | 1 + drivers/net/fm10k/base/fm10k_vf.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +6 -6
@@ -912,13 +912,13 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw, vf_q_idx =fm10k_vf_queue_index (hw, vf_idx); qmap_idx = qmap_stride * vf_idx; -/* MAP Tx queue back to 0 temporarily, and disable it */ -FM10K_WRITE_REG (hw,FM10K_TQMAP (qmap_idx),0 ); -FM10K_WRITE_REG (hw,FM10K_TXDCTL (vf_q_idx),0 ); - -/* determine correct default VLAN ID */ +/* Determine correct default VLAN ID. The FM10K_VLAN_OVERRIDE bit is +* used here to indicate to the VF that it will not have privilege to +* write VLAN_TABLE. All policy is enforced on the PF but this allows +* the VF to correctly report errors to userspace rqeuests. +*/ if (vf_info->pf_vid) - vf_vid = vf_info->pf_vid |FM10K_VLAN_CLEAR ; + vf_vid = vf_info->pf_vid |FM10K_VLAN_OVERRIDE ;else vf_vid = vf_info->sw_vid;
drivers/net/fm10k/base/fm10k_type.h +1 -0
@@ -407,6 +407,7 @@ struct fm10k_hw;#define FM10K_VLAN_TABLE_VSI_MAX 64#define FM10K_VLAN_LENGTH_SHIFT 16#define FM10K_VLAN_CLEAR BIT(15) +#define FM10K_VLAN_OVERRIDE FM10K_VLAN_CLEAR#define FM10K_VLAN_ALL \ ((FM10K_VLAN_TABLE_VID_MAX - 1) << FM10K_VLAN_LENGTH_SHIFT)
drivers/net/fm10k/base/fm10k_vf.c +1 -1
@@ -268,7 +268,7 @@ s32 fm10k_msg_mac_vlan_vf(struct fm10k_hw *hw, u32 **results,memcpy (hw->mac.perm_addr, perm_addr,ETH_ALEN ); hw->mac.default_vid = vid & (FM10K_VLAN_TABLE_VID_MAX -1 ); - hw->mac.vlan_override = !!(vid &FM10K_VLAN_CLEAR ); + hw->mac.vlan_override = !!(vid &FM10K_VLAN_OVERRIDE );return FM10K_SUCCESS ; }
Signature · 1 line
2.9.3
PATCH 9/17 net/fm10k/base: update comment regarding reserved bits check
In reply to Qi ZhangThe original comment may be read incorrectly as referring to checking the *entire* length is zero. However, it merely checks only the reserved bits of both length and reserved in a small amount of code. Update the comment to indicate this is a clever trick and clearly spell out that it only checks the reserve bits.
--- drivers/net/fm10k/base/fm10k_vf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/fm10k/base/fm10k_vf.c +1 -1
@@ -225,7 +225,7 @@ STATIC s32 fm10k_update_vlan_vf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)if (vsi)return FM10K_ERR_PARAM ; -/* verify upper 4 bits of vid and length are 0 */ +/* clever trick to verify reserved bits in both vid and length */ if ((vid <<16 | vid) >>28 )return FM10K_ERR_PARAM ;
Signature · 1 line
2.9.3
PATCH 10/17 net/fm10k/base: improve VF's multi-bit VLAN update requests
In reply to Qi ZhangThe VF uses a multi-bit update request to clear unused VLANs whenever it resets. However, an accident in a previous refector broke multi-bit updates for VFs, due to misreading a comment in fm10k_vf.c and attempting to reduce code duplication. The problem occurs because a multi-bit request has a non-zero length, and the PF would simply drop any request with the upper 16 bits set. In addition, a multi-bit vlan update does not have a concept for "VLAN 0" as the single bit update does.
A previous revision of this patch resolved the issue by simply removing the upper 16 bit check and the iov_select_vid checks. However, this would remove the checks for default VID and for ensuring no other VLANs can be enabled except pf_vid when it has been set. To resolve that issue, this revision uses the iov_select_vid when we have a single-bit update, and denies any multi-bit update when the VLAN was administratively set by the PF. This should be ok since the PF properly updates VLAN_TABLE when it assigns the PF vid. This ensures that requests to add or "remove" the PF vid work as expected, but a rogue VF could not use the multi-bit update as a loophole to attempt receiving traffic on other VLANs.
--- drivers/net/fm10k/base/fm10k_pf.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +22 -8
@@ -1271,18 +1271,32 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,if (err)return err; -/* 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, (u16 )vid); -if (err <0 ) -return err; +/* if the length field has been set, this is a multi-bit +* update request. For multi-bit requests, simply disallow +* them when the pf_vid has been set. In this case, the PF +* should have already cleared the VLAN_TABLE, and if we +* allowed them, it could allow a rogue VF to receive traffic +* on a VLAN it was not assigned. In the single-bit case, we +* need to modify requests for VLAN 0 to use the default PF or +* SW vid when assigned. +*/ - vid = err; +if (vid >>16 ) { +/* prevent multi-bit requests when PF has +* administratively set the VLAN for this VF +*/ +if (vf_info->pf_vid) +return FM10K_ERR_PARAM ; + }else { + err =fm10k_iov_select_vid (vf_info, (u16 )vid); +if (err <0 ) +return err; + + vid = err; + }/* update VSI info for VF in regards to VLAN table */ err = hw->mac.ops.update_vlan (hw, vid, vf_info->vsi, set);
Signature · 1 line
2.9.3
Re: [PATCH 10/17] net/fm10k/base: improve VF's multi-bit VLAN update requests
Quoted 2 lines · Qi Zhang
The VF uses a multi-bit update request to clear unused VLANs whenever it resets. However, an accident in a previous refector broke multi-bit
s/refector/refactor
Quoted 19 lines
updates for VFs, due to misreading a comment in
fm10k_vf.cand attempting to reduce code duplication. The problem occurs because a multi-bit request has a non-zero length, and the PF would simply drop any request with the upper 16 bits set. In addition, a multi-bit vlan update does not have a concept for "VLAN 0" as the single bit update does.A previous revision of this patch resolved the issue by simply removing the upper 16 bit check and the
iov_select_vidchecks. However, this would remove the checks for default VID and for ensuring no other VLANs can be enabled exceptpf_vidwhen it has been set. To resolve that issue, this revision uses theiov_select_vidwhen we have a single-bit update, and denies any multi-bit update when the VLAN was administratively set by the PF. This should be ok since the PF properly updatesVLAN_TABLEwhen it assigns the PF vid. This ensures that requests to add or "remove" the PF vid work as expected, but a rogue VF could not use the multi-bit update as a loophole to attempt receiving traffic on other VLANs.Signed-off-by Qi Zhang <[email protected]>
<...>
PATCH 11/17 net/fm10k/base: enable lport map request
In reply to Qi ZhangIf the fm10k interface is brought up, but the switch manager software is not running, the driver will continuously request the lport map every few seconds in the base driver watchdog routine. Eventually after several minutes the switch mailbox Tx fifo will fill up and the mailbox will timeout, resulting in a reset. This reset will appear as if for no reason, and occurs regularly every few minutes until the switch manager software is loaded.
--- drivers/net/fm10k/base/fm10k_common.c | 8 ++++++-- drivers/net/fm10k/base/fm10k_pf.c | 17 ++++------------- drivers/net/fm10k/base/fm10k_type.h | 1 + 3 files changed, 11 insertions(+), 15 deletions(-)
drivers/net/fm10k/base/fm10k_common.c +6 -2
@@ -542,7 +542,7 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready) goto out;/* if we somehow dropped the Tx enable we should reset */ -if (hw->mac.tx_ready && !(txdctl &FM10K_TXDCTL_ENABLE )) { +if (mac->tx_ready && !(txdctl &FM10K_TXDCTL_ENABLE )) { ret_val =FM10K_ERR_RESET_REQUESTED ; goto out; }
@@ -558,8 +558,12 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready) goto out;/* interface cannot receive traffic without logical ports */ -if (mac->dglort_map ==FM10K_DGLORTMAP_NONE ) +if (mac->dglort_map ==FM10K_DGLORTMAP_NONE ) { +if (mac->ops.request_lport_map) + ret_val = mac->ops.request_lport_map (hw); + goto out; + }/* if we passed all the tests above then the switch is ready and we no * longer need to check for link
drivers/net/fm10k/base/fm10k_pf.c +4 -13
@@ -1688,13 +1688,12 @@ STATIC s32 fm10k_request_lport_map_pf(struct fm10k_hw *hw)* @hw: pointer to hardware structure * @switch_ready: pointer to boolean value that will record switch state * -* This funciton will check the DMA_CTRL2 register and mailbox in order +* This function will check the DMA_CTRL2 register and mailbox in order * to determine if the switch is ready for the PF to begin requesting * addresses and mapping traffic to the local interface. **/ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready) { -s32 ret_val =FM10K_SUCCESS ;u32 dma_ctrl2;DEBUGFUNC ("fm10k_get_host_state_pf" );
@@ -1702,19 +1701,10 @@ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)/* verify the switch is ready for interaction */ dma_ctrl2 =FM10K_READ_REG (hw,FM10K_DMA_CTRL2 );if (!(dma_ctrl2 &FM10K_DMA_CTRL2_SWITCH_READY )) - goto out; +return FM10K_SUCCESS ;/* retrieve generic host state info */ - ret_val =fm10k_get_host_state_generic (hw, switch_ready); -if (ret_val) - goto out; - -/* interface cannot receive traffic without logical ports */ -if (hw->mac.dglort_map ==FM10K_DGLORTMAP_NONE ) - ret_val =fm10k_request_lport_map_pf (hw); - -out: -return ret_val; +return fm10k_get_host_state_generic (hw, switch_ready); }/* This structure defines the attibutes to be parsed below */
@@ -2102,6 +2092,7 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw) mac->ops.set_dma_mask = &fm10k_set_dma_mask_pf; mac->ops.get_fault = &fm10k_get_fault_pf; mac->ops.get_host_state = &fm10k_get_host_state_pf; + mac->ops.request_lport_map = &fm10k_request_lport_map_pf; mac->ops.adjust_systime = &fm10k_adjust_systime_pf; mac->ops.notify_offset = &fm10k_notify_offset_pf; mac->ops.read_systime = &fm10k_read_systime_pf;
drivers/net/fm10k/base/fm10k_type.h +1 -0
@@ -611,6 +611,7 @@ 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 *); +s32 (*request_lport_map)(struct fm10k_hw *);#ifndef NO_IS_SLOT_APPROPRIATE_CHECK bool (*is_slot_appropriate)(struct fm10k_hw *);#endif
Signature · 1 line
2.9.3
PATCH 12/17 net/fm10k/base: add macros for global interrupt
In reply to Qi ZhangAdd two macros for global interrupt.
--- drivers/net/fm10k/base/fm10k_mbx.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/fm10k/base/fm10k_mbx.h +2 -0
@@ -54,6 +54,8 @@ struct fm10k_mbx_info;#define FM10K_MBX_ACK_INTERRUPT 0x00000010#define FM10K_MBX_INTERRUPT_ENABLE 0x00000020#define FM10K_MBX_INTERRUPT_DISABLE 0x00000040 +#define FM10K_MBX_GLOBAL_REQ_INTERRUPT 0x00000200 +#define FM10K_MBX_GLOBAL_ACK_INTERRUPT 0x00000400#define FM10K_MBICR (_n) ((_n) + 0x18840)#define FM10K_GMBX 0x18842
Signature · 1 line
2.9.3
PATCH 13/17 net/fm10k/base: don't stop reset
In reply to Qi ZhangDon't report FM10K_ERR_REQUESTS_PENDING when we fail to disable queues within the timeout. This can occur due to a hardware Tx hang, or when the switch ethernet fabric is resetting while we are transmitting traffic. It can sometimes take up to 500ms before the Tx DMA engine gives up. Instead, just skip the DMA engine check and perform a data-path reset anyways. Add a statistic counter to keep track of the number of resets occurring while we have pending DMA on the rings.
In order to prevent having to assign err = FM10K_SUCCESS, re-order the last few items of the reset_hw_pf function so that we don't perform "return err" at the end.
--- drivers/net/fm10k/base/fm10k_pf.c | 19 +++++++++---------- drivers/net/fm10k/base/fm10k_type.h | 1 + drivers/net/fm10k/base/fm10k_vf.c | 12 +++++++----- 3 files changed, 17 insertions(+), 15 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +9 -10
@@ -66,21 +66,21 @@ STATIC s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)/* shut down all rings */ err =fm10k_disable_queues_generic (hw,FM10K_MAX_QUEUES ); -if (err) +if (err ==FM10K_ERR_REQUESTS_PENDING ) { + hw->mac.reset_while_pending++; + goto force_reset; + }else if (err) {return err; + }/* Verify that DMA is no longer active */ reg =FM10K_READ_REG (hw,FM10K_DMA_CTRL );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; - +force_reset:/* Inititate data path reset */ - reg |=FM10K_DMA_CTRL_DATAPATH_RESET ; + reg =FM10K_DMA_CTRL_DATAPATH_RESET ;FM10K_WRITE_REG (hw,FM10K_DMA_CTRL , reg);/* Flush write and allow 100us for reset to complete */
@@ -90,10 +90,9 @@ STATIC s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)/* Verify we made it out of reset */ reg =FM10K_READ_REG (hw,FM10K_IP );if (!(reg &FM10K_IP_NOTINRESET )) - err =FM10K_ERR_RESET_FAILED ; +return FM10K_ERR_RESET_FAILED ; -out: -return err; +return FM10K_SUCCESS ; }/**
drivers/net/fm10k/base/fm10k_type.h +1 -0
@@ -654,6 +654,7 @@ struct fm10k_mac_info {bool tx_ready;u32 dglort_map;u8 itr_scale; +u64 reset_while_pending; };struct fm10k_swapi_table_info {
drivers/net/fm10k/base/fm10k_vf.c +7 -5
@@ -49,7 +49,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)/* we need to disable the queues before taking further steps */ err =fm10k_stop_hw_generic (hw); -if (err) +if (err && err !=FM10K_ERR_REQUESTS_PENDING )return err;/* If permanent address is set then we need to restore it */
@@ -82,7 +82,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)FM10K_WRITE_REG (hw,FM10K_TDLEN (i), tdlen); } -return FM10K_SUCCESS ; +return err; }/**
@@ -100,7 +100,9 @@ STATIC s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)/* shut down queues we own and reset DMA configuration */ err =fm10k_stop_hw_vf (hw); -if (err) +if (err ==FM10K_ERR_REQUESTS_PENDING ) + hw->mac.reset_while_pending++; +else if (err)return err;/* Inititate VF reset */
@@ -113,9 +115,9 @@ STATIC s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)/* Clear reset bit and verify it was cleared */ FM10K_WRITE_REG (hw,FM10K_VFCTRL ,0 );if (FM10K_READ_REG (hw,FM10K_VFCTRL ) &FM10K_VFCTRL_RST ) - err =FM10K_ERR_RESET_FAILED ; +return FM10K_ERR_RESET_FAILED ; -return err; +return FM10K_SUCCESS ; }/**
Signature · 1 line
2.9.3
PATCH 14/17 net/fm10k/base: add macro for geneve tunnel offload
In reply to Qi Zhangadd necessary macro to support geneve tunnel offload.
--- drivers/net/fm10k/base/fm10k_type.h | 1 + 1 file changed, 1 insertion(+)
drivers/net/fm10k/base/fm10k_type.h +1 -0
@@ -194,6 +194,7 @@ struct fm10k_hw;#define FM10K_DGLORTDEC_INNERRSS_ENABLE 0x08000000#define FM10K_TUNNEL_CFG 0x0040#define FM10K_TUNNEL_CFG_NVGRE_SHIFT 16 +#define FM10K_TUNNEL_CFG_GENEVE 0x0041#define FM10K_SWPRI_MAP (_n) ((_n) + 0x0050)#define FM10K_SWPRI_MAX 16#define FM10K_RSSRK (_n, _m) (((_n) * 0x10) + (_m) + 0x0800)
Signature · 1 line
2.9.3
PATCH 15/17 net/fm10k/base: improve re-map queues handle
In reply to Qi ZhangAvoid potential FUM fault errors on a VF when updating MAC address and VLAN information. Only use the register flow when the mailbox is disconnected, by checking if the enqueue_tx returns FM10K_MBX_ERR_NO_MBX. If the mailbox message can be sent, there is no reason to bother with the register writes which are only intended to be used during VF driver initialization.
--- drivers/net/fm10k/base/fm10k_common.c | 3 +++ drivers/net/fm10k/base/fm10k_pf.c | 42 ++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 13 deletions(-)
drivers/net/fm10k/base/fm10k_common.c +3 -0
@@ -230,6 +230,9 @@ s32 fm10k_disable_queues_generic(struct fm10k_hw *hw, u16 q_cnt)/* clear tx_ready to prevent any false hits for reset */ hw->mac.tx_ready = false; +if (FM10K_REMOVED (hw->hw_addr)) +return FM10K_SUCCESS ; +/* clear the enable bit for all rings */ for (i =0 ; i < q_cnt; i++) { reg =FM10K_READ_REG (hw,FM10K_TXDCTL (i));
drivers/net/fm10k/base/fm10k_pf.c +29 -13
54 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 16/17 net/fm10k/base: replace macros
In reply to Qi ZhangOther shared code bases are planning on using IS_MULTICAST_ETHER_ADDR and friends without leaving the driver name in the macro.
Remove reference to FM10K here so that we can re-use the specific compat flags from Linux.
--- drivers/net/fm10k/base/fm10k_pf.c | 10 +++++----- drivers/net/fm10k/base/fm10k_type.h | 14 +++++++------- drivers/net/fm10k/base/fm10k_vf.c | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +5 -5
@@ -411,7 +411,7 @@ STATIC s32 fm10k_update_uc_addr_pf(struct fm10k_hw *hw, u16 glort,DEBUGFUNC ("fm10k_update_uc_addr_pf" );/* verify MAC address is valid */ -if (!FM10K_IS_VALID_ETHER_ADDR (mac)) +if (!IS_VALID_ETHER_ADDR (mac))return FM10K_ERR_PARAM ;return fm10k_update_xc_addr_pf (hw, glort, mac, vid, add, flags);
@@ -434,7 +434,7 @@ STATIC s32 fm10k_update_mc_addr_pf(struct fm10k_hw *hw, u16 glort,DEBUGFUNC ("fm10k_update_mc_addr_pf" );/* verify multicast address is valid */ -if (!FM10K_IS_MULTICAST_ETHER_ADDR (mac)) +if (!IS_MULTICAST_ETHER_ADDR (mac))return FM10K_ERR_PARAM ;return fm10k_update_xc_addr_pf (hw, glort, mac, vid, add,0 );
@@ -970,7 +970,7 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw, }/* Update base address registers to contain MAC address */ -if (FM10K_IS_VALID_ETHER_ADDR (vf_info->mac)) { +if (IS_VALID_ETHER_ADDR (vf_info->mac)) { tdbal = (((u32 )vf_info->mac[3 ]) <<24 ) | (((u32 )vf_info->mac[4 ]) <<16 ) | (((u32 )vf_info->mac[5 ]) <<8 );
@@ -1100,7 +1100,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,FM10K_WRITE_REG (hw,FM10K_MRQC (vf_info->vsi),0 );/* Update base address registers to contain MAC address */ -if (FM10K_IS_VALID_ETHER_ADDR (vf_info->mac)) { +if (IS_VALID_ETHER_ADDR (vf_info->mac)) { tdbal = (((u32 )vf_info->mac[3 ]) <<24 ) | (((u32 )vf_info->mac[4 ]) <<16 ) | (((u32 )vf_info->mac[5 ]) <<8 );
@@ -1326,7 +1326,7 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,return err;/* block attempts to set MAC for a locked device */ -if (FM10K_IS_VALID_ETHER_ADDR (vf_info->mac) && +if (IS_VALID_ETHER_ADDR (vf_info->mac) &&memcmp (mac, vf_info->mac,ETH_ALEN ))return FM10K_ERR_PARAM ;
drivers/net/fm10k/base/fm10k_type.h +7 -7
@@ -447,20 +447,20 @@ struct fm10k_hw;#define ETH_ALEN 6#endif /* ETH_ALEN */ -#ifndef FM10K_IS_ZERO_ETHER_ADDR +#ifndef IS_ZERO_ETHER_ADDR /* make certain address is not 0 */ -#define FM10K_IS_ZERO_ETHER_ADDR (addr) \ +#define IS_ZERO_ETHER_ADDR (addr) \ (!((addr)[0] | (addr)[1] | (addr)[2] | (addr)[3] | (addr)[4] | (addr)[5]))#endif -#ifndef FM10K_IS_MULTICAST_ETHER_ADDR -#define FM10K_IS_MULTICAST_ETHER_ADDR (addr) ((addr)[0] & 0x1) +#ifndef IS_MULTICAST_ETHER_ADDR +#define IS_MULTICAST_ETHER_ADDR (addr) ((addr)[0] & 0x1)#endif -#ifndef FM10K_IS_VALID_ETHER_ADDR +#ifndef IS_VALID_ETHER_ADDR /* make certain address is not multicast or 0 */ -#define FM10K_IS_VALID_ETHER_ADDR (addr) \ -(!FM10K_IS_MULTICAST_ETHER_ADDR(addr) && !FM10K_IS_ZERO_ETHER_ADDR(addr)) +#define IS_VALID_ETHER_ADDR (addr) \ +(!IS_MULTICAST_ETHER_ADDR(addr) && !IS_ZERO_ETHER_ADDR(addr))#endif enum fm10k_int_source {
drivers/net/fm10k/base/fm10k_vf.c +4 -4
@@ -53,7 +53,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)return err;/* If permanent address is set then we need to restore it */ -if (FM10K_IS_VALID_ETHER_ADDR (perm_addr)) { +if (IS_VALID_ETHER_ADDR (perm_addr)) { bal = (((u32 )perm_addr[3 ]) <<24 ) | (((u32 )perm_addr[4 ]) <<16 ) | (((u32 )perm_addr[5 ]) <<8 );
@@ -341,11 +341,11 @@ STATIC s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort,return FM10K_ERR_PARAM ;/* verify MAC address is valid */ -if (!FM10K_IS_VALID_ETHER_ADDR (mac)) +if (!IS_VALID_ETHER_ADDR (mac))return FM10K_ERR_PARAM ;/* verify we are not locked down on the MAC address */ -if (FM10K_IS_VALID_ETHER_ADDR (hw->mac.perm_addr) && +if (IS_VALID_ETHER_ADDR (hw->mac.perm_addr) &&memcmp (hw->mac.perm_addr, mac,ETH_ALEN ))return FM10K_ERR_PARAM ;
@@ -387,7 +387,7 @@ STATIC s32 fm10k_update_mc_addr_vf(struct fm10k_hw *hw, u16 glort,return FM10K_ERR_PARAM ;/* verify multicast address is valid */ -if (!FM10K_IS_MULTICAST_ETHER_ADDR (mac)) +if (!IS_MULTICAST_ETHER_ADDR (mac))return FM10K_ERR_PARAM ;/* add bit to notify us if this is a set or clear operation */
Signature · 1 line
2.9.3
PATCH 17/17 net/fm10k/base: equest reset when mbx->state changes
In reply to Qi ZhangMultiple IES API resets can cause a race condition where the mailbox interrupt request bits can be cleared before being handled. This can leave certain mailbox messages from the PF to be untreated and the PF will enter in some inactive state. If this situation occurs, the IES API will initiate a mailbox version reset which, then, trigger a mailbox state change. Once this mailbox transition occurs (from OPEN to CONNECT state), a request for reset will be returned.
--- drivers/net/fm10k/base/fm10k_mbx.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/fm10k/base/fm10k_mbx.c +7 -3
@@ -2066,9 +2066,10 @@ STATIC void fm10k_sm_mbx_create_reply(struct fm10k_hw *hw,* function can also be used to respond to an error as the connection * resetting would also be a means of dealing with errors. **/ -STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw, -struct fm10k_mbx_info *mbx) +STATIC s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw, +struct fm10k_mbx_info *mbx) { +s32 err =FM10K_SUCCESS ;const enum fm10k_mbx_state state = mbx->state;switch (state) {
@@ -2081,6 +2082,7 @@ STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,case FM10K_STATE_OPEN :/* flush any incomplete work */ fm10k_sm_mbx_connect_reset (mbx); + err =FM10K_ERR_RESET_REQUESTED ;break ;case FM10K_STATE_CONNECT :/* Update remote value to match local value */
@@ -2090,6 +2092,8 @@ STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw, }fm10k_sm_mbx_create_reply (hw, mbx, mbx->tail); + +return err; }/**
@@ -2172,7 +2176,7 @@ STATIC s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,switch (FM10K_MSG_HDR_FIELD_GET (mbx->mbx_hdr,SM_VER )) {case 0 : -fm10k_sm_mbx_process_reset (hw, mbx); + err =fm10k_sm_mbx_process_reset (hw, mbx);break ;case FM10K_SM_MBX_VERSION : err =fm10k_sm_mbx_process_version_1 (hw, mbx);
Signature · 1 line
2.9.3
Re: [PATCH 17/17] net/fm10k/base: equest reset when mbx->state changes
On 3/3/2017 3:17 AM, Qi Zhang wrote:
patch title: s/equest/request
Quoted 9 lines
Multiple IES API resets can cause a race condition where the mailbox interrupt request bits can be cleared before being handled. This can leave certain mailbox messages from the PF to be untreated and the PF will enter in some inactive state. If this situation occurs, the IES API will initiate a mailbox version reset which, then, trigger a mailbox state change. Once this mailbox transition occurs (from OPEN to CONNECT state), a request for reset will be returned.
Signed-off-by Qi Zhang <[email protected]>
<...>
Quoted 15 lines · Qi Zhang
The patch set update to latest fm10k base code, there is no significent features be added, but include couple enhancement like clean up the logic for tlv attr parse, improve VF multi-bit VLAN handle etc, also with some code/comment clean as well.
Qi Zhang (17):
net/fm10k/base: add a flag to indicate VF trust modenet/fm10k/base: reset multicaset mode when deleting lportnet/fm10k/base: expose macros needed by DPDKnet/fm10k/base: add error code
net/fm10k/base: clean up the logic
net/fm10k/base: add new item to lport msg attrnet/fm10k/base: use 8 bit notation instead of 10bit notationnet/fm10k/base: use different name for override bitnet/fm10k/base: update comment regarding reserved bits check
Quoted 8 lines
net/fm10k/base: improve VF's multi-bit VLAN update requestsnet/fm10k/base: enable lport map requestnet/fm10k/base: add macros for global interruptnet/fm10k/base: don't stop reset
net/fm10k/base: add marcro for geneve tunnelnet/fm10k/base: improve re-map queues handlenet/fm10k/base: replace marcos
net/fm10k/base: equest reset whenmbx->statechanges
Hi Qi,
Is there a base code version to record for fm10k, as done in some other drivers?
Thanks,
ferruh
v2 cover net/fm10k: update base code.
In reply to Qi ZhangThe patch set update to latest fm10k base code, there is no significent features be added, but include couple enhancement like clean up the logic for tlv attr parse, improve VF multi-bit VLAN handle etc, also with some code/comment clean as well.
v2:
- add base code information
- correct couple typo errors in commit log.
Qi Zhang (17):
net/fm10k/base: add a flag to indicate VF trust mode net/fm10k/base: reset multicast mode when deleting lport net/fm10k/base: expose macros needed by DPDK net/fm10k/base: add error code
net/fm10k/base: clean up the logic
net/fm10k/base: add new item to lport msg attr net/fm10k/base: update comment
net/fm10k/base: use different name for override bit net/fm10k/base: update comment regarding reserved bits check net/fm10k/base: improve VF's multi-bit VLAN update requests net/fm10k/base: enable lport map request net/fm10k/base: add macros for global interrupt net/fm10k/base: don't stop reset
net/fm10k/base: add marcro for geneve tunnel net/fm10k/base: improve re-map queues handle net/fm10k/base: replace marcos
net/fm10k/base: request reset when mbx->state changes net/fm10k/base: add base code driver information
drivers/net/fm10k/base/fm10k_common.c | 11 ++- drivers/net/fm10k/base/fm10k_mbx.c | 10 ++- drivers/net/fm10k/base/fm10k_mbx.h | 2 + drivers/net/fm10k/base/fm10k_osdep.h | 17 ----- drivers/net/fm10k/base/fm10k_pf.c | 140 ++++++++++++++++++++-------------- drivers/net/fm10k/base/fm10k_pf.h | 2 + drivers/net/fm10k/base/fm10k_tlv.c | 16 ++-- drivers/net/fm10k/base/fm10k_type.h | 71 +++++++++++++++-- drivers/net/fm10k/base/fm10k_vf.c | 24 +++--- 9 files changed, 189 insertions(+), 104 deletions(-)
Signature · 1 line
2.9.3
PATCH v2 1/18 net/fm10k/base: add a flag to indicate VF trust mode
Adds boolean flag in fm10k_vf_info to support configuring a VF to be trusted.
--- drivers/net/fm10k/base/fm10k_type.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/fm10k/base/fm10k_type.h +3 -0
@@ -676,6 +676,9 @@ struct fm10k_vf_info {u8 vf_flags;/* flags indicating what modes * are supported for the port */ +#ifndef NO_FM10K_VF_TRUSTED_MODE +bool trusted;/* VF trust mode */ +#endif };#define FM10K_VF_FLAG_ALLMULTI_CAPABLE (u8)(BIT(FM10K_XCAST_MODE_ALLMULTI))
Signature · 1 line
2.9.3
PATCH v2 2/18 net/fm10k/base: reset multicast mode when deleting lport
In reply to Qi ZhangDeleting lport when multicast mod is configured to FM10K_XCAST_MODE_ALLMULTI or FM10K_XCAST_MODE_PROMISC will result in generating orphaned multicast-group entries in the switch manager.
Before deleting the lport, reset multicast mode to FM10K_XCAST_MODE_NONE to flush out these multicast-group entries.
--- drivers/net/fm10k/base/fm10k_pf.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/fm10k/base/fm10k_pf.c +4 -0
@@ -536,6 +536,10 @@ STATIC s32 fm10k_update_lport_state_pf(struct fm10k_hw *hw, u16 glort,if (!fm10k_glort_valid_pf (hw, glort))return FM10K_ERR_PARAM ; +/* reset multicast mode if deleting lport */ +if (!enable) +fm10k_update_xcast_mode_pf (hw, glort,FM10K_XCAST_MODE_NONE ); +/* construct the lport message from the 2 pieces of data we have */ lport_msg = ((u32 )count <<16 ) | glort;
Signature · 1 line
2.9.3
PATCH v2 3/18 net/fm10k/base: expose macros needed by DPDK
In reply to Qi ZhangAdd back macros that DPDK required and remove the redundant ones in fm10k_osdep.h.
--- drivers/net/fm10k/base/fm10k_osdep.h | 17 ------------ drivers/net/fm10k/base/fm10k_type.h | 50 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 17 deletions(-)
drivers/net/fm10k/base/fm10k_osdep.h +0 -17
@@ -163,23 +163,6 @@ typedef int bool;#define FM10K_RXD_PKTTYPE_MASK 0x03F0#define FM10K_RXD_PKTTYPE_SHIFT 4 -enum fm10k_rdesc_pkt_type { -/* L3 type */ -FM10K_PKTTYPE_OTHER =0x00 , -FM10K_PKTTYPE_IPV4 =0x01 , -FM10K_PKTTYPE_IPV4_EX =0x02 , -FM10K_PKTTYPE_IPV6 =0x03 , -FM10K_PKTTYPE_IPV6_EX =0x04 , - -/* L4 type */ -FM10K_PKTTYPE_TCP =0x08 , -FM10K_PKTTYPE_UDP =0x10 , -FM10K_PKTTYPE_GRE =0x18 , -FM10K_PKTTYPE_VXLAN =0x20 , -FM10K_PKTTYPE_NVGRE =0x28 , -FM10K_PKTTYPE_GENEVE =0x30 -}; -#define FM10K_RXD_STATUS_IPCS 0x0008/* Indicates IPv4 csum */ #define FM10K_RXD_STATUS_HBO 0x0400/* header buffer overrun */
drivers/net/fm10k/base/fm10k_type.h +50 -0
103 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v2 4/18 net/fm10k/base: add error code
In reply to Qi ZhangAdd API error code for when PEP is not scheduled.
--- drivers/net/fm10k/base/fm10k_pf.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/fm10k/base/fm10k_pf.h +2 -0
@@ -91,6 +91,8 @@ enum fm10k_pf_tlv_attr_id_v1 {#define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16#define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16 +#define FM10K_MSG_ERR_PEP_NOT_SCHEDULED 280 +/* The following data structures are overlayed directly onto TLV mailbox * messages, and must not break 4 byte alignment. Ensure the structures line * up correctly as per their TLV definition.
Signature · 1 line
2.9.3
PATCH v2 5/18 net/fm10k/base: clean up the logic
In reply to Qi ZhangClean up the logic in fm10k_tlv_attr_parse, we should not reply on that FM10K_NOT_IMPLEMENTED is greater than zero, as this can easily cause confusion. The patch also correct a minor document error.
--- drivers/net/fm10k/base/fm10k_tlv.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/fm10k/base/fm10k_tlv.c +9 -7
@@ -520,7 +520,8 @@ STATIC s32 fm10k_tlv_attr_validate(u32 *attr,* up into an array of pointers stored in results. The function will * return FM10K_ERR_PARAM on any input or message error, * FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array -* and 0 on success. +* and 0 on success. Any attributes not found in tlv_attr will be silently +* ignored. **/ static s32 fm10k_tlv_attr_parse (u32 *attr,u32 **results,const struct fm10k_tlv_attr *tlv_attr)
@@ -559,14 +560,15 @@ static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,while (offset < len) { attr_id = *attr &FM10K_TLV_ID_MASK ; -if (attr_id <FM10K_TLV_RESULTS_MAX ) - err =fm10k_tlv_attr_validate (attr, tlv_attr); -else - err =FM10K_NOT_IMPLEMENTED ; +if (attr_id >=FM10K_TLV_RESULTS_MAX ) +return FM10K_NOT_IMPLEMENTED ; -if (err <0 ) + err =fm10k_tlv_attr_validate (attr, tlv_attr); +if (err ==FM10K_NOT_IMPLEMENTED ) + ;/* silently ignore non-implemented attributes */ +else if (err)return err; -if (!err) +else results[attr_id] = attr;/* update offset */
Signature · 1 line
2.9.3
PATCH v2 6/18 net/fm10k/base: add new item to lport msg attr
In reply to Qi ZhangAdd FM10K_PF_ATTR_ID_ERR, since it is possible for the switch manager to send out an error message indicating status of the LPORT_MAP due to zero allocated bandwidth.
--- drivers/net/fm10k/base/fm10k_pf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/fm10k/base/fm10k_pf.c +2 -0
@@ -1705,6 +1705,8 @@ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)/* This structure defines the attibutes to be parsed below */ const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[] = { +FM10K_TLV_ATTR_LE_STRUCT (FM10K_PF_ATTR_ID_ERR , +sizeof (struct fm10k_swapi_error )),FM10K_TLV_ATTR_U32 (FM10K_PF_ATTR_ID_LPORT_MAP ),FM10K_TLV_ATTR_LAST };
Signature · 1 line
2.9.3
PATCH v2 7/18 net/fm10k/base: update comment
In reply to Qi ZhangThe diagram represents bit layout of the multi-bit VLAN update message format. Re-draw the numbers using base 8, and mark the bit values every 8 bits at the top. This should make it more easy to grasp the table quickly.
--- drivers/net/fm10k/base/fm10k_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +2 -2
@@ -255,8 +255,8 @@ STATIC s32 fm10k_update_vlan_pf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)/* VLAN multi-bit write: * The multi-bit write has several parts to it. -* 3 2 1 0 -* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +* 24 16 8 0 +* 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | RSVD0 | Length |C|RSVD0| VLAN ID | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Signature · 1 line
2.9.3
PATCH v2 8/18 net/fm10k/base: use different name for override bit
In reply to Qi ZhangUse a new #define FM10K_VLAN_OVERRIDE even though we're using the exact same bit. The reason for this is clarity in the code, otherwise you can read FM10K_VLAN_CLEAR and think it should be removed. Also add a comment explaining why the FM10K_VLAN_OVERRIDE bit is set.
--- drivers/net/fm10k/base/fm10k_pf.c | 12 ++++++------ drivers/net/fm10k/base/fm10k_type.h | 1 + drivers/net/fm10k/base/fm10k_vf.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +6 -6
@@ -912,13 +912,13 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw, vf_q_idx =fm10k_vf_queue_index (hw, vf_idx); qmap_idx = qmap_stride * vf_idx; -/* MAP Tx queue back to 0 temporarily, and disable it */ -FM10K_WRITE_REG (hw,FM10K_TQMAP (qmap_idx),0 ); -FM10K_WRITE_REG (hw,FM10K_TXDCTL (vf_q_idx),0 ); - -/* determine correct default VLAN ID */ +/* Determine correct default VLAN ID. The FM10K_VLAN_OVERRIDE bit is +* used here to indicate to the VF that it will not have privilege to +* write VLAN_TABLE. All policy is enforced on the PF but this allows +* the VF to correctly report errors to userspace rqeuests. +*/ if (vf_info->pf_vid) - vf_vid = vf_info->pf_vid |FM10K_VLAN_CLEAR ; + vf_vid = vf_info->pf_vid |FM10K_VLAN_OVERRIDE ;else vf_vid = vf_info->sw_vid;
drivers/net/fm10k/base/fm10k_type.h +1 -0
@@ -407,6 +407,7 @@ struct fm10k_hw;#define FM10K_VLAN_TABLE_VSI_MAX 64#define FM10K_VLAN_LENGTH_SHIFT 16#define FM10K_VLAN_CLEAR BIT(15) +#define FM10K_VLAN_OVERRIDE FM10K_VLAN_CLEAR#define FM10K_VLAN_ALL \ ((FM10K_VLAN_TABLE_VID_MAX - 1) << FM10K_VLAN_LENGTH_SHIFT)
drivers/net/fm10k/base/fm10k_vf.c +1 -1
@@ -268,7 +268,7 @@ s32 fm10k_msg_mac_vlan_vf(struct fm10k_hw *hw, u32 **results,memcpy (hw->mac.perm_addr, perm_addr,ETH_ALEN ); hw->mac.default_vid = vid & (FM10K_VLAN_TABLE_VID_MAX -1 ); - hw->mac.vlan_override = !!(vid &FM10K_VLAN_CLEAR ); + hw->mac.vlan_override = !!(vid &FM10K_VLAN_OVERRIDE );return FM10K_SUCCESS ; }
Signature · 1 line
2.9.3
PATCH v2 9/18 net/fm10k/base: update comment regarding reserved bits check
In reply to Qi ZhangThe original comment may be read incorrectly as referring to checking the *entire* length is zero. However, it merely checks only the reserved bits of both length and reserved in a small amount of code. Update the comment to indicate this is a clever trick and clearly spell out that it only checks the reserve bits.
--- drivers/net/fm10k/base/fm10k_vf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/fm10k/base/fm10k_vf.c +1 -1
@@ -225,7 +225,7 @@ STATIC s32 fm10k_update_vlan_vf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)if (vsi)return FM10K_ERR_PARAM ; -/* verify upper 4 bits of vid and length are 0 */ +/* clever trick to verify reserved bits in both vid and length */ if ((vid <<16 | vid) >>28 )return FM10K_ERR_PARAM ;
Signature · 1 line
2.9.3
PATCH v2 10/18 net/fm10k/base: improve VF's multi-bit VLAN update requests
In reply to Qi ZhangThe VF uses a multi-bit update request to clear unused VLANs whenever it resets. However, an accident in a previous refactor broke multi-bit updates for VFs, due to misreading a comment in fm10k_vf.c and attempting to reduce code duplication. The problem occurs because a multi-bit request has a non-zero length, and the PF would simply drop any request with the upper 16 bits set. In addition, a multi-bit vlan update does not have a concept for "VLAN 0" as the single bit update does.
A previous revision of this patch resolved the issue by simply removing the upper 16 bit check and the iov_select_vid checks. However, this would remove the checks for default VID and for ensuring no other VLANs can be enabled except pf_vid when it has been set. To resolve that issue, this revision uses the iov_select_vid when we have a single-bit update, and denies any multi-bit update when the VLAN was administratively set by the PF. This should be ok since the PF properly updates VLAN_TABLE when it assigns the PF vid. This ensures that requests to add or "remove" the PF vid work as expected, but a rogue VF could not use the multi-bit update as a loophole to attempt receiving traffic on other VLANs.
--- drivers/net/fm10k/base/fm10k_pf.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +22 -8
@@ -1271,18 +1271,32 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,if (err)return err; -/* 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, (u16 )vid); -if (err <0 ) -return err; +/* if the length field has been set, this is a multi-bit +* update request. For multi-bit requests, simply disallow +* them when the pf_vid has been set. In this case, the PF +* should have already cleared the VLAN_TABLE, and if we +* allowed them, it could allow a rogue VF to receive traffic +* on a VLAN it was not assigned. In the single-bit case, we +* need to modify requests for VLAN 0 to use the default PF or +* SW vid when assigned. +*/ - vid = err; +if (vid >>16 ) { +/* prevent multi-bit requests when PF has +* administratively set the VLAN for this VF +*/ +if (vf_info->pf_vid) +return FM10K_ERR_PARAM ; + }else { + err =fm10k_iov_select_vid (vf_info, (u16 )vid); +if (err <0 ) +return err; + + vid = err; + }/* update VSI info for VF in regards to VLAN table */ err = hw->mac.ops.update_vlan (hw, vid, vf_info->vsi, set);
Signature · 1 line
2.9.3
PATCH v2 11/18 net/fm10k/base: enable lport map request
In reply to Qi ZhangIf the fm10k interface is brought up, but the switch manager software is not running, the driver will continuously request the lport map every few seconds in the base driver watchdog routine. Eventually after several minutes the switch mailbox Tx fifo will fill up and the mailbox will timeout, resulting in a reset. This reset will appear as if for no reason, and occurs regularly every few minutes until the switch manager software is loaded.
--- drivers/net/fm10k/base/fm10k_common.c | 8 ++++++-- drivers/net/fm10k/base/fm10k_pf.c | 17 ++++------------- drivers/net/fm10k/base/fm10k_type.h | 1 + 3 files changed, 11 insertions(+), 15 deletions(-)
drivers/net/fm10k/base/fm10k_common.c +6 -2
@@ -542,7 +542,7 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready) goto out;/* if we somehow dropped the Tx enable we should reset */ -if (hw->mac.tx_ready && !(txdctl &FM10K_TXDCTL_ENABLE )) { +if (mac->tx_ready && !(txdctl &FM10K_TXDCTL_ENABLE )) { ret_val =FM10K_ERR_RESET_REQUESTED ; goto out; }
@@ -558,8 +558,12 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready) goto out;/* interface cannot receive traffic without logical ports */ -if (mac->dglort_map ==FM10K_DGLORTMAP_NONE ) +if (mac->dglort_map ==FM10K_DGLORTMAP_NONE ) { +if (mac->ops.request_lport_map) + ret_val = mac->ops.request_lport_map (hw); + goto out; + }/* if we passed all the tests above then the switch is ready and we no * longer need to check for link
drivers/net/fm10k/base/fm10k_pf.c +4 -13
@@ -1688,13 +1688,12 @@ STATIC s32 fm10k_request_lport_map_pf(struct fm10k_hw *hw)* @hw: pointer to hardware structure * @switch_ready: pointer to boolean value that will record switch state * -* This funciton will check the DMA_CTRL2 register and mailbox in order +* This function will check the DMA_CTRL2 register and mailbox in order * to determine if the switch is ready for the PF to begin requesting * addresses and mapping traffic to the local interface. **/ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready) { -s32 ret_val =FM10K_SUCCESS ;u32 dma_ctrl2;DEBUGFUNC ("fm10k_get_host_state_pf" );
@@ -1702,19 +1701,10 @@ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)/* verify the switch is ready for interaction */ dma_ctrl2 =FM10K_READ_REG (hw,FM10K_DMA_CTRL2 );if (!(dma_ctrl2 &FM10K_DMA_CTRL2_SWITCH_READY )) - goto out; +return FM10K_SUCCESS ;/* retrieve generic host state info */ - ret_val =fm10k_get_host_state_generic (hw, switch_ready); -if (ret_val) - goto out; - -/* interface cannot receive traffic without logical ports */ -if (hw->mac.dglort_map ==FM10K_DGLORTMAP_NONE ) - ret_val =fm10k_request_lport_map_pf (hw); - -out: -return ret_val; +return fm10k_get_host_state_generic (hw, switch_ready); }/* This structure defines the attibutes to be parsed below */
@@ -2102,6 +2092,7 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw) mac->ops.set_dma_mask = &fm10k_set_dma_mask_pf; mac->ops.get_fault = &fm10k_get_fault_pf; mac->ops.get_host_state = &fm10k_get_host_state_pf; + mac->ops.request_lport_map = &fm10k_request_lport_map_pf; mac->ops.adjust_systime = &fm10k_adjust_systime_pf; mac->ops.notify_offset = &fm10k_notify_offset_pf; mac->ops.read_systime = &fm10k_read_systime_pf;
drivers/net/fm10k/base/fm10k_type.h +1 -0
@@ -611,6 +611,7 @@ 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 *); +s32 (*request_lport_map)(struct fm10k_hw *);#ifndef NO_IS_SLOT_APPROPRIATE_CHECK bool (*is_slot_appropriate)(struct fm10k_hw *);#endif
Signature · 1 line
2.9.3
PATCH v2 12/18 net/fm10k/base: add macros for global interrupt
In reply to Qi ZhangAdd two macros for global interrupt.
--- drivers/net/fm10k/base/fm10k_mbx.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/fm10k/base/fm10k_mbx.h +2 -0
@@ -54,6 +54,8 @@ struct fm10k_mbx_info;#define FM10K_MBX_ACK_INTERRUPT 0x00000010#define FM10K_MBX_INTERRUPT_ENABLE 0x00000020#define FM10K_MBX_INTERRUPT_DISABLE 0x00000040 +#define FM10K_MBX_GLOBAL_REQ_INTERRUPT 0x00000200 +#define FM10K_MBX_GLOBAL_ACK_INTERRUPT 0x00000400#define FM10K_MBICR (_n) ((_n) + 0x18840)#define FM10K_GMBX 0x18842
Signature · 1 line
2.9.3
PATCH v2 13/18 net/fm10k/base: don't stop reset
In reply to Qi ZhangDon't report FM10K_ERR_REQUESTS_PENDING when we fail to disable queues within the timeout. This can occur due to a hardware Tx hang, or when the switch ethernet fabric is resetting while we are transmitting traffic. It can sometimes take up to 500ms before the Tx DMA engine gives up. Instead, just skip the DMA engine check and perform a data-path reset anyways. Add a statistic counter to keep track of the number of resets occurring while we have pending DMA on the rings.
In order to prevent having to assign err = FM10K_SUCCESS, re-order the last few items of the reset_hw_pf function so that we don't perform "return err" at the end.
--- drivers/net/fm10k/base/fm10k_pf.c | 19 +++++++++---------- drivers/net/fm10k/base/fm10k_type.h | 1 + drivers/net/fm10k/base/fm10k_vf.c | 12 +++++++----- 3 files changed, 17 insertions(+), 15 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +9 -10
@@ -66,21 +66,21 @@ STATIC s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)/* shut down all rings */ err =fm10k_disable_queues_generic (hw,FM10K_MAX_QUEUES ); -if (err) +if (err ==FM10K_ERR_REQUESTS_PENDING ) { + hw->mac.reset_while_pending++; + goto force_reset; + }else if (err) {return err; + }/* Verify that DMA is no longer active */ reg =FM10K_READ_REG (hw,FM10K_DMA_CTRL );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; - +force_reset:/* Inititate data path reset */ - reg |=FM10K_DMA_CTRL_DATAPATH_RESET ; + reg =FM10K_DMA_CTRL_DATAPATH_RESET ;FM10K_WRITE_REG (hw,FM10K_DMA_CTRL , reg);/* Flush write and allow 100us for reset to complete */
@@ -90,10 +90,9 @@ STATIC s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)/* Verify we made it out of reset */ reg =FM10K_READ_REG (hw,FM10K_IP );if (!(reg &FM10K_IP_NOTINRESET )) - err =FM10K_ERR_RESET_FAILED ; +return FM10K_ERR_RESET_FAILED ; -out: -return err; +return FM10K_SUCCESS ; }/**
drivers/net/fm10k/base/fm10k_type.h +1 -0
@@ -654,6 +654,7 @@ struct fm10k_mac_info {bool tx_ready;u32 dglort_map;u8 itr_scale; +u64 reset_while_pending; };struct fm10k_swapi_table_info {
drivers/net/fm10k/base/fm10k_vf.c +7 -5
@@ -49,7 +49,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)/* we need to disable the queues before taking further steps */ err =fm10k_stop_hw_generic (hw); -if (err) +if (err && err !=FM10K_ERR_REQUESTS_PENDING )return err;/* If permanent address is set then we need to restore it */
@@ -82,7 +82,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)FM10K_WRITE_REG (hw,FM10K_TDLEN (i), tdlen); } -return FM10K_SUCCESS ; +return err; }/**
@@ -100,7 +100,9 @@ STATIC s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)/* shut down queues we own and reset DMA configuration */ err =fm10k_stop_hw_vf (hw); -if (err) +if (err ==FM10K_ERR_REQUESTS_PENDING ) + hw->mac.reset_while_pending++; +else if (err)return err;/* Inititate VF reset */
@@ -113,9 +115,9 @@ STATIC s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)/* Clear reset bit and verify it was cleared */ FM10K_WRITE_REG (hw,FM10K_VFCTRL ,0 );if (FM10K_READ_REG (hw,FM10K_VFCTRL ) &FM10K_VFCTRL_RST ) - err =FM10K_ERR_RESET_FAILED ; +return FM10K_ERR_RESET_FAILED ; -return err; +return FM10K_SUCCESS ; }/**
Signature · 1 line
2.9.3
PATCH v2 14/18 net/fm10k/base: add macro for geneve tunnel offload
In reply to Qi Zhangadd necessary macro to support geneve tunnel offload.
--- drivers/net/fm10k/base/fm10k_type.h | 1 + 1 file changed, 1 insertion(+)
drivers/net/fm10k/base/fm10k_type.h +1 -0
@@ -194,6 +194,7 @@ struct fm10k_hw;#define FM10K_DGLORTDEC_INNERRSS_ENABLE 0x08000000#define FM10K_TUNNEL_CFG 0x0040#define FM10K_TUNNEL_CFG_NVGRE_SHIFT 16 +#define FM10K_TUNNEL_CFG_GENEVE 0x0041#define FM10K_SWPRI_MAP (_n) ((_n) + 0x0050)#define FM10K_SWPRI_MAX 16#define FM10K_RSSRK (_n, _m) (((_n) * 0x10) + (_m) + 0x0800)
Signature · 1 line
2.9.3
PATCH v2 15/18 net/fm10k/base: improve re-map queues handle
In reply to Qi ZhangAvoid potential FUM fault errors on a VF when updating MAC address and VLAN information. Only use the register flow when the mailbox is disconnected, by checking if the enqueue_tx returns FM10K_MBX_ERR_NO_MBX. If the mailbox message can be sent, there is no reason to bother with the register writes which are only intended to be used during VF driver initialization.
--- drivers/net/fm10k/base/fm10k_common.c | 3 +++ drivers/net/fm10k/base/fm10k_pf.c | 42 ++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 13 deletions(-)
drivers/net/fm10k/base/fm10k_common.c +3 -0
@@ -230,6 +230,9 @@ s32 fm10k_disable_queues_generic(struct fm10k_hw *hw, u16 q_cnt)/* clear tx_ready to prevent any false hits for reset */ hw->mac.tx_ready = false; +if (FM10K_REMOVED (hw->hw_addr)) +return FM10K_SUCCESS ; +/* clear the enable bit for all rings */ for (i =0 ; i < q_cnt; i++) { reg =FM10K_READ_REG (hw,FM10K_TXDCTL (i));
drivers/net/fm10k/base/fm10k_pf.c +29 -13
54 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v2 16/18 net/fm10k/base: replace macros
In reply to Qi ZhangOther shared code bases are planning on using IS_MULTICAST_ETHER_ADDR and friends without leaving the driver name in the macro.
Remove reference to FM10K here so that we can re-use the specific compat flags from Linux.
--- drivers/net/fm10k/base/fm10k_pf.c | 10 +++++----- drivers/net/fm10k/base/fm10k_type.h | 14 +++++++------- drivers/net/fm10k/base/fm10k_vf.c | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/fm10k/base/fm10k_pf.c +5 -5
@@ -411,7 +411,7 @@ STATIC s32 fm10k_update_uc_addr_pf(struct fm10k_hw *hw, u16 glort,DEBUGFUNC ("fm10k_update_uc_addr_pf" );/* verify MAC address is valid */ -if (!FM10K_IS_VALID_ETHER_ADDR (mac)) +if (!IS_VALID_ETHER_ADDR (mac))return FM10K_ERR_PARAM ;return fm10k_update_xc_addr_pf (hw, glort, mac, vid, add, flags);
@@ -434,7 +434,7 @@ STATIC s32 fm10k_update_mc_addr_pf(struct fm10k_hw *hw, u16 glort,DEBUGFUNC ("fm10k_update_mc_addr_pf" );/* verify multicast address is valid */ -if (!FM10K_IS_MULTICAST_ETHER_ADDR (mac)) +if (!IS_MULTICAST_ETHER_ADDR (mac))return FM10K_ERR_PARAM ;return fm10k_update_xc_addr_pf (hw, glort, mac, vid, add,0 );
@@ -970,7 +970,7 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw, }/* Update base address registers to contain MAC address */ -if (FM10K_IS_VALID_ETHER_ADDR (vf_info->mac)) { +if (IS_VALID_ETHER_ADDR (vf_info->mac)) { tdbal = (((u32 )vf_info->mac[3 ]) <<24 ) | (((u32 )vf_info->mac[4 ]) <<16 ) | (((u32 )vf_info->mac[5 ]) <<8 );
@@ -1100,7 +1100,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,FM10K_WRITE_REG (hw,FM10K_MRQC (vf_info->vsi),0 );/* Update base address registers to contain MAC address */ -if (FM10K_IS_VALID_ETHER_ADDR (vf_info->mac)) { +if (IS_VALID_ETHER_ADDR (vf_info->mac)) { tdbal = (((u32 )vf_info->mac[3 ]) <<24 ) | (((u32 )vf_info->mac[4 ]) <<16 ) | (((u32 )vf_info->mac[5 ]) <<8 );
@@ -1326,7 +1326,7 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,return err;/* block attempts to set MAC for a locked device */ -if (FM10K_IS_VALID_ETHER_ADDR (vf_info->mac) && +if (IS_VALID_ETHER_ADDR (vf_info->mac) &&memcmp (mac, vf_info->mac,ETH_ALEN ))return FM10K_ERR_PARAM ;
drivers/net/fm10k/base/fm10k_type.h +7 -7
@@ -447,20 +447,20 @@ struct fm10k_hw;#define ETH_ALEN 6#endif /* ETH_ALEN */ -#ifndef FM10K_IS_ZERO_ETHER_ADDR +#ifndef IS_ZERO_ETHER_ADDR /* make certain address is not 0 */ -#define FM10K_IS_ZERO_ETHER_ADDR (addr) \ +#define IS_ZERO_ETHER_ADDR (addr) \ (!((addr)[0] | (addr)[1] | (addr)[2] | (addr)[3] | (addr)[4] | (addr)[5]))#endif -#ifndef FM10K_IS_MULTICAST_ETHER_ADDR -#define FM10K_IS_MULTICAST_ETHER_ADDR (addr) ((addr)[0] & 0x1) +#ifndef IS_MULTICAST_ETHER_ADDR +#define IS_MULTICAST_ETHER_ADDR (addr) ((addr)[0] & 0x1)#endif -#ifndef FM10K_IS_VALID_ETHER_ADDR +#ifndef IS_VALID_ETHER_ADDR /* make certain address is not multicast or 0 */ -#define FM10K_IS_VALID_ETHER_ADDR (addr) \ -(!FM10K_IS_MULTICAST_ETHER_ADDR(addr) && !FM10K_IS_ZERO_ETHER_ADDR(addr)) +#define IS_VALID_ETHER_ADDR (addr) \ +(!IS_MULTICAST_ETHER_ADDR(addr) && !IS_ZERO_ETHER_ADDR(addr))#endif enum fm10k_int_source {
drivers/net/fm10k/base/fm10k_vf.c +4 -4
@@ -53,7 +53,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)return err;/* If permanent address is set then we need to restore it */ -if (FM10K_IS_VALID_ETHER_ADDR (perm_addr)) { +if (IS_VALID_ETHER_ADDR (perm_addr)) { bal = (((u32 )perm_addr[3 ]) <<24 ) | (((u32 )perm_addr[4 ]) <<16 ) | (((u32 )perm_addr[5 ]) <<8 );
@@ -341,11 +341,11 @@ STATIC s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort,return FM10K_ERR_PARAM ;/* verify MAC address is valid */ -if (!FM10K_IS_VALID_ETHER_ADDR (mac)) +if (!IS_VALID_ETHER_ADDR (mac))return FM10K_ERR_PARAM ;/* verify we are not locked down on the MAC address */ -if (FM10K_IS_VALID_ETHER_ADDR (hw->mac.perm_addr) && +if (IS_VALID_ETHER_ADDR (hw->mac.perm_addr) &&memcmp (hw->mac.perm_addr, mac,ETH_ALEN ))return FM10K_ERR_PARAM ;
@@ -387,7 +387,7 @@ STATIC s32 fm10k_update_mc_addr_vf(struct fm10k_hw *hw, u16 glort,return FM10K_ERR_PARAM ;/* verify multicast address is valid */ -if (!FM10K_IS_MULTICAST_ETHER_ADDR (mac)) +if (!IS_MULTICAST_ETHER_ADDR (mac))return FM10K_ERR_PARAM ;/* add bit to notify us if this is a set or clear operation */
Signature · 1 line
2.9.3
PATCH v2 17/18 net/fm10k/base: request reset when mbx->state changes
In reply to Qi ZhangMultiple IES API resets can cause a race condition where the mailbox interrupt request bits can be cleared before being handled. This can leave certain mailbox messages from the PF to be untreated and the PF will enter in some inactive state. If this situation occurs, the IES API will initiate a mailbox version reset which, then, trigger a mailbox state change. Once this mailbox transition occurs (from OPEN to CONNECT state), a request for reset will be returned.
--- drivers/net/fm10k/base/fm10k_mbx.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/fm10k/base/fm10k_mbx.c +7 -3
@@ -2066,9 +2066,10 @@ STATIC void fm10k_sm_mbx_create_reply(struct fm10k_hw *hw,* function can also be used to respond to an error as the connection * resetting would also be a means of dealing with errors. **/ -STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw, -struct fm10k_mbx_info *mbx) +STATIC s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw, +struct fm10k_mbx_info *mbx) { +s32 err =FM10K_SUCCESS ;const enum fm10k_mbx_state state = mbx->state;switch (state) {
@@ -2081,6 +2082,7 @@ STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,case FM10K_STATE_OPEN :/* flush any incomplete work */ fm10k_sm_mbx_connect_reset (mbx); + err =FM10K_ERR_RESET_REQUESTED ;break ;case FM10K_STATE_CONNECT :/* Update remote value to match local value */
@@ -2090,6 +2092,8 @@ STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw, }fm10k_sm_mbx_create_reply (hw, mbx, mbx->tail); + +return err; }/**
@@ -2172,7 +2176,7 @@ STATIC s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,switch (FM10K_MSG_HDR_FIELD_GET (mbx->mbx_hdr,SM_VER )) {case 0 : -fm10k_sm_mbx_process_reset (hw, mbx); + err =fm10k_sm_mbx_process_reset (hw, mbx);break ;case FM10K_SM_MBX_VERSION : err =fm10k_sm_mbx_process_version_1 (hw, mbx);
Signature · 1 line
2.9.3
PATCH v2 18/18 net/fm10k/base: add base driver information
In reply to Qi ZhangAdd base driver information in Makefile.
--- drivers/net/fm10k/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/net/fm10k/Makefile +1 -0
@@ -84,6 +84,7 @@ VPATH += $(SRCDIR)/base # # all source are stored in SRCS-y +# base driver is based on the package of cid-fm10k.2017.01.24.tar.gz # SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_rxtx.c
Signature · 1 line
2.9.3
Quoted 20 lines · Qi Zhang
The patch set update to latest fm10k base code, there is no significent features be added, but include couple enhancement like clean up the logic for tlv attr parse, improve VF multi-bit VLAN handle etc, also with some code/comment clean as well.
v2:
- add base code information
- correct couple typo errors in commit log.Qi Zhang (17):
net/fm10k/base: add a flag to indicate VF trust modenet/fm10k/base: reset multicast mode when deleting lportnet/fm10k/base: expose macros needed by DPDKnet/fm10k/base: add error code
net/fm10k/base: clean up the logic
net/fm10k/base: add new item to lport msg attrnet/fm10k/base: update comment
net/fm10k/base: use different name for override bitnet/fm10k/base: update comment regarding reserved bits checknet/fm10k/base: improve VF's multi-bit VLAN update requests
Quoted 8 lines
net/fm10k/base: enable lport map requestnet/fm10k/base: add macros for global interruptnet/fm10k/base: don't stop resetnet/fm10k/base: add marcro for geneve tunnelnet/fm10k/base: improve re-map queues handlenet/fm10k/base: replace marcosnet/fm10k/base: request reset whenmbx->statechangesnet/fm10k/base: add base code driver information
Series applied to dpdk-next-net/master, thanks.
defined(DPDK_SUPPORT) removed from patch 3/18, which is useless and looks like exists by mistake, please double check updated code.
Hi Ferruh:
I have checked 3/18 patch, no issue, Thank for the kind help!
Regards
Qi
Quoted 42 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Thursday, March 9, 2017 7:13 PM
To: Zhang, Qi Z <[email protected]>; Chen, Jing D <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code.Quoted 20 lines · Qi Zhang
The patch set update to latest fm10k base code, there is no significent features be added, but include couple enhancement like clean up the logic for tlv attr parse, improve VF multi-bit VLAN handle etc, also with some code/comment clean as well.
v2:
- add base code information
- correct couple typo errors in commit log.Qi Zhang (17):
net/fm10k/base: add a flag to indicate VF trust modenet/fm10k/base: reset multicast mode when deleting lportnet/fm10k/base: expose macros needed by DPDKnet/fm10k/base: add error code
net/fm10k/base: clean up the logic
net/fm10k/base: add new item to lport msg attrnet/fm10k/base: update comment
net/fm10k/base: use different name for override bitnet/fm10k/base: update comment regarding reserved bits checknet/fm10k/base: improve VF's multi-bit VLAN update requestsQuoted 8 lines
net/fm10k/base: enable lport map requestnet/fm10k/base: add macros for global interruptnet/fm10k/base: don't stop resetnet/fm10k/base: add marcro for geneve tunnelnet/fm10k/base: improve re-map queues handlenet/fm10k/base: replace marcosnet/fm10k/base: request reset whenmbx->statechangesnet/fm10k/base: add base code driver informationSeries applied to dpdk-next-net/master, thanks.
defined(DPDK_SUPPORT)removed from patch 3/18, which is useless and looks like exists by mistake, please double check updated code.