summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/mcdi_mac.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-09-14 17:30:10 +0100
committerBen Hutchings <bhutchings@solarflare.com>2013-08-21 16:35:21 +0100
commit59cfc479b2c8ba344c8497d5c913b6cba2ce3755 (patch)
tree77ed4c951751fee608d73ef9d0c081199ba77372 /drivers/net/ethernet/sfc/mcdi_mac.c
parentab0115fc7dc429300fc6b728ab04ee832fbb945d (diff)
downloadop-kernel-dev-59cfc479b2c8ba344c8497d5c913b6cba2ce3755.zip
op-kernel-dev-59cfc479b2c8ba344c8497d5c913b6cba2ce3755.tar.gz
sfc: Introduce and use MCDI_DECLARE_BUF macro
MCDI_DECLARE_BUF declares a variable as an MCDI buffer of the requested length, adding any necessary padding. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/mcdi_mac.c')
-rw-r--r--drivers/net/ethernet/sfc/mcdi_mac.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi_mac.c b/drivers/net/ethernet/sfc/mcdi_mac.c
index 1003f30..fafdc8e 100644
--- a/drivers/net/ethernet/sfc/mcdi_mac.c
+++ b/drivers/net/ethernet/sfc/mcdi_mac.c
@@ -15,7 +15,7 @@
int efx_mcdi_set_mac(struct efx_nic *efx)
{
u32 reject, fcntl;
- u8 cmdbytes[MC_CMD_SET_MAC_IN_LEN];
+ MCDI_DECLARE_BUF(cmdbytes, MC_CMD_SET_MAC_IN_LEN);
memcpy(cmdbytes + MC_CMD_SET_MAC_IN_ADDR_OFST,
efx->net_dev->dev_addr, ETH_ALEN);
@@ -55,7 +55,7 @@ int efx_mcdi_set_mac(struct efx_nic *efx)
bool efx_mcdi_mac_check_fault(struct efx_nic *efx)
{
- u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
+ MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LINK_OUT_LEN);
size_t outlength;
int rc;
@@ -75,7 +75,7 @@ bool efx_mcdi_mac_check_fault(struct efx_nic *efx)
int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
u32 dma_len, int enable, int clear)
{
- u8 inbuf[MC_CMD_MAC_STATS_IN_LEN];
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_MAC_STATS_IN_LEN);
int rc;
efx_dword_t *cmd_ptr;
int period = enable ? 1000 : 0;
@@ -115,16 +115,21 @@ fail:
int efx_mcdi_mac_reconfigure(struct efx_nic *efx)
{
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_SET_MCAST_HASH_IN_LEN);
int rc;
+ BUILD_BUG_ON(MC_CMD_SET_MCAST_HASH_IN_LEN !=
+ MC_CMD_SET_MCAST_HASH_IN_HASH0_OFST +
+ sizeof(efx->multicast_hash));
+
WARN_ON(!mutex_is_locked(&efx->mac_lock));
rc = efx_mcdi_set_mac(efx);
if (rc != 0)
return rc;
+ memcpy(MCDI_PTR(inbuf, SET_MCAST_HASH_IN_HASH0),
+ efx->multicast_hash.byte, sizeof(efx->multicast_hash));
return efx_mcdi_rpc(efx, MC_CMD_SET_MCAST_HASH,
- efx->multicast_hash.byte,
- sizeof(efx->multicast_hash),
- NULL, 0, NULL);
+ inbuf, sizeof(inbuf), NULL, 0, NULL);
}
OpenPOWER on IntegriCloud