diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2013-12-18 08:46:02 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-01-09 06:29:15 -0500 |
commit | c35a1d7fdecc4439b5c33f2d2578b1cbeade93f2 (patch) | |
tree | b87fe96cca5d39b22baed9c01b74915de03fc3d8 /drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |
parent | 4dda12e61bf6292a6c85801d90b05adbeb58b718 (diff) |
i40e: Add a dummy packet template
The hardware requires a full packet template to be pointed to when adding
hardware flow filters. This patch adds the template and uses it for
programming filters.
Change-ID: I09db9f4ab0207ca9c520ae36596d74e1a0663ae5
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 2016ca074392..b886ee5bd99d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |||
@@ -1243,6 +1243,7 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc) | |||
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | #define IP_HEADER_OFFSET 14 | 1245 | #define IP_HEADER_OFFSET 14 |
1246 | #define I40E_UDPIP_DUMMY_PACKET_LEN 42 | ||
1246 | /** | 1247 | /** |
1247 | * i40e_add_del_fdir_udpv4 - Add/Remove UDPv4 Flow Director filters for | 1248 | * i40e_add_del_fdir_udpv4 - Add/Remove UDPv4 Flow Director filters for |
1248 | * a specific flow spec | 1249 | * a specific flow spec |
@@ -1263,6 +1264,12 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi, | |||
1263 | bool err = false; | 1264 | bool err = false; |
1264 | int ret; | 1265 | int ret; |
1265 | int i; | 1266 | int i; |
1267 | char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0, | ||
1268 | 0x45, 0, 0, 0x1c, 0, 0, 0x40, 0, 0x40, 0x11, | ||
1269 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
1270 | 0, 0, 0, 0, 0, 0, 0, 0}; | ||
1271 | |||
1272 | memcpy(fd_data->raw_packet, packet, I40E_UDPIP_DUMMY_PACKET_LEN); | ||
1266 | 1273 | ||
1267 | ip = (struct iphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET); | 1274 | ip = (struct iphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET); |
1268 | udp = (struct udphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET | 1275 | udp = (struct udphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET |
@@ -1293,6 +1300,7 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi, | |||
1293 | return err ? -EOPNOTSUPP : 0; | 1300 | return err ? -EOPNOTSUPP : 0; |
1294 | } | 1301 | } |
1295 | 1302 | ||
1303 | #define I40E_TCPIP_DUMMY_PACKET_LEN 54 | ||
1296 | /** | 1304 | /** |
1297 | * i40e_add_del_fdir_tcpv4 - Add/Remove TCPv4 Flow Director filters for | 1305 | * i40e_add_del_fdir_tcpv4 - Add/Remove TCPv4 Flow Director filters for |
1298 | * a specific flow spec | 1306 | * a specific flow spec |
@@ -1312,6 +1320,14 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi, | |||
1312 | struct iphdr *ip; | 1320 | struct iphdr *ip; |
1313 | bool err = false; | 1321 | bool err = false; |
1314 | int ret; | 1322 | int ret; |
1323 | /* Dummy packet */ | ||
1324 | char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0, | ||
1325 | 0x45, 0, 0, 0x28, 0, 0, 0x40, 0, 0x40, 0x6, | ||
1326 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
1327 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
1328 | 0x80, 0x11, 0x0, 0x72, 0, 0, 0, 0}; | ||
1329 | |||
1330 | memcpy(fd_data->raw_packet, packet, I40E_TCPIP_DUMMY_PACKET_LEN); | ||
1315 | 1331 | ||
1316 | ip = (struct iphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET); | 1332 | ip = (struct iphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET); |
1317 | tcp = (struct tcphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET | 1333 | tcp = (struct tcphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET |
@@ -1319,6 +1335,8 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi, | |||
1319 | 1335 | ||
1320 | ip->daddr = fsp->h_u.tcp_ip4_spec.ip4dst; | 1336 | ip->daddr = fsp->h_u.tcp_ip4_spec.ip4dst; |
1321 | tcp->dest = fsp->h_u.tcp_ip4_spec.pdst; | 1337 | tcp->dest = fsp->h_u.tcp_ip4_spec.pdst; |
1338 | ip->saddr = fsp->h_u.tcp_ip4_spec.ip4src; | ||
1339 | tcp->source = fsp->h_u.tcp_ip4_spec.psrc; | ||
1322 | 1340 | ||
1323 | fd_data->pctype = I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN; | 1341 | fd_data->pctype = I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN; |
1324 | ret = i40e_program_fdir_filter(fd_data, pf, add); | 1342 | ret = i40e_program_fdir_filter(fd_data, pf, add); |
@@ -1333,9 +1351,6 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi, | |||
1333 | fd_data->pctype, ret); | 1351 | fd_data->pctype, ret); |
1334 | } | 1352 | } |
1335 | 1353 | ||
1336 | ip->saddr = fsp->h_u.tcp_ip4_spec.ip4src; | ||
1337 | tcp->source = fsp->h_u.tcp_ip4_spec.psrc; | ||
1338 | |||
1339 | fd_data->pctype = I40E_FILTER_PCTYPE_NONF_IPV4_TCP; | 1354 | fd_data->pctype = I40E_FILTER_PCTYPE_NONF_IPV4_TCP; |
1340 | 1355 | ||
1341 | ret = i40e_program_fdir_filter(fd_data, pf, add); | 1356 | ret = i40e_program_fdir_filter(fd_data, pf, add); |
@@ -1369,6 +1384,7 @@ static int i40e_add_del_fdir_sctpv4(struct i40e_vsi *vsi, | |||
1369 | return -EOPNOTSUPP; | 1384 | return -EOPNOTSUPP; |
1370 | } | 1385 | } |
1371 | 1386 | ||
1387 | #define I40E_IP_DUMMY_PACKET_LEN 34 | ||
1372 | /** | 1388 | /** |
1373 | * i40e_add_del_fdir_ipv4 - Add/Remove IPv4 Flow Director filters for | 1389 | * i40e_add_del_fdir_ipv4 - Add/Remove IPv4 Flow Director filters for |
1374 | * a specific flow spec | 1390 | * a specific flow spec |
@@ -1388,7 +1404,11 @@ static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi, | |||
1388 | bool err = false; | 1404 | bool err = false; |
1389 | int ret; | 1405 | int ret; |
1390 | int i; | 1406 | int i; |
1407 | char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0, | ||
1408 | 0x45, 0, 0, 0x14, 0, 0, 0x40, 0, 0x40, 0x10, | ||
1409 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | ||
1391 | 1410 | ||
1411 | memcpy(fd_data->raw_packet, packet, I40E_IP_DUMMY_PACKET_LEN); | ||
1392 | ip = (struct iphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET); | 1412 | ip = (struct iphdr *)(fd_data->raw_packet + IP_HEADER_OFFSET); |
1393 | 1413 | ||
1394 | ip->saddr = fsp->h_u.usr_ip4_spec.ip4src; | 1414 | ip->saddr = fsp->h_u.usr_ip4_spec.ip4src; |