root/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. nfp_app_nic_vnic_init_phy_port
  2. nfp_app_nic_vnic_alloc

   1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
   2 /* Copyright (C) 2017-2018 Netronome Systems, Inc. */
   3 
   4 #include "nfpcore/nfp_cpp.h"
   5 #include "nfpcore/nfp_nsp.h"
   6 #include "nfp_app.h"
   7 #include "nfp_main.h"
   8 #include "nfp_net.h"
   9 #include "nfp_port.h"
  10 
  11 int nfp_app_nic_vnic_init_phy_port(struct nfp_pf *pf, struct nfp_app *app,
  12                                    struct nfp_net *nn, unsigned int id)
  13 {
  14         int err;
  15 
  16         if (!pf->eth_tbl)
  17                 return 0;
  18 
  19         nn->port = nfp_port_alloc(app, NFP_PORT_PHYS_PORT, nn->dp.netdev);
  20         if (IS_ERR(nn->port))
  21                 return PTR_ERR(nn->port);
  22 
  23         err = nfp_port_init_phy_port(pf, app, nn->port, id);
  24         if (err) {
  25                 nfp_port_free(nn->port);
  26                 return err;
  27         }
  28 
  29         return nn->port->type == NFP_PORT_INVALID;
  30 }
  31 
  32 int nfp_app_nic_vnic_alloc(struct nfp_app *app, struct nfp_net *nn,
  33                            unsigned int id)
  34 {
  35         int err;
  36 
  37         err = nfp_app_nic_vnic_init_phy_port(app->pf, app, nn, id);
  38         if (err)
  39                 return err < 0 ? err : 0;
  40 
  41         nfp_net_get_mac_addr(app->pf, nn->dp.netdev, nn->port);
  42 
  43         return 0;
  44 }

/* [<][>][^][v][top][bottom][index][help] */