31
31
32
32
#define OCTNIC_MAX_SG MAX_SKB_FRAGS
33
33
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
-
66
34
/**
67
35
* \brief Delete gather lists
68
36
* @param lio per-network private data
@@ -1211,30 +1179,6 @@ int octeon_setup_interrupt(struct octeon_device *oct, u32 num_ioqs)
1211
1179
return 0 ;
1212
1180
}
1213
1181
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
-
1238
1182
/**
1239
1183
* \brief Net device change_mtu
1240
1184
* @param netdev network device
@@ -1243,22 +1187,17 @@ int liquidio_change_mtu(struct net_device *netdev, int new_mtu)
1243
1187
{
1244
1188
struct lio * lio = GET_LIO (netdev );
1245
1189
struct octeon_device * oct = lio -> oct_dev ;
1246
- struct liquidio_if_cfg_context * ctx ;
1247
1190
struct octeon_soft_command * sc ;
1248
1191
union octnet_cmd * ncmd ;
1249
- int ctx_size ;
1250
1192
int ret = 0 ;
1251
1193
1252
- ctx_size = sizeof (struct liquidio_if_cfg_context );
1253
1194
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 );
1255
1196
1256
1197
ncmd = (union octnet_cmd * )sc -> virtdptr ;
1257
- ctx = (struct liquidio_if_cfg_context * )sc -> ctxptr ;
1258
1198
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 ;
1262
1201
1263
1202
ncmd -> u64 = 0 ;
1264
1203
ncmd -> s .cmd = OCTNET_CMD_CHANGE_MTU ;
@@ -1271,28 +1210,28 @@ int liquidio_change_mtu(struct net_device *netdev, int new_mtu)
1271
1210
octeon_prepare_soft_command (oct , sc , OPCODE_NIC ,
1272
1211
OPCODE_NIC_CMD , 0 , 0 , 0 );
1273
1212
1274
- sc -> callback = liquidio_change_mtu_completion ;
1275
- sc -> callback_arg = sc ;
1276
- sc -> wait_time = 100 ;
1277
-
1278
1213
ret = octeon_send_soft_command (oct , sc );
1279
1214
if (ret == IQ_SEND_FAILED ) {
1280
1215
netif_info (lio , rx_err , lio -> netdev , "Failed to change MTU\n" );
1216
+ octeon_free_soft_command (oct , sc );
1281
1217
return - EINVAL ;
1282
1218
}
1283
1219
/* Sleep on a wait queue till the cond flag indicates that the
1284
1220
* response arrived or timed-out.
1285
1221
*/
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);
1289
1228
return - EINVAL ;
1290
1229
}
1291
1230
1292
1231
netdev -> mtu = new_mtu ;
1293
1232
lio -> mtu = new_mtu ;
1294
1233
1295
- octeon_free_soft_command ( oct , sc );
1234
+ WRITE_ONCE ( sc -> caller_is_done , true );
1296
1235
return 0 ;
1297
1236
}
1298
1237
0 commit comments