Commit 876ea04d authored by Andre Guedes's avatar Andre Guedes Committed by Jeff Kirsher
Browse files

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: default avatarAndre Guedes <andre.guedes@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 8b9c23cd
Loading
Loading
Loading
Loading
+28 −30
Original line number Diff line number Diff line
@@ -945,39 +945,37 @@ static int igc_get_ethtool_nfc_entry(struct igc_adapter *adapter,
	if (!rule || fsp->location != rule->sw_idx)
		return -EINVAL;

	if (rule->filter.match_flags) {
	if (!rule->filter.match_flags)
		return -EINVAL;

	fsp->flow_type = ETHER_FLOW;
	fsp->ring_cookie = rule->action;

	if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
		fsp->h_u.ether_spec.h_proto = rule->filter.etype;
		fsp->m_u.ether_spec.h_proto = ETHER_TYPE_FULL_MASK;
	}

	if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
		fsp->flow_type |= FLOW_EXT;
		fsp->h_ext.vlan_tci = rule->filter.vlan_tci;
		fsp->m_ext.vlan_tci = htons(VLAN_PRIO_MASK);
	}

	if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) {
		ether_addr_copy(fsp->h_u.ether_spec.h_dest,
				rule->filter.dst_addr);
			/* As we only support matching by the full
			 * mask, return the mask to userspace
			 */
		eth_broadcast_addr(fsp->m_u.ether_spec.h_dest);
	}

	if (rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) {
		ether_addr_copy(fsp->h_u.ether_spec.h_source,
				rule->filter.src_addr);
			/* As we only support matching by the full
			 * mask, return the mask to userspace
			 */
		eth_broadcast_addr(fsp->m_u.ether_spec.h_source);
	}

	return 0;
}
	return -EINVAL;
}

static int igc_get_ethtool_nfc_all(struct igc_adapter *adapter,
				   struct ethtool_rxnfc *cmd,