diff options
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_client.c')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_client.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c b/drivers/net/ethernet/intel/i40e/i40e_client.c index e1370c556a3c..618f18436618 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_client.c +++ b/drivers/net/ethernet/intel/i40e/i40e_client.c | |||
@@ -199,6 +199,7 @@ void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi) | |||
199 | void i40e_notify_client_of_netdev_open(struct i40e_vsi *vsi) | 199 | void i40e_notify_client_of_netdev_open(struct i40e_vsi *vsi) |
200 | { | 200 | { |
201 | struct i40e_client_instance *cdev; | 201 | struct i40e_client_instance *cdev; |
202 | int ret = 0; | ||
202 | 203 | ||
203 | if (!vsi) | 204 | if (!vsi) |
204 | return; | 205 | return; |
@@ -211,7 +212,14 @@ void i40e_notify_client_of_netdev_open(struct i40e_vsi *vsi) | |||
211 | "Cannot locate client instance open routine\n"); | 212 | "Cannot locate client instance open routine\n"); |
212 | continue; | 213 | continue; |
213 | } | 214 | } |
214 | cdev->client->ops->open(&cdev->lan_info, cdev->client); | 215 | if (!(test_bit(__I40E_CLIENT_INSTANCE_OPENED, |
216 | &cdev->state))) { | ||
217 | ret = cdev->client->ops->open(&cdev->lan_info, | ||
218 | cdev->client); | ||
219 | if (!ret) | ||
220 | set_bit(__I40E_CLIENT_INSTANCE_OPENED, | ||
221 | &cdev->state); | ||
222 | } | ||
215 | } | 223 | } |
216 | } | 224 | } |
217 | mutex_unlock(&i40e_client_instance_mutex); | 225 | mutex_unlock(&i40e_client_instance_mutex); |
@@ -407,12 +415,14 @@ struct i40e_vsi *i40e_vsi_lookup(struct i40e_pf *pf, | |||
407 | * i40e_client_add_instance - add a client instance struct to the instance list | 415 | * i40e_client_add_instance - add a client instance struct to the instance list |
408 | * @pf: pointer to the board struct | 416 | * @pf: pointer to the board struct |
409 | * @client: pointer to a client struct in the client list. | 417 | * @client: pointer to a client struct in the client list. |
418 | * @existing: if there was already an existing instance | ||
410 | * | 419 | * |
411 | * Returns cdev ptr on success, NULL on failure | 420 | * Returns cdev ptr on success or if already exists, NULL on failure |
412 | **/ | 421 | **/ |
413 | static | 422 | static |
414 | struct i40e_client_instance *i40e_client_add_instance(struct i40e_pf *pf, | 423 | struct i40e_client_instance *i40e_client_add_instance(struct i40e_pf *pf, |
415 | struct i40e_client *client) | 424 | struct i40e_client *client, |
425 | bool *existing) | ||
416 | { | 426 | { |
417 | struct i40e_client_instance *cdev; | 427 | struct i40e_client_instance *cdev; |
418 | struct netdev_hw_addr *mac = NULL; | 428 | struct netdev_hw_addr *mac = NULL; |
@@ -421,7 +431,7 @@ struct i40e_client_instance *i40e_client_add_instance(struct i40e_pf *pf, | |||
421 | mutex_lock(&i40e_client_instance_mutex); | 431 | mutex_lock(&i40e_client_instance_mutex); |
422 | list_for_each_entry(cdev, &i40e_client_instances, list) { | 432 | list_for_each_entry(cdev, &i40e_client_instances, list) { |
423 | if ((cdev->lan_info.pf == pf) && (cdev->client == client)) { | 433 | if ((cdev->lan_info.pf == pf) && (cdev->client == client)) { |
424 | cdev = NULL; | 434 | *existing = true; |
425 | goto out; | 435 | goto out; |
426 | } | 436 | } |
427 | } | 437 | } |
@@ -505,6 +515,7 @@ void i40e_client_subtask(struct i40e_pf *pf) | |||
505 | { | 515 | { |
506 | struct i40e_client_instance *cdev; | 516 | struct i40e_client_instance *cdev; |
507 | struct i40e_client *client; | 517 | struct i40e_client *client; |
518 | bool existing = false; | ||
508 | int ret = 0; | 519 | int ret = 0; |
509 | 520 | ||
510 | if (!(pf->flags & I40E_FLAG_SERVICE_CLIENT_REQUESTED)) | 521 | if (!(pf->flags & I40E_FLAG_SERVICE_CLIENT_REQUESTED)) |
@@ -528,18 +539,25 @@ void i40e_client_subtask(struct i40e_pf *pf) | |||
528 | /* check if L2 VSI is up, if not we are not ready */ | 539 | /* check if L2 VSI is up, if not we are not ready */ |
529 | if (test_bit(__I40E_DOWN, &pf->vsi[pf->lan_vsi]->state)) | 540 | if (test_bit(__I40E_DOWN, &pf->vsi[pf->lan_vsi]->state)) |
530 | continue; | 541 | continue; |
542 | } else { | ||
543 | dev_warn(&pf->pdev->dev, "This client %s is being instanciated at probe\n", | ||
544 | client->name); | ||
531 | } | 545 | } |
532 | 546 | ||
533 | /* Add the client instance to the instance list */ | 547 | /* Add the client instance to the instance list */ |
534 | cdev = i40e_client_add_instance(pf, client); | 548 | cdev = i40e_client_add_instance(pf, client, &existing); |
535 | if (!cdev) | 549 | if (!cdev) |
536 | continue; | 550 | continue; |
537 | 551 | ||
538 | /* Also up the ref_cnt of no. of instances of this client */ | 552 | if (!existing) { |
539 | atomic_inc(&client->ref_cnt); | 553 | /* Also up the ref_cnt for no. of instances of this |
540 | dev_info(&pf->pdev->dev, "Added instance of Client %s to PF%d bus=0x%02x func=0x%02x\n", | 554 | * client. |
541 | client->name, pf->hw.pf_id, | 555 | */ |
542 | pf->hw.bus.device, pf->hw.bus.func); | 556 | atomic_inc(&client->ref_cnt); |
557 | dev_info(&pf->pdev->dev, "Added instance of Client %s to PF%d bus=0x%02x func=0x%02x\n", | ||
558 | client->name, pf->hw.pf_id, | ||
559 | pf->hw.bus.device, pf->hw.bus.func); | ||
560 | } | ||
543 | 561 | ||
544 | /* Send an Open request to the client */ | 562 | /* Send an Open request to the client */ |
545 | atomic_inc(&cdev->ref_cnt); | 563 | atomic_inc(&cdev->ref_cnt); |
@@ -588,7 +606,8 @@ int i40e_lan_add_device(struct i40e_pf *pf) | |||
588 | pf->hw.pf_id, pf->hw.bus.device, pf->hw.bus.func); | 606 | pf->hw.pf_id, pf->hw.bus.device, pf->hw.bus.func); |
589 | 607 | ||
590 | /* Since in some cases register may have happened before a device gets | 608 | /* Since in some cases register may have happened before a device gets |
591 | * added, we can schedule a subtask to go initiate the clients. | 609 | * added, we can schedule a subtask to go initiate the clients if |
610 | * they can be launched at probe time. | ||
592 | */ | 611 | */ |
593 | pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED; | 612 | pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED; |
594 | i40e_service_event_schedule(pf); | 613 | i40e_service_event_schedule(pf); |