Skip to content

Commit 876ea04

Browse files
Andre GuedesJeff Kirsher
authored andcommitted
igc: Early return in igc_get_ethtool_nfc_entry()
This patch re-writes the second half of igc_ethtool_get_nfc_entry() to follow the 'return early' pattern seen in other parts of the driver and removes some duplicate comments. Signed-off-by: Andre Guedes <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 8b9c23c commit 876ea04

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

drivers/net/ethernet/intel/igc/igc_ethtool.c

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -945,38 +945,36 @@ static int igc_get_ethtool_nfc_entry(struct igc_adapter *adapter,
945945
if (!rule || fsp->location != rule->sw_idx)
946946
return -EINVAL;
947947

948-
if (rule->filter.match_flags) {
949-
fsp->flow_type = ETHER_FLOW;
950-
fsp->ring_cookie = rule->action;
951-
if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
952-
fsp->h_u.ether_spec.h_proto = rule->filter.etype;
953-
fsp->m_u.ether_spec.h_proto = ETHER_TYPE_FULL_MASK;
954-
}
955-
if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
956-
fsp->flow_type |= FLOW_EXT;
957-
fsp->h_ext.vlan_tci = rule->filter.vlan_tci;
958-
fsp->m_ext.vlan_tci = htons(VLAN_PRIO_MASK);
959-
}
960-
if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) {
961-
ether_addr_copy(fsp->h_u.ether_spec.h_dest,
962-
rule->filter.dst_addr);
963-
/* As we only support matching by the full
964-
* mask, return the mask to userspace
965-
*/
966-
eth_broadcast_addr(fsp->m_u.ether_spec.h_dest);
967-
}
968-
if (rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) {
969-
ether_addr_copy(fsp->h_u.ether_spec.h_source,
970-
rule->filter.src_addr);
971-
/* As we only support matching by the full
972-
* mask, return the mask to userspace
973-
*/
974-
eth_broadcast_addr(fsp->m_u.ether_spec.h_source);
975-
}
948+
if (!rule->filter.match_flags)
949+
return -EINVAL;
976950

977-
return 0;
951+
fsp->flow_type = ETHER_FLOW;
952+
fsp->ring_cookie = rule->action;
953+
954+
if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
955+
fsp->h_u.ether_spec.h_proto = rule->filter.etype;
956+
fsp->m_u.ether_spec.h_proto = ETHER_TYPE_FULL_MASK;
978957
}
979-
return -EINVAL;
958+
959+
if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
960+
fsp->flow_type |= FLOW_EXT;
961+
fsp->h_ext.vlan_tci = rule->filter.vlan_tci;
962+
fsp->m_ext.vlan_tci = htons(VLAN_PRIO_MASK);
963+
}
964+
965+
if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) {
966+
ether_addr_copy(fsp->h_u.ether_spec.h_dest,
967+
rule->filter.dst_addr);
968+
eth_broadcast_addr(fsp->m_u.ether_spec.h_dest);
969+
}
970+
971+
if (rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) {
972+
ether_addr_copy(fsp->h_u.ether_spec.h_source,
973+
rule->filter.src_addr);
974+
eth_broadcast_addr(fsp->m_u.ether_spec.h_source);
975+
}
976+
977+
return 0;
980978
}
981979

982980
static int igc_get_ethtool_nfc_all(struct igc_adapter *adapter,

0 commit comments

Comments
 (0)