Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pds_core: set up the VIF definitions and defaults

The Virtual Interfaces (VIFs) supported by the DSC's
configuration (vDPA, Eth, RDMA, etc) are reported in the
dev_ident struct and made visible in debugfs. At this point
only vDPA is supported in this driver so we only setup
devices for that feature.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Shannon Nelson and committed by
David S. Miller
65e0185a 49ce92fb

+102
+48
drivers/net/ethernet/amd/pds_core/core.c
··· 346 346 return err; 347 347 } 348 348 349 + static struct pdsc_viftype pdsc_viftype_defaults[] = { 350 + [PDS_DEV_TYPE_VDPA] = { .name = PDS_DEV_TYPE_VDPA_STR, 351 + .vif_id = PDS_DEV_TYPE_VDPA, 352 + .dl_id = DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET }, 353 + [PDS_DEV_TYPE_MAX] = {} 354 + }; 355 + 356 + static int pdsc_viftypes_init(struct pdsc *pdsc) 357 + { 358 + enum pds_core_vif_types vt; 359 + 360 + pdsc->viftype_status = kzalloc(sizeof(pdsc_viftype_defaults), 361 + GFP_KERNEL); 362 + if (!pdsc->viftype_status) 363 + return -ENOMEM; 364 + 365 + for (vt = 0; vt < PDS_DEV_TYPE_MAX; vt++) { 366 + bool vt_support; 367 + 368 + if (!pdsc_viftype_defaults[vt].name) 369 + continue; 370 + 371 + /* Grab the defaults */ 372 + pdsc->viftype_status[vt] = pdsc_viftype_defaults[vt]; 373 + 374 + /* See what the Core device has for support */ 375 + vt_support = !!le16_to_cpu(pdsc->dev_ident.vif_types[vt]); 376 + dev_dbg(pdsc->dev, "VIF %s is %ssupported\n", 377 + pdsc->viftype_status[vt].name, 378 + vt_support ? "" : "not "); 379 + 380 + pdsc->viftype_status[vt].supported = vt_support; 381 + } 382 + 383 + return 0; 384 + } 385 + 349 386 int pdsc_setup(struct pdsc *pdsc, bool init) 350 387 { 351 388 int numdescs; ··· 425 388 if (err) 426 389 goto err_out_teardown; 427 390 391 + /* Set up the VIFs */ 392 + err = pdsc_viftypes_init(pdsc); 393 + if (err) 394 + goto err_out_teardown; 395 + 396 + if (init) 397 + pdsc_debugfs_add_viftype(pdsc); 398 + 428 399 clear_bit(PDSC_S_FW_DEAD, &pdsc->state); 429 400 return 0; 430 401 ··· 448 403 pdsc_devcmd_reset(pdsc); 449 404 pdsc_qcq_free(pdsc, &pdsc->notifyqcq); 450 405 pdsc_qcq_free(pdsc, &pdsc->adminqcq); 406 + 407 + kfree(pdsc->viftype_status); 408 + pdsc->viftype_status = NULL; 451 409 452 410 if (pdsc->intr_info) { 453 411 for (i = 0; i < pdsc->nintrs; i++)
+11
drivers/net/ethernet/amd/pds_core/core.h
··· 123 123 struct dentry *dentry; 124 124 }; 125 125 126 + struct pdsc_viftype { 127 + char *name; 128 + bool supported; 129 + bool enabled; 130 + int dl_id; 131 + int vif_id; 132 + struct pds_auxiliary_dev *padev; 133 + }; 134 + 126 135 /* No state flags set means we are in a steady running state */ 127 136 enum pdsc_state_flags { 128 137 PDSC_S_FW_DEAD, /* stopped, wait on startup or recovery */ ··· 183 174 struct pdsc_qcq adminqcq; 184 175 struct pdsc_qcq notifyqcq; 185 176 u64 last_eid; 177 + struct pdsc_viftype *viftype_status; 186 178 }; 187 179 188 180 /** enum pds_core_dbell_bits - bitwise composition of dbell values. ··· 247 237 void pdsc_debugfs_add_dev(struct pdsc *pdsc); 248 238 void pdsc_debugfs_del_dev(struct pdsc *pdsc); 249 239 void pdsc_debugfs_add_ident(struct pdsc *pdsc); 240 + void pdsc_debugfs_add_viftype(struct pdsc *pdsc); 250 241 void pdsc_debugfs_add_irqs(struct pdsc *pdsc); 251 242 void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq); 252 243 void pdsc_debugfs_del_qcq(struct pdsc_qcq *qcq);
+24
drivers/net/ethernet/amd/pds_core/debugfs.c
··· 68 68 pdsc, &identity_fops); 69 69 } 70 70 71 + static int viftype_show(struct seq_file *seq, void *v) 72 + { 73 + struct pdsc *pdsc = seq->private; 74 + int vt; 75 + 76 + for (vt = 0; vt < PDS_DEV_TYPE_MAX; vt++) { 77 + if (!pdsc->viftype_status[vt].name) 78 + continue; 79 + 80 + seq_printf(seq, "%s\t%d supported %d enabled\n", 81 + pdsc->viftype_status[vt].name, 82 + pdsc->viftype_status[vt].supported, 83 + pdsc->viftype_status[vt].enabled); 84 + } 85 + return 0; 86 + } 87 + DEFINE_SHOW_ATTRIBUTE(viftype); 88 + 89 + void pdsc_debugfs_add_viftype(struct pdsc *pdsc) 90 + { 91 + debugfs_create_file("viftypes", 0400, pdsc->dentry, 92 + pdsc, &viftype_fops); 93 + } 94 + 71 95 static const struct debugfs_reg32 intr_ctrl_regs[] = { 72 96 { .name = "coal_init", .offset = 0, }, 73 97 { .name = "mask", .offset = 4, },
+19
include/linux/pds/pds_common.h
··· 20 20 PDS_DRIVER_ESXI = 6, 21 21 }; 22 22 23 + enum pds_core_vif_types { 24 + PDS_DEV_TYPE_CORE = 0, 25 + PDS_DEV_TYPE_VDPA = 1, 26 + PDS_DEV_TYPE_VFIO = 2, 27 + PDS_DEV_TYPE_ETH = 3, 28 + PDS_DEV_TYPE_RDMA = 4, 29 + PDS_DEV_TYPE_LM = 5, 30 + 31 + /* new ones added before this line */ 32 + PDS_DEV_TYPE_MAX = 16 /* don't change - used in struct size */ 33 + }; 34 + 35 + #define PDS_DEV_TYPE_CORE_STR "Core" 36 + #define PDS_DEV_TYPE_VDPA_STR "vDPA" 37 + #define PDS_DEV_TYPE_VFIO_STR "VFio" 38 + #define PDS_DEV_TYPE_ETH_STR "Eth" 39 + #define PDS_DEV_TYPE_RDMA_STR "RDMA" 40 + #define PDS_DEV_TYPE_LM_STR "LM" 41 + 23 42 #define PDS_CORE_IFNAMSIZ 16 24 43 25 44 /**