1. 27 4月, 2023 19 次提交
    • J
      RDMA/hns: Support dispatching IB event for RoCE bonding · 49f27d3e
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6ZAIM
      
      ---------------------------------------------------------------
      
      Support dispatching IB event for RoCE bonding. After setting bond,
      IB_EVENT_PORT_ERR is dispatched in the following situation:
      	1. bond0 becomes link down;
      	2. all slaves become link down (as it will lead to a link-down
                 of the upper device).
      
      IB_EVENT_PORT_ACTIVE is dispatched in the following situation:
      	1. bond0 becomes link up;
      	2. one slave becomes link up when all slaves were link down (as
                 it will lead to a link-up of the upper device).
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      49f27d3e
    • J
      RDMA/hns: Set IB port state depending on upper device for RoCE bonding · c65db67a
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6ZAIM
      
      ---------------------------------------------------------------
      
      For RoCE bonding, the IB port state should depend on the link
      status of upper device. When the upper device is link up, the
      IB port state should be IB_PORT_ATIVE; otherwise, the state
      should be IB_PORT_DOWN.
      
      Particularly, when all slaves are link down, the upper device will become
      link down automatically, and when at least one slave become link up, the
      upper device will become link up. In these situations the IB port will
      also change accordingly.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      c65db67a
    • J
      RDMA/hns: Get real-time port state of bonding slave · e4ad37ea
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6ZAIM
      
      ---------------------------------------------------------------
      
      Currently, when a change-lowerstate event occurs, the bonding driver
      gets the slave's port state from the event notifier and stores it in
      the bond_grp struct. Whenever the state needs to be configured to HW
      or is queried, the driver reads from bond_grp.
      
      But actually, the state read in this way is not real-time data, as there
      is always a delay before the newly changed state is stored. So it is
      uneccessary and also inaccurate to store the state. Whenever the state
      is needed, just read it from kernel in real time.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      e4ad37ea
    • J
      RDMA/hns: Fix the counting error of bonding with more than 2 slaves · ab97048c
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6ZACP
      
      ---------------------------------------------------------------
      
      When changeupper event happens involving bond group with more than 2
      slaves, the counting of slave num is incorrect for the reason that there
      are no corresponding hr_dev for uninited slaves, which leads to the
      failure in adding 3 or more slaves to a bond group.
      
      Applying this patch, the counting begins from the previous value but not
      0, and updates slave_map and slave_map_diff depending on whether slave
      num increases or decreases. Besides, since bond_grp->slave_num is no
      longer used, remove it.
      
      Fixes: e62a2027 ("RDMA/hns: support RoCE bonding")
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      ab97048c
    • J
      RDMA/hns: Fix the repetitive workqueue mission in RoCE Bonding · 483ccd44
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6ZACP
      
      ---------------------------------------------------------------
      
      When the third slave is going to be added to a bond group, a
      ChangeLowerState event happens firstly and notifies the driver
      to queue a ChangeState mission. However, the hr_dev of the third
      slave and bond group will both be notified and queue a repetitive
      mission separately. As the mission is triggered twice, there will
      be also repetitive mission printing, which is misleading and
      incorrect.
      
      Applying this patch, only the hr_dev of the bond group will queue and
      trigger the mission.
      
      Fixes: e62a2027 ("RDMA/hns: support RoCE bonding")
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      483ccd44
    • J
      RDMA/hns: Rename hns_roce_bond_info_record() to make sense · b5db3025
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6ZACP
      
      ---------------------------------------------------------------
      
      The "record" in "hns_roce_bond_info_record()" is not accurate.
      Change the name to "hns_roce_bond_info_update()".
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      b5db3025
    • J
      RDMA/hns: Support reset recovery for RoCE bonding · b0f80ad2
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      Currently, a RoCE bond device cannot be recovered to a bond
      device after reset.
      
      Applying this patch, RoCE bonding device 'hns_bond_xx' can be recovered
      after reset, including the following changes:
         1. modify the condition for juding whether bond_grp is active, as the
            bond_grp may be also holding HNS_ROCE_CHANGE_BOND during reset init.
            Thus, as long as the bond_grp's state is not
            HNS_ROCE_BOND_NOT_BONDED, it should be considered active.
         2. update the link status of slave in bond_grp from NIC bonding driver
            right before sending command to firmware, as RoCE driver is uninited
            for a while in reset process, and during this period bond_grp cannot
            update the information.
         3. After the reset, re-config the bond_grp information to firmware,
            as the firmware is also reset and the previous configuration is
            cleared.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      b0f80ad2
    • J
      RDMA/hns: Fix the counting error of slave number · 01c810c8
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      Currently, the driver will count the number of slave hr_dev,
      but during bond clearing event and slave decreasing event, only
      one slave has a corresponding hr_dev, and the number will always
      be 1. It causes that all slave decrease events are redirected to
      a bond clearing operation.
      
      This patch fixes this problem by counting slave netdev directly instead
      of getting its hr_dev during bond clearing event and slave decreasing
      event.
      
      Fixes: 646b97db ("RDMA/hns: adjust the structure of RoCE bonding driver")
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      01c810c8
    • J
      RDMA/hns: Fix the driver uninit order during bond setting · 8d3ee0ae
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      In the slave list of bond_grp, the first slave is always the main_hr_dev,
      and the main_hr_dev is responsible for bonding netdev event handling. If
      the main_hr_dev is uninit too early, some CHANGELOWERSTATE events may be
      missed before the main_hr_dev is re-register, which may cause the HW is
      configured with an outdated slave state.
      
      This patch reverses the order of uniniting slave hr_dev to ensure
      main_hr_dev is the last one being uninited.
      
      Fixes: e62a2027 ("RDMA/hns: support RoCE bonding")
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      8d3ee0ae
    • J
      RDMA/hns: Simplify the slave uninit logic of RoCE bonding operations · bc80b728
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      Currently, bond group resource is always associated to a main_hr_dev
      whether bond device has been set or not. When setting bond, all slaves,
      including the main_hr_dev, will be uninited. Normally, during main_hr_dev
      uninit, the bond group resource is also released. However, the bond group
      resource should not be released in the case of setting bond.
      
      To avoid releasing bond group resource when setting bond, the code logic
      is like:
          1. uninit a not-main_hr_dev slave
          2. register bond device, with the slave in step 1 becoming the new
             main_hr_dev
          3. uninit the original main_hr_dev.
      In step 3, the slave is not current main_hr_dev any more, so during its
      uninit, bond group resource will not be released. But in general, the
      logic is not simple enough to understand.
      
      This patch adds an argument 'bond_cleanup' to
      __hns_roce_hw_v2_uninit_instance() in order to indicate whether bond
      group resources should be released during RoCE driver uninit. During
      driver uninit when setting bond or clearing bond, 'bond_cleanup' is false;
      when RoCE driver kernel object is being removed , 'bond_cleanup' is true.
      
      With this change and the previous patch, bonding operations including
      bond setting, bond clearing and decreasing slave do not have to concern
      about avoiding releasing bond_grp when uniniting hr_dev. The uninit
      order is simplified to a more intuitive one: simply uninit all slaves and
      then register the bond device.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      bc80b728
    • J
      RDMA/hns: Remove the struct member 'bond_grp' from hns_roce_dev · 9003ac2a
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      Currently, bond_grp is attached to only one hr_dev corresponding to a
      slave in RoCE bonding, which is called main_hr_dev in the driver. When
      a non-main_hr_dev try to obtain its bond_grp, the driver has to find
      the main_hr_dev, and then obtain the bond_grp, which leads to a
      complicated code.
      
      Applying this patch, bond_grp is removed from struct hns_roce_dev. hr_dev
      can obtain bond_grp by XArray, where die_info and bond_grp are stored
      according to bus number. With this change, hr_dev can get its bond_grp
      directly without depending on main_hr_dev, and the code logic can be
      simplified.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      9003ac2a
    • J
      RDMA/hns: Initial value assignment cleanup for RoCE Bonding variables · 96064446
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      This patch assigns initial value when variable is defined in
      HNS RoCE Bonding driver, instead of doing so on a new line.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      96064446
    • J
      RDMA/hns: Delete a useless assignment to bond_state · 41adb38e
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      In hns_roce_slave_dec(), bond_state will be changed to
      HNS_ROCE_BOND_REGISTERING right before the current main_hr_dev
      is being removed from bond group. When the slave decrease
      operation is over, bond_state will be changed to
      HNS_ROCE_BOND_IS_BONDED in the end of this function. So the
      assignment to bond_state in the beginning of the function is
      useless and should be deleted.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      41adb38e
    • J
      RDMA/hns: Apply XArray for Bond ID allocation · 82ee5d30
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      This patch provides the ability to map an integer ID to a bond
      group pointer by:
      	1. adding a new struct hns_roce_die_info to store the
      	   pointers and IDs of bond groups on a specific I/O die.
      	2. applying XArray to map the bus number to the die info struct.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      82ee5d30
    • J
      RDMA/hns: Move bond_work from hns_roce_dev to hns_roce_bond_group · 8aeaa671
      Junxian Huang 提交于
      driver inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9
      
      ---------------------------------------------------------------
      
      Currently, bond_work, the struct of delayed work for RoCE bonding,
      is attached to hns_roce_dev. During setting bond, hns_roce_dev
      will be uninited and the pending works will be canceled.
      
      This patch moves bond_work from hns_roce_dev to hns_roce_bond_group so
      that the pending works can be executed after setting bond rather than
      being cancelled.
      Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
      8aeaa671
    • O
      !381 net: hns3: add support handling tx dhcp packets for ROH · ab866dc7
      openeuler-ci-bot 提交于
      Merge Pull Request from: @chenke1978 
       
      [Description]
      For ROH distributed scenario, EID is allocated by DHCP mode.
      Driver needs to convert the origin MAC address to EID format,
      and updates the destination MAC, chaddr and client id(if exists)
      when transmit DHCP packets. Meantime, the chaddr field should
      follow the source mac address, in order to make the dhcp
      server reply to the right client. For the payload of
      dhcp packet changed, so the checksum of L4 should be
      calculated too.
      
      [Testing]
      kernel options:
      CONFIG_ROH=m
      CONFIG_ROH_HNS=m
      
      Test passed with below step:
      1. Load the NIC/ROCE/ROH driver normally on the ROH device.
      2. Preparing the DHCP Server and DHCP Client applications
      3. Enable the DHCP service on the server node.
      4. Execute the DHCP client application on the client node.
      5. Check the DHCP process and wait until the DHCP IP address
         allocation is complete.
      6. The communication is normal based on the new IP address.
      
          
       
      Link:https://gitee.com/openeuler/kernel/pulls/381 
      
      Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
      ab866dc7
    • K
      net: hns3: add support handling tx dhcp packets for ROH · 19f053b7
      Ke Chen 提交于
      driver inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6BSMN
      
      -----------------------------------------------------------------------
      
      For ROH distributed scenario, EID is allocated by DHCP mode.
      Driver needs to convert the origin MAC address to EID format,
      and updates the destination MAC, chaddr and client id(if exists)
      when transmit DHCP packets. Meantime, the chaddr field should
      follow the source mac address, in order to make the dhcp
      server reply to the right client. For the payload of
      dhcp packet changed, so the checksum of L4 should be
      calculated too.
      Signed-off-by: NJian Shen <shenjian15@huawei.com>
      Signed-off-by: NKe Chen <chenke54@huawei.com>
      19f053b7
    • O
      !617 Support geting xrcd num from firmware · 02362c9c
      openeuler-ci-bot 提交于
      Merge Pull Request from: @stinft 
       
      Support driver gets the num_xrcds and reserved_xrcds from firmware.
      #I6WAZI 
       
      Link:https://gitee.com/openeuler/kernel/pulls/617 
      
      Reviewed-by: Chengchang Tang <tangchengchang@huawei.com> 
      Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
      02362c9c
    • L
      RDMA/hns: Support getting xrcd num from firmware · bbfeb5d8
      Luoyouming 提交于
      driver inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6WAZI
      
      ---------------------------------------------------------------
      
      Support driver gets the num_xrcds and reserved_xrcds from firmware.
      Signed-off-by: NLuoyouming <luoyouming@huawei.com>
      Signed-off-by: NChengchang Tang <tangchengchang@huawei.com>
      bbfeb5d8
  2. 26 4月, 2023 21 次提交