Commit 9812a9d6 authored by David S. Miller's avatar David S. Miller

Merge branch 'be2net'

Sathya Perla says:

====================
The following patches are mostly for providing MAC
filtering ability for VFs. Pls apply. Thanks!
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e18dbf7e 2d17f403
...@@ -1339,6 +1339,10 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, ...@@ -1339,6 +1339,10 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
if (!status) { if (!status) {
struct be_cmd_resp_if_create *resp = embedded_payload(wrb); struct be_cmd_resp_if_create *resp = embedded_payload(wrb);
*if_handle = le32_to_cpu(resp->interface_id); *if_handle = le32_to_cpu(resp->interface_id);
/* Hack to retrieve VF's pmac-id on BE3 */
if (BE3_chip(adapter) && !be_physfn(adapter))
adapter->pmac_id[0] = le32_to_cpu(resp->pmac_id);
} }
err: err:
...@@ -2606,9 +2610,44 @@ int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege, ...@@ -2606,9 +2610,44 @@ int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
return status; return status;
} }
/* Uses synchronous MCCQ */ /* Set privilege(s) for a function */
int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,
u32 domain)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_set_fn_privileges *req;
int status;
spin_lock_bh(&adapter->mcc_lock);
wrb = wrb_from_mccq(adapter);
if (!wrb) {
status = -EBUSY;
goto err;
}
req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_SET_FN_PRIVILEGES, sizeof(*req),
wrb, NULL);
req->hdr.domain = domain;
if (lancer_chip(adapter))
req->privileges_lancer = cpu_to_le32(privileges);
else
req->privileges = cpu_to_le32(privileges);
status = be_mcc_notify_wait(adapter);
err:
spin_unlock_bh(&adapter->mcc_lock);
return status;
}
/* pmac_id_valid: true => pmac_id is supplied and MAC address is requested.
* pmac_id_valid: false => pmac_id or MAC address is requested.
* If pmac_id is returned, pmac_id_valid is returned as true
*/
int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
bool *pmac_id_active, u32 *pmac_id, u8 domain) bool *pmac_id_valid, u32 *pmac_id, u8 domain)
{ {
struct be_mcc_wrb *wrb; struct be_mcc_wrb *wrb;
struct be_cmd_req_get_mac_list *req; struct be_cmd_req_get_mac_list *req;
...@@ -2644,12 +2683,25 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, ...@@ -2644,12 +2683,25 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
get_mac_list_cmd.size, wrb, &get_mac_list_cmd); get_mac_list_cmd.size, wrb, &get_mac_list_cmd);
req->hdr.domain = domain; req->hdr.domain = domain;
req->mac_type = MAC_ADDRESS_TYPE_NETWORK; req->mac_type = MAC_ADDRESS_TYPE_NETWORK;
if (*pmac_id_valid) {
req->mac_id = cpu_to_le32(*pmac_id);
req->iface_id = cpu_to_le16(adapter->if_handle);
req->perm_override = 0;
} else {
req->perm_override = 1; req->perm_override = 1;
}
status = be_mcc_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
if (!status) { if (!status) {
struct be_cmd_resp_get_mac_list *resp = struct be_cmd_resp_get_mac_list *resp =
get_mac_list_cmd.va; get_mac_list_cmd.va;
if (*pmac_id_valid) {
memcpy(mac, resp->macid_macaddr.mac_addr_id.macaddr,
ETH_ALEN);
goto out;
}
mac_count = resp->true_mac_count + resp->pseudo_mac_count; mac_count = resp->true_mac_count + resp->pseudo_mac_count;
/* Mac list returned could contain one or more active mac_ids /* Mac list returned could contain one or more active mac_ids
* or one or more true or pseudo permanant mac addresses. * or one or more true or pseudo permanant mac addresses.
...@@ -2667,14 +2719,14 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, ...@@ -2667,14 +2719,14 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
* is 6 bytes * is 6 bytes
*/ */
if (mac_addr_size == sizeof(u32)) { if (mac_addr_size == sizeof(u32)) {
*pmac_id_active = true; *pmac_id_valid = true;
mac_id = mac_entry->mac_addr_id.s_mac_id.mac_id; mac_id = mac_entry->mac_addr_id.s_mac_id.mac_id;
*pmac_id = le32_to_cpu(mac_id); *pmac_id = le32_to_cpu(mac_id);
goto out; goto out;
} }
} }
/* If no active mac_id found, return first mac addr */ /* If no active mac_id found, return first mac addr */
*pmac_id_active = false; *pmac_id_valid = false;
memcpy(mac, resp->macaddr_list[0].mac_addr_id.macaddr, memcpy(mac, resp->macaddr_list[0].mac_addr_id.macaddr,
ETH_ALEN); ETH_ALEN);
} }
...@@ -2686,6 +2738,41 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, ...@@ -2686,6 +2738,41 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
return status; return status;
} }
int be_cmd_get_active_mac(struct be_adapter *adapter, u32 curr_pmac_id, u8 *mac)
{
bool active = true;
if (BEx_chip(adapter))
return be_cmd_mac_addr_query(adapter, mac, false,
adapter->if_handle, curr_pmac_id);
else
/* Fetch the MAC address using pmac_id */
return be_cmd_get_mac_from_list(adapter, mac, &active,
&curr_pmac_id, 0);
}
int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
{
int status;
bool pmac_valid = false;
memset(mac, 0, ETH_ALEN);
if (BEx_chip(adapter)) {
if (be_physfn(adapter))
status = be_cmd_mac_addr_query(adapter, mac, true, 0,
0);
else
status = be_cmd_mac_addr_query(adapter, mac, false,
adapter->if_handle, 0);
} else {
status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid,
NULL, 0);
}
return status;
}
/* Uses synchronous MCCQ */ /* Uses synchronous MCCQ */
int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array,
u8 mac_count, u32 domain) u8 mac_count, u32 domain)
...@@ -2729,6 +2816,25 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, ...@@ -2729,6 +2816,25 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array,
return status; return status;
} }
/* Wrapper to delete any active MACs and provision the new mac.
* Changes to MAC_LIST are allowed iff none of the MAC addresses in the
* current list are active.
*/
int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom)
{
bool active_mac = false;
u8 old_mac[ETH_ALEN];
u32 pmac_id;
int status;
status = be_cmd_get_mac_from_list(adapter, old_mac, &active_mac,
&pmac_id, dom);
if (!status && active_mac)
be_cmd_pmac_del(adapter, if_id, pmac_id, dom);
return be_cmd_set_mac_list(adapter, mac, mac ? 1 : 0, dom);
}
int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid,
u32 domain, u16 intf_id) u32 domain, u16 intf_id)
{ {
......
...@@ -202,6 +202,7 @@ struct be_mcc_mailbox { ...@@ -202,6 +202,7 @@ struct be_mcc_mailbox {
#define OPCODE_COMMON_READ_TRANSRECV_DATA 73 #define OPCODE_COMMON_READ_TRANSRECV_DATA 73
#define OPCODE_COMMON_GET_PORT_NAME 77 #define OPCODE_COMMON_GET_PORT_NAME 77
#define OPCODE_COMMON_SET_INTERRUPT_ENABLE 89 #define OPCODE_COMMON_SET_INTERRUPT_ENABLE 89
#define OPCODE_COMMON_SET_FN_PRIVILEGES 100
#define OPCODE_COMMON_GET_PHY_DETAILS 102 #define OPCODE_COMMON_GET_PHY_DETAILS 102
#define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103 #define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103
#define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121 #define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121
...@@ -1474,6 +1475,11 @@ struct be_cmd_resp_get_fn_privileges { ...@@ -1474,6 +1475,11 @@ struct be_cmd_resp_get_fn_privileges {
u32 privilege_mask; u32 privilege_mask;
}; };
struct be_cmd_req_set_fn_privileges {
struct be_cmd_req_hdr hdr;
u32 privileges; /* Used by BE3, SH-R */
u32 privileges_lancer; /* Used by Lancer */
};
/******************** GET/SET_MACLIST **************************/ /******************** GET/SET_MACLIST **************************/
#define BE_MAX_MAC 64 #define BE_MAX_MAC 64
...@@ -1921,11 +1927,18 @@ extern int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size); ...@@ -1921,11 +1927,18 @@ extern int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size);
extern void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf); extern void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);
extern int be_cmd_get_fn_privileges(struct be_adapter *adapter, extern int be_cmd_get_fn_privileges(struct be_adapter *adapter,
u32 *privilege, u32 domain); u32 *privilege, u32 domain);
extern int be_cmd_set_fn_privileges(struct be_adapter *adapter,
u32 privileges, u32 vf_num);
extern int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, extern int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
bool *pmac_id_active, u32 *pmac_id, bool *pmac_id_active, u32 *pmac_id,
u8 domain); u8 domain);
extern int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id,
u8 *mac);
extern int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac);
extern int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, extern int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array,
u8 mac_count, u32 domain); u8 mac_count, u32 domain);
extern int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id,
u32 dom);
extern int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, extern int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid,
u32 domain, u16 intf_id); u32 domain, u16 intf_id);
extern int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, extern int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid,
......
This diff is collapsed.
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