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

Commit 07a251c8 authored by Shahed Shaikh's avatar Shahed Shaikh Committed by David S. Miller
Browse files

qlcnic: Implement ndo_get_phys_port_id for 82xx adapter



Each function driver instance uses the MAC address of the
lowest function belonging to that physical port as a unique
port identifier. This port identifier is read and cached in
driver during probe and provided to user space through
ndo_get_phys_port_id()

Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c2c5e3a0
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -471,6 +471,7 @@ struct qlcnic_hardware_context {
	u32 mbox_reg[4];
	struct qlcnic_mailbox *mailbox;
	u8 extend_lb_time;
	u8 phys_port_id[ETH_ALEN];
};

struct qlcnic_adapter_stats {
@@ -926,6 +927,8 @@ struct qlcnic_ipaddr {
#define QLCNIC_FW_LRO_MSS_CAP		0x8000
#define QLCNIC_TX_INTR_SHARED		0x10000
#define QLCNIC_APP_CHANGED_FLAGS	0x20000
#define QLCNIC_HAS_PHYS_PORT_ID		0x40000

#define QLCNIC_IS_MSI_FAMILY(adapter) \
	((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
#define QLCNIC_IS_TSO_CAPABLE(adapter)  \
@@ -1510,6 +1513,7 @@ void __qlcnic_set_multi(struct net_device *, u16);
int qlcnic_nic_add_mac(struct qlcnic_adapter *, const u8 *, u16);
int qlcnic_nic_del_mac(struct qlcnic_adapter *, const u8 *);
void qlcnic_82xx_free_mac_list(struct qlcnic_adapter *adapter);
int qlcnic_82xx_read_phys_port_id(struct qlcnic_adapter *);

int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu);
int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *, u32);
@@ -1679,7 +1683,7 @@ struct qlcnic_hardware_ops {
	int (*read_reg) (struct qlcnic_adapter *, ulong, int *);
	int (*write_reg) (struct qlcnic_adapter *, ulong, u32);
	void (*get_ocm_win) (struct qlcnic_hardware_context *);
	int (*get_mac_address) (struct qlcnic_adapter *, u8 *);
	int (*get_mac_address) (struct qlcnic_adapter *, u8 *, u8);
	int (*setup_intr) (struct qlcnic_adapter *, u8, int);
	int (*alloc_mbx_args)(struct qlcnic_cmd_args *,
			      struct qlcnic_adapter *, u32);
@@ -1713,6 +1717,7 @@ struct qlcnic_hardware_ops {
	int (*get_board_info) (struct qlcnic_adapter *);
	void (*set_mac_filter_count) (struct qlcnic_adapter *);
	void (*free_mac_list) (struct qlcnic_adapter *);
	int (*read_phys_port_id) (struct qlcnic_adapter *);
};

extern struct qlcnic_nic_template qlcnic_vf_ops;
@@ -1741,9 +1746,9 @@ static inline int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter,
}

static inline int qlcnic_get_mac_address(struct qlcnic_adapter *adapter,
					 u8 *mac)
					 u8 *mac, u8 function)
{
	return adapter->ahw->hw_ops->get_mac_address(adapter, mac);
	return adapter->ahw->hw_ops->get_mac_address(adapter, mac, function);
}

static inline int qlcnic_setup_intr(struct qlcnic_adapter *adapter,
@@ -1940,6 +1945,12 @@ static inline void qlcnic_set_mac_filter_count(struct qlcnic_adapter *adapter)
		adapter->ahw->hw_ops->set_mac_filter_count(adapter);
}

static inline void qlcnic_read_phys_port_id(struct qlcnic_adapter *adapter)
{
	if (adapter->ahw->hw_ops->read_phys_port_id)
		adapter->ahw->hw_ops->read_phys_port_id(adapter);
}

static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter,
					    u32 key)
{
+3 −1
Original line number Diff line number Diff line
@@ -2037,12 +2037,14 @@ void qlcnic_83xx_configure_mac(struct qlcnic_adapter *adapter, u8 *mac,
	cmd->req.arg[1] = type;
}

int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac)
int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac,
				u8 function)
{
	int err, i;
	struct qlcnic_cmd_args cmd;
	u32 mac_low, mac_high;

	function = 0;
	err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_MAC_ADDRESS);
	if (err)
		return err;
+1 −1
Original line number Diff line number Diff line
@@ -564,7 +564,7 @@ int qlcnic_83xx_setup_link_event(struct qlcnic_adapter *, int);
void qlcnic_83xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *);
int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *, bool);
int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *, u8 *, u16, u8);
int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *, u8 *);
int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *, u8 *, u8);
void qlcnic_83xx_configure_mac(struct qlcnic_adapter *, u8 *, u8,
			       struct qlcnic_cmd_args *);
int qlcnic_83xx_alloc_mbx_args(struct qlcnic_cmd_args *,
+3 −2
Original line number Diff line number Diff line
@@ -821,7 +821,8 @@ int qlcnic_82xx_config_intrpt(struct qlcnic_adapter *adapter, u8 op_type)
	return err;
}

int qlcnic_82xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac)
int qlcnic_82xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac,
				u8 function)
{
	int err, i;
	struct qlcnic_cmd_args cmd;
@@ -831,7 +832,7 @@ int qlcnic_82xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac)
	if (err)
		return err;

	cmd.req.arg[1] = adapter->ahw->pci_func | BIT_8;
	cmd.req.arg[1] = function | BIT_8;
	err = qlcnic_issue_cmd(adapter, &cmd);

	if (err == QLCNIC_RCODE_SUCCESS) {
+16 −0
Original line number Diff line number Diff line
@@ -740,6 +740,22 @@ int qlcnic_82xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
	return 0;
}

int qlcnic_82xx_read_phys_port_id(struct qlcnic_adapter *adapter)
{
	u8 mac[ETH_ALEN];
	int ret;

	ret = qlcnic_get_mac_address(adapter, mac,
				     adapter->ahw->physical_port);
	if (ret)
		return ret;

	memcpy(adapter->ahw->phys_port_id, mac, ETH_ALEN);
	adapter->flags |= QLCNIC_HAS_PHYS_PORT_ID;

	return 0;
}

/*
 * Send the interrupt coalescing parameter set by ethtool to the card.
 */
Loading