Commit c1fec890 authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Paolo Abeni

ethernet/intel: Use list_for_each_entry() helper

Convert list_for_each() to list_for_each_entry() where applicable.

No functional changed.
Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230919170409.1581074-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent f940d704
...@@ -7857,7 +7857,6 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, ...@@ -7857,7 +7857,6 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
{ {
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
struct vf_data_storage *vf_data = &adapter->vf_data[vf]; struct vf_data_storage *vf_data = &adapter->vf_data[vf];
struct list_head *pos;
struct vf_mac_filter *entry = NULL; struct vf_mac_filter *entry = NULL;
int ret = 0; int ret = 0;
...@@ -7878,8 +7877,7 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, ...@@ -7878,8 +7877,7 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
switch (info) { switch (info) {
case E1000_VF_MAC_FILTER_CLR: case E1000_VF_MAC_FILTER_CLR:
/* remove all unicast MAC filters related to the current VF */ /* remove all unicast MAC filters related to the current VF */
list_for_each(pos, &adapter->vf_macs.l) { list_for_each_entry(entry, &adapter->vf_macs.l, l) {
entry = list_entry(pos, struct vf_mac_filter, l);
if (entry->vf == vf) { if (entry->vf == vf) {
entry->vf = -1; entry->vf = -1;
entry->free = true; entry->free = true;
...@@ -7889,8 +7887,7 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, ...@@ -7889,8 +7887,7 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
break; break;
case E1000_VF_MAC_FILTER_ADD: case E1000_VF_MAC_FILTER_ADD:
/* try to find empty slot in the list */ /* try to find empty slot in the list */
list_for_each(pos, &adapter->vf_macs.l) { list_for_each_entry(entry, &adapter->vf_macs.l, l) {
entry = list_entry(pos, struct vf_mac_filter, l);
if (entry->free) if (entry->free)
break; break;
} }
......
...@@ -639,12 +639,10 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, ...@@ -639,12 +639,10 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
int vf, int index, unsigned char *mac_addr) int vf, int index, unsigned char *mac_addr)
{ {
struct vf_macvlans *entry; struct vf_macvlans *entry;
struct list_head *pos;
int retval = 0; int retval = 0;
if (index <= 1) { if (index <= 1) {
list_for_each(pos, &adapter->vf_mvs.l) { list_for_each_entry(entry, &adapter->vf_mvs.l, l) {
entry = list_entry(pos, struct vf_macvlans, l);
if (entry->vf == vf) { if (entry->vf == vf) {
entry->vf = -1; entry->vf = -1;
entry->free = true; entry->free = true;
...@@ -664,8 +662,7 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter, ...@@ -664,8 +662,7 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
entry = NULL; entry = NULL;
list_for_each(pos, &adapter->vf_mvs.l) { list_for_each_entry(entry, &adapter->vf_mvs.l, l) {
entry = list_entry(pos, struct vf_macvlans, l);
if (entry->free) if (entry->free)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment