tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master head: 63de273f34b5eeb5ead8440f20516fae9b7b1165 commit: 028e0a4766844e7eeb31b93479ea6dd40cfc2895 [1422/1425] net: use indirect call wrappers at GRO transport layer config: nds32-defconfig (attached as .config) compiler: nds32le-linux-gcc (GCC) 6.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 028e0a4766844e7eeb31b93479ea6dd40cfc2895 # save the attached .config to linux build tree GCC_VERSION=6.4.0 make.cross ARCH=nds32
All errors (new ones prefixed by >>): In file included from include/net/inet_common.h:5:0, from net/ipv4/af_inet.c:114: net/ipv4/af_inet.c: In function 'inet_gro_receive': >> net/ipv4/af_inet.c:1501:51: error: 'udp4_gro_receive' undeclared (first use >> in this function) pp = indirect_call_gro_receive(tcp4_gro_receive, udp4_gro_receive, ^ include/linux/indirect_call_wrapper.h:32:41: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^~~~~~~~~~~ net/ipv4/af_inet.c:1501:7: note: in expansion of macro 'indirect_call_gro_receive' pp = indirect_call_gro_receive(tcp4_gro_receive, udp4_gro_receive, ^~~~~~~~~~~~~~~~~~~~~~~~~ net/ipv4/af_inet.c:1501:51: note: each undeclared identifier is reported only once for each function it appears in pp = indirect_call_gro_receive(tcp4_gro_receive, udp4_gro_receive, ^ include/linux/indirect_call_wrapper.h:32:41: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^~~~~~~~~~~ net/ipv4/af_inet.c:1501:7: note: in expansion of macro 'indirect_call_gro_receive' pp = indirect_call_gro_receive(tcp4_gro_receive, udp4_gro_receive, ^~~~~~~~~~~~~~~~~~~~~~~~~ net/ipv4/af_inet.c:1502:40: error: passing argument 2 of 'ops->callbacks.gro_receive' from incompatible pointer type [-Werror=incompatible-pointer-types] ops->callbacks.gro_receive, head, skb); ^ include/linux/indirect_call_wrapper.h:32:41: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^~~~~~~~~~~ net/ipv4/af_inet.c:1501:7: note: in expansion of macro 'indirect_call_gro_receive' pp = indirect_call_gro_receive(tcp4_gro_receive, udp4_gro_receive, ^~~~~~~~~~~~~~~~~~~~~~~~~ net/ipv4/af_inet.c:1502:40: note: expected 'struct sk_buff *' but argument is of type 'struct list_head *' ops->callbacks.gro_receive, head, skb); ^ include/linux/indirect_call_wrapper.h:32:41: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^~~~~~~~~~~ net/ipv4/af_inet.c:1501:7: note: in expansion of macro 'indirect_call_gro_receive' pp = indirect_call_gro_receive(tcp4_gro_receive, udp4_gro_receive, ^~~~~~~~~~~~~~~~~~~~~~~~~ net/ipv4/af_inet.c:1502:12: error: too many arguments to function 'ops->callbacks.gro_receive' ops->callbacks.gro_receive, head, skb); ^ include/linux/indirect_call_wrapper.h:32:39: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^ net/ipv4/af_inet.c:1501:7: note: in expansion of macro 'indirect_call_gro_receive' pp = indirect_call_gro_receive(tcp4_gro_receive, udp4_gro_receive, ^~~~~~~~~~~~~~~~~~~~~~~~~ net/ipv4/af_inet.c: In function 'inet_gro_complete': >> net/ipv4/af_inet.c:1592:29: error: 'udp4_gro_complete' undeclared (first use >> in this function) tcp4_gro_complete, udp4_gro_complete, ^ include/linux/indirect_call_wrapper.h:32:41: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^~~~~~~~~~~ net/ipv4/af_inet.c:1593:10: warning: passing argument 2 of 'ops->callbacks.gro_complete' makes integer from pointer without a cast [-Wint-conversion] skb, nhoff + sizeof(*iph)); ^ include/linux/indirect_call_wrapper.h:32:41: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^~~~~~~~~~~ net/ipv4/af_inet.c:1593:10: note: expected 'int' but argument is of type 'struct sk_buff *' skb, nhoff + sizeof(*iph)); ^ include/linux/indirect_call_wrapper.h:32:41: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^~~~~~~~~~~ net/ipv4/af_inet.c:1591:24: error: too many arguments to function 'ops->callbacks.gro_complete' err = INDIRECT_CALL_2(ops->callbacks.gro_complete, ^ include/linux/indirect_call_wrapper.h:32:39: note: in definition of macro 'INDIRECT_CALL_2' #define INDIRECT_CALL_2(f, name, ...) f(__VA_ARGS__) ^ cc1: some warnings being treated as errors vim +/udp4_gro_receive +1501 net/ipv4/af_inet.c 1387 1388 INDIRECT_CALLABLE_DECLARE(struct sk_buff *tcp4_gro_receive(struct list_head *, 1389 struct sk_buff *)); 1390 INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *, 1391 struct sk_buff *)); 1392 struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb) 1393 { 1394 const struct net_offload *ops; 1395 struct sk_buff *pp = NULL; 1396 const struct iphdr *iph; 1397 struct sk_buff *p; 1398 unsigned int hlen; 1399 unsigned int off; 1400 unsigned int id; 1401 int flush = 1; 1402 int proto; 1403 1404 off = skb_gro_offset(skb); 1405 hlen = off + sizeof(*iph); 1406 iph = skb_gro_header_fast(skb, off); 1407 if (skb_gro_header_hard(skb, hlen)) { 1408 iph = skb_gro_header_slow(skb, hlen, off); 1409 if (unlikely(!iph)) 1410 goto out; 1411 } 1412 1413 proto = iph->protocol; 1414 1415 rcu_read_lock(); 1416 ops = rcu_dereference(inet_offloads[proto]); 1417 if (!ops || !ops->callbacks.gro_receive) 1418 goto out_unlock; 1419 1420 if (*(u8 *)iph != 0x45) 1421 goto out_unlock; 1422 1423 if (ip_is_fragment(iph)) 1424 goto out_unlock; 1425 1426 if (unlikely(ip_fast_csum((u8 *)iph, 5))) 1427 goto out_unlock; 1428 1429 id = ntohl(*(__be32 *)&iph->id); 1430 flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF)); 1431 id >>= 16; 1432 1433 list_for_each_entry(p, head, list) { 1434 struct iphdr *iph2; 1435 u16 flush_id; 1436 1437 if (!NAPI_GRO_CB(p)->same_flow) 1438 continue; 1439 1440 iph2 = (struct iphdr *)(p->data + off); 1441 /* The above works because, with the exception of the top 1442 * (inner most) layer, we only aggregate pkts with the same 1443 * hdr length so all the hdrs we'll need to verify will start 1444 * at the same offset. 1445 */ 1446 if ((iph->protocol ^ iph2->protocol) | 1447 ((__force u32)iph->saddr ^ (__force u32)iph2->saddr) | 1448 ((__force u32)iph->daddr ^ (__force u32)iph2->daddr)) { 1449 NAPI_GRO_CB(p)->same_flow = 0; 1450 continue; 1451 } 1452 1453 /* All fields must match except length and checksum. */ 1454 NAPI_GRO_CB(p)->flush |= 1455 (iph->ttl ^ iph2->ttl) | 1456 (iph->tos ^ iph2->tos) | 1457 ((iph->frag_off ^ iph2->frag_off) & htons(IP_DF)); 1458 1459 NAPI_GRO_CB(p)->flush |= flush; 1460 1461 /* We need to store of the IP ID check to be included later 1462 * when we can verify that this packet does in fact belong 1463 * to a given flow. 1464 */ 1465 flush_id = (u16)(id - ntohs(iph2->id)); 1466 1467 /* This bit of code makes it much easier for us to identify 1468 * the cases where we are doing atomic vs non-atomic IP ID 1469 * checks. Specifically an atomic check can return IP ID 1470 * values 0 - 0xFFFF, while a non-atomic check can only 1471 * return 0 or 0xFFFF. 1472 */ 1473 if (!NAPI_GRO_CB(p)->is_atomic || 1474 !(iph->frag_off & htons(IP_DF))) { 1475 flush_id ^= NAPI_GRO_CB(p)->count; 1476 flush_id = flush_id ? 0xFFFF : 0; 1477 } 1478 1479 /* If the previous IP ID value was based on an atomic 1480 * datagram we can overwrite the value and ignore it. 1481 */ 1482 if (NAPI_GRO_CB(skb)->is_atomic) 1483 NAPI_GRO_CB(p)->flush_id = flush_id; 1484 else 1485 NAPI_GRO_CB(p)->flush_id |= flush_id; 1486 } 1487 1488 NAPI_GRO_CB(skb)->is_atomic = !!(iph->frag_off & htons(IP_DF)); 1489 NAPI_GRO_CB(skb)->flush |= flush; 1490 skb_set_network_header(skb, off); 1491 /* The above will be needed by the transport layer if there is one 1492 * immediately following this IP hdr. 1493 */ 1494 1495 /* Note : No need to call skb_gro_postpull_rcsum() here, 1496 * as we already checked checksum over ipv4 header was 0 1497 */ 1498 skb_gro_pull(skb, sizeof(*iph)); 1499 skb_set_transport_header(skb, skb_gro_offset(skb)); 1500 > 1501 pp = indirect_call_gro_receive(tcp4_gro_receive, > udp4_gro_receive, 1502 ops->callbacks.gro_receive, head, skb); 1503 1504 out_unlock: 1505 rcu_read_unlock(); 1506 1507 out: 1508 skb_gro_flush_final(skb, pp, flush); 1509 1510 return pp; 1511 } 1512 EXPORT_SYMBOL(inet_gro_receive); 1513 1514 static struct sk_buff *ipip_gro_receive(struct list_head *head, 1515 struct sk_buff *skb) 1516 { 1517 if (NAPI_GRO_CB(skb)->encap_mark) { 1518 NAPI_GRO_CB(skb)->flush = 1; 1519 return NULL; 1520 } 1521 1522 NAPI_GRO_CB(skb)->encap_mark = 1; 1523 1524 return inet_gro_receive(head, skb); 1525 } 1526 1527 #define SECONDS_PER_DAY 86400 1528 1529 /* inet_current_timestamp - Return IP network timestamp 1530 * 1531 * Return milliseconds since midnight in network byte order. 1532 */ 1533 __be32 inet_current_timestamp(void) 1534 { 1535 u32 secs; 1536 u32 msecs; 1537 struct timespec64 ts; 1538 1539 ktime_get_real_ts64(&ts); 1540 1541 /* Get secs since midnight. */ 1542 (void)div_u64_rem(ts.tv_sec, SECONDS_PER_DAY, &secs); 1543 /* Convert to msecs. */ 1544 msecs = secs * MSEC_PER_SEC; 1545 /* Convert nsec to msec. */ 1546 msecs += (u32)ts.tv_nsec / NSEC_PER_MSEC; 1547 1548 /* Convert to network byte order. */ 1549 return htonl(msecs); 1550 } 1551 EXPORT_SYMBOL(inet_current_timestamp); 1552 1553 int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) 1554 { 1555 if (sk->sk_family == AF_INET) 1556 return ip_recv_error(sk, msg, len, addr_len); 1557 #if IS_ENABLED(CONFIG_IPV6) 1558 if (sk->sk_family == AF_INET6) 1559 return pingv6_ops.ipv6_recv_error(sk, msg, len, addr_len); 1560 #endif 1561 return -EINVAL; 1562 } 1563 1564 INDIRECT_CALLABLE_DECLARE(int tcp4_gro_complete(struct sk_buff *, int)); 1565 INDIRECT_CALLABLE_DECLARE(int udp4_gro_complete(struct sk_buff *, int)); 1566 int inet_gro_complete(struct sk_buff *skb, int nhoff) 1567 { 1568 __be16 newlen = htons(skb->len - nhoff); 1569 struct iphdr *iph = (struct iphdr *)(skb->data + nhoff); 1570 const struct net_offload *ops; 1571 int proto = iph->protocol; 1572 int err = -ENOSYS; 1573 1574 if (skb->encapsulation) { 1575 skb_set_inner_protocol(skb, cpu_to_be16(ETH_P_IP)); 1576 skb_set_inner_network_header(skb, nhoff); 1577 } 1578 1579 csum_replace2(&iph->check, iph->tot_len, newlen); 1580 iph->tot_len = newlen; 1581 1582 rcu_read_lock(); 1583 ops = rcu_dereference(inet_offloads[proto]); 1584 if (WARN_ON(!ops || !ops->callbacks.gro_complete)) 1585 goto out_unlock; 1586 1587 /* Only need to add sizeof(*iph) to get to the next hdr below 1588 * because any hdr with option will have been flushed in 1589 * inet_gro_receive(). 1590 */ 1591 err = INDIRECT_CALL_2(ops->callbacks.gro_complete, > 1592 tcp4_gro_complete, udp4_gro_complete, 1593 skb, nhoff + sizeof(*iph)); 1594 1595 out_unlock: 1596 rcu_read_unlock(); 1597 1598 return err; 1599 } 1600 EXPORT_SYMBOL(inet_gro_complete); 1601 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
.config.gz
Description: application/gzip