CC: [email protected] CC: [email protected] TO: Radhey Shyam Pandey <[email protected]> CC: Michal Simek <[email protected]> CC: Harini Katakam <[email protected]>
tree: https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.4 head: 2f686fa6c0bf7fa168dc45dd7ce1359217212911 commit: c4c5319b6b2b797e9e9b5a38340fc77168ef022f [1634/1765] net: xilinx: axiethernet: Add check for transmit data FIFO vacancy :::::: branch date: 2 days ago :::::: commit date: 9 months ago config: s390-randconfig-s031-20210722 (attached as .config) compiler: s390-linux-gcc (GCC) 10.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.3-341-g8af24329-dirty # https://github.com/Xilinx/linux-xlnx/commit/c4c5319b6b2b797e9e9b5a38340fc77168ef022f git remote add xlnx https://github.com/Xilinx/linux-xlnx git fetch --no-tags xlnx xlnx_rebase_v5.4 git checkout c4c5319b6b2b797e9e9b5a38340fc77168ef022f # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 SHELL=/bin/bash drivers/net/ethernet/xilinx/ drivers/regulator/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> sparse warnings: (new ones prefixed by >>) drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1253:17: sparse: sparse: mixing declarations and code >> drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1058:17: sparse: sparse: >> incompatible types in comparison expression (different type sizes): >> drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1058:17: sparse: >> unsigned long * >> drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1058:17: sparse: >> unsigned int * drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1496:37: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [usertype] sec @@ got restricted __be32 [usertype] @@ drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1496:37: sparse: expected unsigned int [addressable] [usertype] sec drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1496:37: sparse: got restricted __be32 [usertype] drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1497:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [usertype] nsec @@ got restricted __be32 [usertype] @@ drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1497:38: sparse: expected unsigned int [addressable] [usertype] nsec drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1497:38: sparse: got restricted __be32 [usertype] drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1533:37: sparse: sparse: cast to restricted __be32 drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1533:35: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __wsum [usertype] csum @@ got unsigned int [usertype] @@ drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1533:35: sparse: expected restricted __wsum [usertype] csum drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1533:35: sparse: got unsigned int [usertype] drivers/net/ethernet/xilinx/xilinx_axienet_main.c: note: in included file (through arch/s390/include/asm/io.h, include/linux/scatterlist.h, include/linux/dma-mapping.h, ...): include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype] include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32 vim +1058 drivers/net/ethernet/xilinx/xilinx_axienet_main.c 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1035 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1036 if (msg_type == TX_TS_OP_NOOP) { 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1037 buf[0] = TX_TS_OP_NOOP; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1038 } else if (msg_type == TX_TS_OP_ONESTEP) { 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1039 buf[0] = TX_TS_OP_ONESTEP; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1040 buf[1] = TX_TS_CSUM_UPDATE; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1041 buf[4] = TX_PTP_TS_OFFSET; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1042 buf[6] = TX_PTP_CSUM_OFFSET; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1043 } else { 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1044 buf[0] = TX_TS_OP_TWOSTEP; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1045 buf[2] = cur_p->ptp_tx_ts_tag & 0xFF; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1046 buf[3] = (cur_p->ptp_tx_ts_tag >> 8) & 0xFF; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1047 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1048 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1049 if (lp->axienet_config->mactype == XAXIENET_1G || 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1050 lp->axienet_config->mactype == XAXIENET_2_5G) { 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1051 memcpy(&val, buf, AXIENET_TS_HEADER_LEN); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1052 swab64s(&val); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1053 memcpy(buf, &val, AXIENET_TS_HEADER_LEN); cc1dbf40f6648461 Harini Katakam 2020-09-24 1054 } else if (lp->axienet_config->mactype == XAXIENET_10G_25G || cc1dbf40f6648461 Harini Katakam 2020-09-24 1055 lp->axienet_config->mactype == XAXIENET_MRMAC) { 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1056 memcpy(&tmp, buf, XXVENET_TS_HEADER_LEN); c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1057 /* Check for Transmit Data FIFO Vacancy */ c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 @1058 spin_lock_irqsave(&lp->ptp_tx_lock, flags); c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1059 if (!axienet_txts_ior(lp, XAXIFIFO_TXTS_TDFV)) { c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1060 spin_unlock_irqrestore(&lp->ptp_tx_lock, flags); c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1061 return NETDEV_TX_BUSY; c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1062 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1063 axienet_txts_iow(lp, XAXIFIFO_TXTS_TXFD, tmp); c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1064 axienet_txts_iow(lp, XAXIFIFO_TXTS_TLR, c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1065 XXVENET_TS_HEADER_LEN); c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1066 spin_unlock_irqrestore(&lp->ptp_tx_lock, flags); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1067 } c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1068 c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1069 return 0; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1070 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1071 #endif 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1072 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1073 #ifdef CONFIG_XILINX_TSN bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1074 static inline u16 get_tsn_queue(u8 pcp, u16 num_tc) bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1075 { bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1076 u16 queue = 0; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1077 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1078 /* For 3 queue system, RE queue is 1 and ST queue is 2 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1079 * For 2 queue system, ST queue is 1. BE queue is always 0 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1080 */ bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1081 if (pcp == 4) { bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1082 if (num_tc == 2) bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1083 queue = 1; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1084 else bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1085 queue = 2; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1086 } else if ((num_tc == 3) && (pcp == 2 || pcp == 3)) { bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1087 queue = 1; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1088 } bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1089 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1090 return queue; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1091 } bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1092 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1093 static inline u16 tsn_queue_mapping(const struct sk_buff *skb, u16 num_tc) bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1094 { bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1095 int queue = 0; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1096 u16 vlan_tci; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1097 u8 pcp; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1098 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1099 struct ethhdr *hdr = (struct ethhdr *)skb->data; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1100 u16 ether_type = ntohs(hdr->h_proto); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1101 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1102 if (unlikely(ether_type == ETH_P_8021Q)) { bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1103 struct vlan_ethhdr *vhdr = (struct vlan_ethhdr *)skb->data; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1104 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1105 /* ether_type = ntohs(vhdr->h_vlan_encapsulated_proto); */ bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1106 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1107 vlan_tci = ntohs(vhdr->h_vlan_TCI); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1108 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1109 pcp = (vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1110 pr_debug("vlan_tci: %x\n", vlan_tci); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1111 pr_debug("pcp: %d\n", pcp); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1112 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1113 queue = get_tsn_queue(pcp, num_tc); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1114 } bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1115 pr_debug("selected queue: %d\n", queue); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1116 return queue; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1117 } bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1118 #endif bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1119 51054464602520b2 Saurabh Sengar 2020-01-24 1120 #ifdef CONFIG_XILINX_AXI_EMAC_HWTSTAMP 51054464602520b2 Saurabh Sengar 2020-01-24 1121 static int axienet_skb_tstsmp(struct sk_buff **__skb, struct axienet_dma_q *q, 51054464602520b2 Saurabh Sengar 2020-01-24 1122 struct net_device *ndev) 8a3b7a252dca9fb2 Daniel Borkmann 2012-01-19 1123 { 51054464602520b2 Saurabh Sengar 2020-01-24 1124 #ifdef CONFIG_AXIENET_HAS_MCDMA 51054464602520b2 Saurabh Sengar 2020-01-24 1125 struct aximcdma_bd *cur_p; 51054464602520b2 Saurabh Sengar 2020-01-24 1126 #else 8a3b7a252dca9fb2 Daniel Borkmann 2012-01-19 1127 struct axidma_bd *cur_p; 51054464602520b2 Saurabh Sengar 2020-01-24 1128 #endif 51054464602520b2 Saurabh Sengar 2020-01-24 1129 struct axienet_local *lp = netdev_priv(ndev); 51054464602520b2 Saurabh Sengar 2020-01-24 1130 struct sk_buff *old_skb = *__skb; 51054464602520b2 Saurabh Sengar 2020-01-24 1131 struct sk_buff *skb = *__skb; 8a3b7a252dca9fb2 Daniel Borkmann 2012-01-19 1132 51054464602520b2 Saurabh Sengar 2020-01-24 1133 #ifdef CONFIG_AXIENET_HAS_MCDMA 51054464602520b2 Saurabh Sengar 2020-01-24 1134 cur_p = &q->txq_bd_v[q->tx_bd_tail]; 51054464602520b2 Saurabh Sengar 2020-01-24 1135 #else 51054464602520b2 Saurabh Sengar 2020-01-24 1136 cur_p = &q->tx_bd_v[q->tx_bd_tail]; 51054464602520b2 Saurabh Sengar 2020-01-24 1137 #endif 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1138 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1139 if ((((lp->tstamp_config.tx_type == HWTSTAMP_TX_ONESTEP_SYNC) || 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1140 (lp->tstamp_config.tx_type == HWTSTAMP_TX_ON)) || 51054464602520b2 Saurabh Sengar 2020-01-24 1141 lp->eth_hasptp) && (lp->axienet_config->mactype != 12cccb2f4376e346 Harini Katakam 2020-09-24 1142 XAXIENET_10G_25G) && 12cccb2f4376e346 Harini Katakam 2020-09-24 1143 (lp->axienet_config->mactype != XAXIENET_MRMAC)) { 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1144 u8 *tmp; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1145 struct sk_buff *new_skb; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1146 51054464602520b2 Saurabh Sengar 2020-01-24 1147 if (skb_headroom(old_skb) < AXIENET_TS_HEADER_LEN) { 51054464602520b2 Saurabh Sengar 2020-01-24 1148 new_skb = 51054464602520b2 Saurabh Sengar 2020-01-24 1149 skb_realloc_headroom(old_skb, 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1150 AXIENET_TS_HEADER_LEN); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1151 if (!new_skb) { 51054464602520b2 Saurabh Sengar 2020-01-24 1152 dev_err(&ndev->dev, "failed to allocate new socket buffer\n"); 51054464602520b2 Saurabh Sengar 2020-01-24 1153 dev_kfree_skb_any(old_skb); 51054464602520b2 Saurabh Sengar 2020-01-24 1154 return NETDEV_TX_BUSY; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1155 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1156 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1157 /* Transfer the ownership to the 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1158 * new socket buffer if required 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1159 */ 51054464602520b2 Saurabh Sengar 2020-01-24 1160 if (old_skb->sk) 51054464602520b2 Saurabh Sengar 2020-01-24 1161 skb_set_owner_w(new_skb, old_skb->sk); 51054464602520b2 Saurabh Sengar 2020-01-24 1162 dev_kfree_skb_any(old_skb); 51054464602520b2 Saurabh Sengar 2020-01-24 1163 *__skb = new_skb; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1164 skb = new_skb; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1165 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1166 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1167 tmp = skb_push(skb, AXIENET_TS_HEADER_LEN); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1168 memset(tmp, 0, AXIENET_TS_HEADER_LEN); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1169 cur_p->ptp_tx_ts_tag++; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1170 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1171 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1172 if (lp->tstamp_config.tx_type == 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1173 HWTSTAMP_TX_ONESTEP_SYNC) { 51054464602520b2 Saurabh Sengar 2020-01-24 1174 axienet_create_tsheader(tmp, 51054464602520b2 Saurabh Sengar 2020-01-24 1175 TX_TS_OP_ONESTEP 51054464602520b2 Saurabh Sengar 2020-01-24 1176 , q); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1177 } else { 51054464602520b2 Saurabh Sengar 2020-01-24 1178 axienet_create_tsheader(tmp, 51054464602520b2 Saurabh Sengar 2020-01-24 1179 TX_TS_OP_TWOSTEP 51054464602520b2 Saurabh Sengar 2020-01-24 1180 , q); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1181 skb_shinfo(skb)->tx_flags 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1182 |= SKBTX_IN_PROGRESS; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1183 cur_p->ptp_tx_skb = 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1184 (unsigned long)skb_get(skb); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1185 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1186 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1187 } else if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && cc1dbf40f6648461 Harini Katakam 2020-09-24 1188 (lp->axienet_config->mactype == XAXIENET_10G_25G || cc1dbf40f6648461 Harini Katakam 2020-09-24 1189 lp->axienet_config->mactype == XAXIENET_MRMAC)) { c3aa16e3cab96fc5 Harini Katakam 2020-09-24 1190 cur_p->ptp_tx_ts_tag = prandom_u32_max(XAXIFIFO_TXTS_TAG_MAX) + 1; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1191 dev_dbg(lp->dev, "tx_tag:[%04x]\n", 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1192 cur_p->ptp_tx_ts_tag); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1193 if (lp->tstamp_config.tx_type == HWTSTAMP_TX_ONESTEP_SYNC) { c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1194 if (axienet_create_tsheader(lp->tx_ptpheader, c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1195 TX_TS_OP_ONESTEP, c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1196 q)) c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1197 return NETDEV_TX_BUSY; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1198 } else { c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1199 if (axienet_create_tsheader(lp->tx_ptpheader, c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1200 TX_TS_OP_TWOSTEP, c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1201 q)) c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1202 return NETDEV_TX_BUSY; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1203 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1204 cur_p->ptp_tx_skb = (phys_addr_t)skb_get(skb); 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1205 } cc1dbf40f6648461 Harini Katakam 2020-09-24 1206 } else if (lp->axienet_config->mactype == XAXIENET_10G_25G || cc1dbf40f6648461 Harini Katakam 2020-09-24 1207 lp->axienet_config->mactype == XAXIENET_MRMAC) { 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1208 dev_dbg(lp->dev, "tx_tag:NOOP\n"); c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1209 if (axienet_create_tsheader(lp->tx_ptpheader, c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1210 TX_TS_OP_NOOP, q)) c4c5319b6b2b797e Radhey Shyam Pandey 2020-09-29 1211 return NETDEV_TX_BUSY; 51054464602520b2 Saurabh Sengar 2020-01-24 1212 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1213 51054464602520b2 Saurabh Sengar 2020-01-24 1214 return NETDEV_TX_OK; 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1215 } 7aee9da192ba5721 Appana Durga Kedareswara Rao 2020-01-24 1216 #endif 51054464602520b2 Saurabh Sengar 2020-01-24 1217 51054464602520b2 Saurabh Sengar 2020-01-24 1218 static int axienet_queue_xmit(struct sk_buff *skb, 51054464602520b2 Saurabh Sengar 2020-01-24 1219 struct net_device *ndev, u16 map) 51054464602520b2 Saurabh Sengar 2020-01-24 1220 { 51054464602520b2 Saurabh Sengar 2020-01-24 1221 u32 ii; 51054464602520b2 Saurabh Sengar 2020-01-24 1222 u32 num_frag; 51054464602520b2 Saurabh Sengar 2020-01-24 1223 u32 csum_start_off; 51054464602520b2 Saurabh Sengar 2020-01-24 1224 u32 csum_index_off; 51054464602520b2 Saurabh Sengar 2020-01-24 1225 dma_addr_t tail_p; 51054464602520b2 Saurabh Sengar 2020-01-24 1226 struct axienet_local *lp = netdev_priv(ndev); 51054464602520b2 Saurabh Sengar 2020-01-24 1227 #ifdef CONFIG_AXIENET_HAS_MCDMA 51054464602520b2 Saurabh Sengar 2020-01-24 1228 struct aximcdma_bd *cur_p; 51054464602520b2 Saurabh Sengar 2020-01-24 1229 #else 51054464602520b2 Saurabh Sengar 2020-01-24 1230 struct axidma_bd *cur_p; 51054464602520b2 Saurabh Sengar 2020-01-24 1231 #endif 51054464602520b2 Saurabh Sengar 2020-01-24 1232 unsigned long flags; 51054464602520b2 Saurabh Sengar 2020-01-24 1233 struct axienet_dma_q *q; 51054464602520b2 Saurabh Sengar 2020-01-24 1234 12cccb2f4376e346 Harini Katakam 2020-09-24 1235 if (lp->axienet_config->mactype == XAXIENET_10G_25G || 12cccb2f4376e346 Harini Katakam 2020-09-24 1236 lp->axienet_config->mactype == XAXIENET_MRMAC) { 51054464602520b2 Saurabh Sengar 2020-01-24 1237 /* Need to manually pad the small frames in case of XXV MAC 51054464602520b2 Saurabh Sengar 2020-01-24 1238 * because the pad field is not added by the IP. We must present 51054464602520b2 Saurabh Sengar 2020-01-24 1239 * a packet that meets the minimum length to the IP core. 51054464602520b2 Saurabh Sengar 2020-01-24 1240 * When the IP core is configured to calculate and add the FCS 51054464602520b2 Saurabh Sengar 2020-01-24 1241 * to the packet the minimum packet length is 60 bytes. e29146f6c284821d Appana Durga Kedareswara Rao 2020-01-24 1242 */ 51054464602520b2 Saurabh Sengar 2020-01-24 1243 if (eth_skb_pad(skb)) { 51054464602520b2 Saurabh Sengar 2020-01-24 1244 ndev->stats.tx_dropped++; 51054464602520b2 Saurabh Sengar 2020-01-24 1245 return NETDEV_TX_OK; 51054464602520b2 Saurabh Sengar 2020-01-24 1246 } 51054464602520b2 Saurabh Sengar 2020-01-24 1247 } bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1248 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1249 #ifdef CONFIG_XILINX_TSN bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1250 if (unlikely(lp->is_tsn)) { bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1251 map = tsn_queue_mapping(skb, lp->num_tc); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1252 #ifdef CONFIG_XILINX_TSN_PTP bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 @1253 const struct ethhdr *eth; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1254 bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1255 eth = (struct ethhdr *)skb->data; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1256 /* check if skb is a PTP frame ? */ bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1257 if (eth->h_proto == htons(ETH_P_1588)) bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1258 return axienet_ptp_xmit(skb, ndev); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1259 #endif bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1260 if (lp->temac_no == XAE_TEMAC2) { bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1261 dev_kfree_skb_any(skb); bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1262 return NETDEV_TX_OK; bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1263 } bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1264 } bbcf6f9bb1bc2063 Saurabh Sengar 2020-02-13 1265 #endif 51054464602520b2 Saurabh Sengar 2020-01-24 1266 num_frag = skb_shinfo(skb)->nr_frags; 51054464602520b2 Saurabh Sengar 2020-01-24 1267 51054464602520b2 Saurabh Sengar 2020-01-24 1268 q = lp->dq[map]; 51054464602520b2 Saurabh Sengar 2020-01-24 1269 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
