@@ -387,7 +387,7 @@ static void fm10k_request_glort_range(struct fm10k_intfc *interface)
387
387
* fm10k_free_udp_port_info
388
388
* @interface: board private structure
389
389
*
390
- * This function frees the entire vxlan_port list
390
+ * This function frees both geneve_port and vxlan_port structures
391
391
**/
392
392
static void fm10k_free_udp_port_info (struct fm10k_intfc * interface )
393
393
{
@@ -403,6 +403,17 @@ static void fm10k_free_udp_port_info(struct fm10k_intfc *interface)
403
403
struct fm10k_udp_port ,
404
404
list );
405
405
}
406
+
407
+ /* flush all entries from geneve list */
408
+ port = list_first_entry_or_null (& interface -> geneve_port ,
409
+ struct fm10k_udp_port , list );
410
+ while (port ) {
411
+ list_del (& port -> list );
412
+ kfree (port );
413
+ port = list_first_entry_or_null (& interface -> vxlan_port ,
414
+ struct fm10k_udp_port ,
415
+ list );
416
+ }
406
417
}
407
418
408
419
/**
@@ -427,6 +438,13 @@ static void fm10k_restore_udp_port_info(struct fm10k_intfc *interface)
427
438
fm10k_write_reg (hw , FM10K_TUNNEL_CFG ,
428
439
(port ? ntohs (port -> port ) : 0 ) |
429
440
(ETH_P_TEB << FM10K_TUNNEL_CFG_NVGRE_SHIFT ));
441
+
442
+ port = list_first_entry_or_null (& interface -> geneve_port ,
443
+ struct fm10k_udp_port , list );
444
+
445
+ /* restore Geneve tunnel configuration register */
446
+ fm10k_write_reg (hw , FM10K_TUNNEL_CFG_GENEVE ,
447
+ (port ? ntohs (port -> port ) : 0 ));
430
448
}
431
449
432
450
static struct fm10k_udp_port *
@@ -472,8 +490,8 @@ static void fm10k_insert_tunnel_port(struct list_head *ports,
472
490
* @ti: Tunnel endpoint information
473
491
*
474
492
* This function is called when a new UDP tunnel port has been added.
475
- * Currently we only support VXLAN and only one port will actually be
476
- * offloaded due to hardware restrictions .
493
+ * Due to hardware restrictions, only one port per type can be offloaded at
494
+ * once .
477
495
**/
478
496
static void fm10k_udp_tunnel_add (struct net_device * dev ,
479
497
struct udp_tunnel_info * ti )
@@ -488,6 +506,9 @@ static void fm10k_udp_tunnel_add(struct net_device *dev,
488
506
case UDP_TUNNEL_TYPE_VXLAN :
489
507
fm10k_insert_tunnel_port (& interface -> vxlan_port , ti );
490
508
break ;
509
+ case UDP_TUNNEL_TYPE_GENEVE :
510
+ fm10k_insert_tunnel_port (& interface -> geneve_port , ti );
511
+ break ;
491
512
default :
492
513
return ;
493
514
}
@@ -517,6 +538,9 @@ static void fm10k_udp_tunnel_del(struct net_device *dev,
517
538
case UDP_TUNNEL_TYPE_VXLAN :
518
539
port = fm10k_remove_tunnel_port (& interface -> vxlan_port , ti );
519
540
break ;
541
+ case UDP_TUNNEL_TYPE_GENEVE :
542
+ port = fm10k_remove_tunnel_port (& interface -> geneve_port , ti );
543
+ break ;
520
544
default :
521
545
return ;
522
546
}
0 commit comments