Skip to content

Commit 64fecd3

Browse files
felix-caviumdavem330
authored andcommitted
liquidio: remove obsolete functions and data structures
1. Remove unused functions and data structures. 2. Change the sending of the remaining soft commands to synchronous. Signed-off-by: Weilin Chang <weilin.chang@cavium.com> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent edd572d commit 64fecd3

File tree

9 files changed

+176
-490
lines changed

9 files changed

+176
-490
lines changed

drivers/net/ethernet/cavium/liquidio/lio_core.c

Lines changed: 11 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,6 @@
3131

3232
#define OCTNIC_MAX_SG MAX_SKB_FRAGS
3333

34-
/**
35-
* \brief Callback for getting interface configuration
36-
* @param status status of request
37-
* @param buf pointer to resp structure
38-
*/
39-
void lio_if_cfg_callback(struct octeon_device *oct,
40-
u32 status __attribute__((unused)), void *buf)
41-
{
42-
struct octeon_soft_command *sc = (struct octeon_soft_command *)buf;
43-
struct liquidio_if_cfg_context *ctx;
44-
struct liquidio_if_cfg_resp *resp;
45-
46-
resp = (struct liquidio_if_cfg_resp *)sc->virtrptr;
47-
ctx = (struct liquidio_if_cfg_context *)sc->ctxptr;
48-
49-
oct = lio_get_device(ctx->octeon_id);
50-
if (resp->status)
51-
dev_err(&oct->pci_dev->dev, "nic if cfg instruction failed. Status: %llx\n",
52-
CVM_CAST64(resp->status));
53-
WRITE_ONCE(ctx->cond, 1);
54-
55-
snprintf(oct->fw_info.liquidio_firmware_version, 32, "%s",
56-
resp->cfg_info.liquidio_firmware_version);
57-
58-
/* This barrier is required to be sure that the response has been
59-
* written fully before waking up the handler
60-
*/
61-
wmb();
62-
63-
wake_up_interruptible(&ctx->wc);
64-
}
65-
6634
/**
6735
* \brief Delete gather lists
6836
* @param lio per-network private data
@@ -1211,30 +1179,6 @@ int octeon_setup_interrupt(struct octeon_device *oct, u32 num_ioqs)
12111179
return 0;
12121180
}
12131181

1214-
static void liquidio_change_mtu_completion(struct octeon_device *oct,
1215-
u32 status, void *buf)
1216-
{
1217-
struct octeon_soft_command *sc = (struct octeon_soft_command *)buf;
1218-
struct liquidio_if_cfg_context *ctx;
1219-
1220-
ctx = (struct liquidio_if_cfg_context *)sc->ctxptr;
1221-
1222-
if (status) {
1223-
dev_err(&oct->pci_dev->dev, "MTU change failed. Status: %llx\n",
1224-
CVM_CAST64(status));
1225-
WRITE_ONCE(ctx->cond, LIO_CHANGE_MTU_FAIL);
1226-
} else {
1227-
WRITE_ONCE(ctx->cond, LIO_CHANGE_MTU_SUCCESS);
1228-
}
1229-
1230-
/* This barrier is required to be sure that the response has been
1231-
* written fully before waking up the handler
1232-
*/
1233-
wmb();
1234-
1235-
wake_up_interruptible(&ctx->wc);
1236-
}
1237-
12381182
/**
12391183
* \brief Net device change_mtu
12401184
* @param netdev network device
@@ -1243,22 +1187,17 @@ int liquidio_change_mtu(struct net_device *netdev, int new_mtu)
12431187
{
12441188
struct lio *lio = GET_LIO(netdev);
12451189
struct octeon_device *oct = lio->oct_dev;
1246-
struct liquidio_if_cfg_context *ctx;
12471190
struct octeon_soft_command *sc;
12481191
union octnet_cmd *ncmd;
1249-
int ctx_size;
12501192
int ret = 0;
12511193

1252-
ctx_size = sizeof(struct liquidio_if_cfg_context);
12531194
sc = (struct octeon_soft_command *)
1254-
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, 16, ctx_size);
1195+
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, 16, 0);
12551196

12561197
ncmd = (union octnet_cmd *)sc->virtdptr;
1257-
ctx = (struct liquidio_if_cfg_context *)sc->ctxptr;
12581198

1259-
WRITE_ONCE(ctx->cond, 0);
1260-
ctx->octeon_id = lio_get_device_id(oct);
1261-
init_waitqueue_head(&ctx->wc);
1199+
init_completion(&sc->complete);
1200+
sc->sc_status = OCTEON_REQUEST_PENDING;
12621201

12631202
ncmd->u64 = 0;
12641203
ncmd->s.cmd = OCTNET_CMD_CHANGE_MTU;
@@ -1271,28 +1210,28 @@ int liquidio_change_mtu(struct net_device *netdev, int new_mtu)
12711210
octeon_prepare_soft_command(oct, sc, OPCODE_NIC,
12721211
OPCODE_NIC_CMD, 0, 0, 0);
12731212

1274-
sc->callback = liquidio_change_mtu_completion;
1275-
sc->callback_arg = sc;
1276-
sc->wait_time = 100;
1277-
12781213
ret = octeon_send_soft_command(oct, sc);
12791214
if (ret == IQ_SEND_FAILED) {
12801215
netif_info(lio, rx_err, lio->netdev, "Failed to change MTU\n");
1216+
octeon_free_soft_command(oct, sc);
12811217
return -EINVAL;
12821218
}
12831219
/* Sleep on a wait queue till the cond flag indicates that the
12841220
* response arrived or timed-out.
12851221
*/
1286-
if (sleep_cond(&ctx->wc, &ctx->cond) == -EINTR ||
1287-
ctx->cond == LIO_CHANGE_MTU_FAIL) {
1288-
octeon_free_soft_command(oct, sc);
1222+
ret = wait_for_sc_completion_timeout(oct, sc, 0);
1223+
if (ret)
1224+
return ret;
1225+
1226+
if (sc->sc_status) {
1227+
WRITE_ONCE(sc->caller_is_done, true);
12891228
return -EINVAL;
12901229
}
12911230

12921231
netdev->mtu = new_mtu;
12931232
lio->mtu = new_mtu;
12941233

1295-
octeon_free_soft_command(oct, sc);
1234+
WRITE_ONCE(sc->caller_is_done, true);
12961235
return 0;
12971236
}
12981237

0 commit comments

Comments
 (0)