Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89938fa6 authored by Mark Starovoytov's avatar Mark Starovoytov Committed by Jinesh K. Jayakumar
Browse files

atlantic forwarding driver v1.0.31



  [ATLDRV-1243] - Clean up MACsec implementat ion
  [ATLDRV-1135] - ethtool shows incorrect Flow Control information
  [ATLDRV-1229] - HW access on mdo_dev_stop(ctx->prepare)
  [ATLDRV-1256] - AQ072: Static analysis error in atl_setup_datapath()
  [ATLDRV-1303] - Make driver C90 compilable
  [ATLDRV-1064] - Fwd: Software flowcontrol workaround adaptations

Change-Id: I10c78a378d43904ca721bf46466a29654a5db85b
Signed-off: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off: Mark Starovoytov <mstarovoitov@marvell.com>
Co-authored-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
Git-commit: 0f9c9e19e318bbb2180273c80f513f7128a9caf4
Git-repo: https://github.com/aquantia/linux-4.14-atlantic-forwarding


Signed-off-by: default avatarJinesh K. Jayakumar <jineshk@codeaurora.org>
parent 00d10708
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include <linux/netdevice.h>
#include <linux/moduleparam.h>

#define ATL_VERSION "1.0.30"
#define ATL_VERSION "1.0.31"

struct atl_nic;
enum atl_fwd_notify;
@@ -38,7 +38,8 @@ enum {
	ATL_RXF_VLAN_MAX = ATL_VLAN_FLT_NUM,
	ATL_RXF_ETYPE_BASE = ATL_RXF_VLAN_BASE + ATL_RXF_VLAN_MAX,
	ATL_RXF_ETYPE_MAX = ATL_ETYPE_FLT_NUM,
	ATL_RXF_NTUPLE_BASE = ATL_RXF_ETYPE_BASE + ATL_RXF_ETYPE_MAX,
	/* + 1 is for backward compatibility */
	ATL_RXF_NTUPLE_BASE = ATL_RXF_ETYPE_BASE + ATL_RXF_ETYPE_MAX + 1,
	ATL_RXF_NTUPLE_MAX = ATL_NTUPLE_FLT_NUM,
	ATL_RXF_FLEX_BASE = ATL_RXF_NTUPLE_BASE + ATL_RXF_NTUPLE_MAX,
	ATL_RXF_FLEX_MAX = 1,
@@ -266,9 +267,6 @@ enum atl_priv_flag_bits {
extern const char atl_driver_name[];

extern const struct ethtool_ops atl_ethtool_ops;
#ifdef NETIF_F_HW_MACSEC
extern const struct macsec_ops atl_macsec_ops;
#endif

extern unsigned int atl_max_queues;
extern unsigned int atl_max_queues_non_msi;
@@ -351,11 +349,5 @@ int atl_update_thermal_flag(struct atl_hw *hw, int bit, bool val);
int atl_verify_thermal_limits(struct atl_hw *hw, struct atl_thermal *thermal);
int atl_do_reset(struct atl_nic *nic);
int atl_set_media_detect(struct atl_nic *nic, bool on);
int atl_init_macsec(struct atl_hw *hw);
void atl_macsec_work(struct atl_nic *nic);
int atl_macsec_rx_sa_cnt(struct atl_hw *hw);
int atl_macsec_tx_sc_cnt(struct atl_hw *hw);
int atl_macsec_tx_sa_cnt(struct atl_hw *hw);
int atl_macsec_update_stats(struct atl_hw *hw);

#endif
+21 −16
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include "atl_mdio.h"
#include "atl_ring.h"
#include "atl_fwdnl.h"
#include "atl_macsec.h"

static uint32_t atl_ethtool_get_link(struct net_device *ndev)
{
@@ -409,8 +410,8 @@ static void atl_get_pauseparam(struct net_device *ndev,
	struct atl_fc_state *fc = &nic->hw.link_state.fc;

	pause->autoneg = 0;
	pause->rx_pause = !!(fc->cur & atl_fc_rx);
	pause->tx_pause = !!(fc->cur & atl_fc_tx);
	pause->rx_pause = !!(fc->req & atl_fc_rx);
	pause->tx_pause = !!(fc->req & atl_fc_tx);
}

static int atl_set_pauseparam(struct net_device *ndev,
@@ -636,7 +637,7 @@ static const char atl_priv_flags[][ETH_GSTRING_LEN] = {
	ATL_PRIV_FLAG(MediaDetect, MEDIA_DETECT),
};

#ifdef NETIF_F_HW_MACSEC
#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)

#define ATL_MACSEC_STAT(_name, _field)					\
{									\
@@ -737,7 +738,7 @@ static int atl_get_sset_count(struct net_device *ndev, int sset)
		       + ARRAY_SIZE(rx_stat_descs) *
				 hweight_long(nic->fwd.ring_map[ATL_FWDIR_RX])
#endif
#ifdef NETIF_F_HW_MACSEC
#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)
		       + ARRAY_SIZE(macsec_stat_descs)
		       + ARRAY_SIZE(macsec_tx_sc_stat_descs) *
				 atl_macsec_tx_sc_cnt(&nic->hw)
@@ -810,17 +811,18 @@ static void atl_get_strings(struct net_device *ndev, uint32_t sset,
					ARRAY_SIZE(rx_stat_descs));
		}
#endif
#ifdef NETIF_F_HW_MACSEC
#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)
		atl_copy_stats_strings(&p, "macsec_", macsec_stat_descs,
				       ARRAY_SIZE(macsec_stat_descs));

		for (i = 0; i < ATL_MACSEC_MAX_SC; i++) {
			if (!(test_bit(i, &nic->hw.macsec_cfg.txsc_idx_busy)))
				continue;
			struct atl_macsec_txsc *atl_txsc =
				&nic->hw.macsec_cfg.atl_txsc[i];
			int assoc_num;

			if (!(test_bit(i, &nic->hw.macsec_cfg.txsc_idx_busy)))
				continue;

			snprintf(prefix, sizeof(prefix), "txsc%d_",
				 atl_txsc->hw_sc_idx);
			atl_copy_stats_strings(
@@ -839,12 +841,13 @@ static void atl_get_strings(struct net_device *ndev, uint32_t sset,
			}
		}
		for (i = 0; i < ATL_MACSEC_MAX_SC; i++) {
			if (!(test_bit(i, &nic->hw.macsec_cfg.rxsc_idx_busy)))
				continue;
			struct atl_macsec_rxsc *atl_rxsc =
				&nic->hw.macsec_cfg.atl_rxsc[i];
			int assoc_num;

			if (!(test_bit(i, &nic->hw.macsec_cfg.rxsc_idx_busy)))
				continue;

			for (assoc_num = 0; assoc_num < MACSEC_NUM_AN;
			     assoc_num++) {
				if (!test_bit(assoc_num,
@@ -884,7 +887,7 @@ static void atl_get_ethtool_stats(struct net_device *ndev,

	atl_update_eth_stats(nic);
	atl_update_global_stats(nic);
#ifdef NETIF_F_HW_MACSEC
#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)
	atl_macsec_update_stats(&nic->hw);
#endif
	atl_write_stats(&nic->stats.tx, tx_stat_descs, data, uint64_t);
@@ -918,16 +921,17 @@ static void atl_get_ethtool_stats(struct net_device *ndev,
		}
	}
#endif
#ifdef NETIF_F_HW_MACSEC
	int assoc_num;
#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)
	atl_write_stats(&nic->hw.macsec_cfg.stats, macsec_stat_descs, data,
			uint64_t);

	for (i = 0; i < ATL_MACSEC_MAX_SC; i++) {
		if (!(test_bit(i, &nic->hw.macsec_cfg.txsc_idx_busy)))
			continue;
		struct atl_macsec_txsc *atl_txsc =
			&nic->hw.macsec_cfg.atl_txsc[i];
		int assoc_num;

		if (!(test_bit(i, &nic->hw.macsec_cfg.txsc_idx_busy)))
			continue;

		atl_write_stats(&atl_txsc->stats, macsec_tx_sc_stat_descs, data,
				uint64_t);
@@ -941,12 +945,13 @@ static void atl_get_ethtool_stats(struct net_device *ndev,
		}
	}
	for (i = 0; i < ATL_MACSEC_MAX_SC; i++) {
		if (!(test_bit(i, &nic->hw.macsec_cfg.rxsc_idx_busy)))
			continue;
		struct atl_macsec_rxsc *atl_rxsc =
			&nic->hw.macsec_cfg.atl_rxsc[i];
		int assoc_num;

		if (!(test_bit(i, &nic->hw.macsec_cfg.rxsc_idx_busy)))
			continue;

		for (assoc_num = 0; assoc_num < MACSEC_NUM_AN; assoc_num++) {
			if (!test_bit(assoc_num, &atl_rxsc->rx_sa_idx_busy))
				continue;
+9 −82
Original line number Diff line number Diff line
@@ -163,95 +163,22 @@ enum macsec_msg_type {
	macsec_get_stats_msg,
};

struct macsec_cfg {
	uint32_t enabled;
	uint32_t egress_threshold;
	uint32_t ingress_threshold;
	uint32_t interrupts_enabled;
} __attribute__((__packed__));

struct get_stats {
	uint32_t version_only;
	uint32_t ingress_sa_index;
	uint32_t egress_sa_index;
	uint32_t egress_sc_index;
struct macsec_cfg_request {
	u32 enabled;
	u32 egress_threshold;
	u32 ingress_threshold;
	u32 interrupts_enabled;
} __attribute__((__packed__));

struct macsec_msg_fw_request {
	uint32_t msg_id; /* not used */
	uint32_t msg_type;

	union {
		struct macsec_cfg cfg;
		struct get_stats stats;
	};
} __attribute__((__packed__));

struct atl_macsec_stats {
    /* Retrieve Atlantic MACSEC FW version*/
    uint32_t api_version;
    /* Ingress Common Counters */
    uint64_t In_ctl_pkts;
    uint64_t In_tagged_miss_pkts;
    uint64_t In_untagged_miss_pkts;
    uint64_t In_notag_pkts;
    uint64_t In_untagged_pkts;
    uint64_t In_bad_tag_pkts;
    uint64_t In_no_sci_pkts;
    uint64_t In_unknown_sci_pkts;
    uint64_t In_ctrl_prt_pass_pkts;
    uint64_t In_unctrl_prt_pass_pkts;
    uint64_t In_ctrl_prt_fail_pkts;
    uint64_t In_unctrl_prt_fail_pkts;
    uint64_t In_too_long_pkts;
    uint64_t In_igpoc_ctl_pkts;
    uint64_t In_ecc_error_pkts;
    uint64_t In_unctrl_hit_drop_redir;

    /* Egress Common Counters */
    uint64_t Out_ctl_pkts;
    uint64_t Out_unknown_sa_pkts;
    uint64_t Out_untagged_pkts;
    uint64_t Out_too_long;
    uint64_t Out_ecc_error_pkts;
    uint64_t Out_unctrl_hit_drop_redir;

    /* Ingress SA Counters */
    uint64_t In_untagged_hit_pkts;
    uint64_t In_ctrl_hit_drop_redir_pkts;
    uint64_t In_not_using_sa;
    uint64_t In_unused_sa;
    uint64_t In_not_valid_pkts;
    uint64_t In_invalid_pkts;
    uint64_t In_ok_pkts;
    uint64_t In_late_pkts;
    uint64_t In_delayed_pkts;
    uint64_t In_unchecked_pkts;
    uint64_t In_validated_octets;
    uint64_t In_decrypted_octets;

    /* Egress SA Counters */
    uint64_t Out_sa_hit_drop_redirect;
    uint64_t Out_sa_protected2_pkts;
    uint64_t Out_sa_protected_pkts;
    uint64_t Out_sa_encrypted_pkts;

    /* Egress SC Counters */
    uint64_t Out_sc_protected_pkts;
    uint64_t Out_sc_encrypted_pkts;
    uint64_t Out_sc_protected_octets;
    uint64_t Out_sc_encrypted_octets;
	u32 msg_id; /* not used */
	u32 msg_type;

    /* SA Counters expiration info */
    uint32_t egress_threshold_expired;
    uint32_t ingress_threshold_expired;
    uint32_t egress_expired;
    uint32_t ingress_expired;
	struct macsec_cfg_request cfg;
} __attribute__((__packed__));

struct macsec_msg_fw_response {
	uint32_t result;
	struct atl_macsec_stats stats;
	u32 result;
} __attribute__((__packed__));

struct atl_fw_ops {
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ void atl_refresh_link(struct atl_nic *nic)
			atl_nic_info("Link up: %s\n", link->name);
			netif_carrier_on(nic->ndev);
			pm_runtime_get_sync(&nic->hw.pdev->dev);
#ifdef NETIF_F_HW_MACSEC
#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)
			atl_init_macsec(hw);
#endif
		}
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ struct atl_hw {
	struct atl_thermal thermal;
#define ATL_FW_CFG_DUMP_SIZE 2
	uint32_t fw_cfg_dump[ATL_FW_CFG_DUMP_SIZE];
#ifdef NETIF_F_HW_MACSEC
#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)
	struct atl_macsec_cfg macsec_cfg;
#endif
};
Loading