Skip to content

Commit fe0b0cd

Browse files
jacob-kellerJeff Kirsher
authored andcommitted
i40e: send correct port number to AdminQ when enabling UDP tunnels
The firmware expects the port numbers for offloaded UDP tunnels in Little Endian format. We accidentally sent the value in Big Endian format which obviously will cause the wrong port number to be put into the UDP tunnels list. This results in VxLAN and Geneve tunnel Rx offloads being essentially disabled, unless the port number happens to be identical after byte swapping. Note that i40e_aq_add_udp_tunnel() will byteswap the parameter from host order into Little Endian so we don't need worry about passing strictly a __le16 value to the command. This patch essentially reverts b3f5c7b ("i40e: Fix for extra byte swap in tunnel setup", 2016-08-24), but in a way that makes the result much more clear to the reader. Fixes: b3f5c7b ("i40e: Fix for extra byte swap in tunnel setup", 2016-08-24) Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 48ce880 commit fe0b0cd

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ struct i40e_tc_configuration {
244244
};
245245

246246
struct i40e_udp_port_config {
247-
__be16 index;
247+
/* AdminQ command interface expects port number in Host byte order */
248+
u16 index;
248249
u8 type;
249250
};
250251

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7353,7 +7353,7 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)
73537353
{
73547354
struct i40e_hw *hw = &pf->hw;
73557355
i40e_status ret;
7356-
__be16 port;
7356+
u16 port;
73577357
int i;
73587358

73597359
if (!(pf->flags & I40E_FLAG_UDP_FILTER_SYNC))
@@ -7377,7 +7377,7 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)
73777377
"%s %s port %d, index %d failed, err %s aq_err %s\n",
73787378
pf->udp_ports[i].type ? "vxlan" : "geneve",
73797379
port ? "add" : "delete",
7380-
ntohs(port), i,
7380+
port, i,
73817381
i40e_stat_str(&pf->hw, ret),
73827382
i40e_aq_str(&pf->hw,
73837383
pf->hw.aq.asq_last_status));
@@ -9014,7 +9014,7 @@ static int i40e_set_features(struct net_device *netdev,
90149014
*
90159015
* Returns the index number or I40E_MAX_PF_UDP_OFFLOAD_PORTS if port not found
90169016
**/
9017-
static u8 i40e_get_udp_port_idx(struct i40e_pf *pf, __be16 port)
9017+
static u8 i40e_get_udp_port_idx(struct i40e_pf *pf, u16 port)
90189018
{
90199019
u8 i;
90209020

@@ -9037,16 +9037,15 @@ static void i40e_udp_tunnel_add(struct net_device *netdev,
90379037
struct i40e_netdev_priv *np = netdev_priv(netdev);
90389038
struct i40e_vsi *vsi = np->vsi;
90399039
struct i40e_pf *pf = vsi->back;
9040-
__be16 port = ti->port;
9040+
u16 port = ntohs(ti->port);
90419041
u8 next_idx;
90429042
u8 idx;
90439043

90449044
idx = i40e_get_udp_port_idx(pf, port);
90459045

90469046
/* Check if port already exists */
90479047
if (idx < I40E_MAX_PF_UDP_OFFLOAD_PORTS) {
9048-
netdev_info(netdev, "port %d already offloaded\n",
9049-
ntohs(port));
9048+
netdev_info(netdev, "port %d already offloaded\n", port);
90509049
return;
90519050
}
90529051

@@ -9055,7 +9054,7 @@ static void i40e_udp_tunnel_add(struct net_device *netdev,
90559054

90569055
if (next_idx == I40E_MAX_PF_UDP_OFFLOAD_PORTS) {
90579056
netdev_info(netdev, "maximum number of offloaded UDP ports reached, not adding port %d\n",
9058-
ntohs(port));
9057+
port);
90599058
return;
90609059
}
90619060

@@ -9089,7 +9088,7 @@ static void i40e_udp_tunnel_del(struct net_device *netdev,
90899088
struct i40e_netdev_priv *np = netdev_priv(netdev);
90909089
struct i40e_vsi *vsi = np->vsi;
90919090
struct i40e_pf *pf = vsi->back;
9092-
__be16 port = ti->port;
9091+
u16 port = ntohs(ti->port);
90939092
u8 idx;
90949093

90959094
idx = i40e_get_udp_port_idx(pf, port);
@@ -9121,7 +9120,7 @@ static void i40e_udp_tunnel_del(struct net_device *netdev,
91219120
return;
91229121
not_found:
91239122
netdev_warn(netdev, "UDP port %d was not found, not deleting\n",
9124-
ntohs(port));
9123+
port);
91259124
}
91269125

91279126
static int i40e_get_phys_port_id(struct net_device *netdev,

0 commit comments

Comments
 (0)