Changeset 364 for asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/net
- Timestamp:
- Feb 1, 2019, 9:57:09 PM (5 years ago)
- Location:
- asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/net
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/net/ethernet.h
r359 r364 98 98 #endif /* of #ifndef IF_ETHER_NIC_HDR_ALIGN */ 99 99 100 #if defined(__RX) || defined(_MSC_VER)101 100 #if defined(__RX) 102 101 #pragma pack 103 #el se102 #elif defined(_MSC_VER) 104 103 #pragma pack(push, 1) 105 104 #endif 105 106 #if defined(__RX) || defined(_MSC_VER) 107 106 108 typedef struct t_ether_header { 107 109 … … 116 118 uint16_t type; 117 119 } T_ETHER_HDR; 118 #if defined(__RX)119 #pragma packoption120 #else121 #pragma pack(pop)122 #endif123 120 124 121 #elif defined(TOPPERS_S810_CLG3_85) /* of #if defined(__RX) */ … … 166 163 uint8_t lladdr[ETHER_ADDR_LEN]; 167 164 } __attribute__((packed, aligned(2))) T_ETHER_ADDR; 165 166 #if defined(__RX) 167 #pragma packoption 168 #elif defined(_MSC_VER) 169 #pragma pack(pop) 170 #endif 168 171 169 172 /* -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/net/net_asp.cfg
r337 r364 41 41 42 42 INCLUDE("net/net.cfg"); 43 44 #ifndef NOUSE_MPF_NET_BUF 43 45 44 46 /* … … 169 171 }); 170 172 #endif /* of #if defined(NUM_MPF_NET_BUF6_65536) && NUM_MPF_NET_BUF6_65536 > 0 */ 173 174 #endif -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/net/net_buf.c
r337 r364 68 68 #include <netinet/tcp_var.h> 69 69 70 #ifndef NOUSE_MPF_NET_BUF 71 70 72 /* 71 73 * 関数 … … 226 228 #endif /* of #if defined(NUM_MPF_NET_BUF_128) && NUM_MPF_NET_BUF_128 > 0 */ 227 229 228 #if defined(_IP4_CFG) 230 #if defined(_IP6_CFG) 231 232 #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 233 { 234 MPF_NET_BUF_CSEG, 235 IF_HDR_SIZE + IP_HDR_SIZE + TCP_HDR_SIZE, 236 237 #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF 238 239 NUM_MPF_NET_BUF_CSEG, 240 241 #endif /* of #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF */ 242 243 }, 244 #endif /* of #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 */ 245 246 #endif /* of #if defined(_IP6_CFG) */ 229 247 230 248 #if defined(NUM_MPF_NET_BUF_64) && NUM_MPF_NET_BUF_64 > 0 … … 242 260 #endif /* of #if defined(NUM_MPF_NET_BUF_64) && NUM_MPF_NET_BUF_64 > 0 */ 243 261 244 # endif /* of #if defined(_IP4_CFG) */262 #if defined(_IP4_CFG) && !defined(_IP6_CFG) 245 263 246 264 #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 … … 257 275 }, 258 276 #endif /* of #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 */ 277 278 #endif /* of #if defined(_IP4_CFG) && !defined(_IP6_CFG) */ 259 279 260 280 }; … … 307 327 308 328 while (1) { 309 if ((error = tget_mpf((ID)net_buf_table[ix].index, (void *)buf, ix == 0 ? tmout : TMO_POL)) == E_OK) {329 if ((error = tget_mpf((ID)net_buf_table[ix].index, (void **)buf, ix == 0 ? tmout : TMO_POL)) == E_OK) { 310 330 (*buf)->idix = (uint8_t)ix; 311 331 (*buf)->len = (uint16_t)minlen; … … 318 338 return error; 319 339 } 320 else if (ix == 0 || net_buf_table[ix].size > maxlen) 340 ix --; 341 if (ix < 0 || net_buf_table[ix].size > maxlen) 321 342 break; 322 ix --;323 343 } 324 344 … … 349 369 350 370 while (1) { 351 if ((error = tget_mpf((ID)net_buf_table[ix].index, (void *)buf,371 if ((error = tget_mpf((ID)net_buf_table[ix].index, (void **)buf, 352 372 ix == sizeof(net_buf_table) / sizeof(T_NET_BUF_ENTRY) - 1 ? tmout : TMO_POL)) == E_OK) { 353 373 (*buf)->idix = (uint8_t)ix; 354 374 (*buf)->len = net_buf_table[ix].size; 355 375 (*buf)->flags = 0; 376 #ifdef IF_ETHER_MULTI_NIC 377 (*buf)->conn_pos = 0; 378 #endif 356 379 357 380 #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF … … 450 473 /* 固定メモリプールに返す。*/ 451 474 452 #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF 453 net_buf_table[buf->idix].busies --; 475 int idix = buf->idix; 476 #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF 477 net_buf_table[idix].busies --; 454 478 #endif 455 if ((error = rel_mpf((ID)net_buf_table[ buf->idix].index, buf)) != E_OK) {456 syslog(LOG_WARNING, "[NET BUF] %s, ID=%d.", itron_strerror(error), buf->idix);479 if ((error = rel_mpf((ID)net_buf_table[idix].index, buf)) != E_OK) { 480 syslog(LOG_WARNING, "[NET BUF] %s, ID=%d.", itron_strerror(error), idix); 457 481 } 458 482 } … … 505 529 return (uint_t)net_buf_table[0].size; 506 530 } 531 532 #else 533 #include <stdlib.h> 534 535 /* 536 * tget_net_buf_ex -- ネットワークバッファを獲得する(拡張機能)。 537 */ 538 539 ER 540 tget_net_buf_ex (T_NET_BUF **buf, uint_t minlen, uint_t maxlen, ATR nbatr, TMO tmout) 541 { 542 uint_t len = (minlen > maxlen) ? minlen : maxlen; 543 *buf = (T_NET_BUF *)malloc(sizeof(T_NET_BUF) - sizeof(((T_NET_BUF *)0)->buf) + len); 544 if (*buf == NULL) 545 return E_NOMEM; 546 547 (*buf)->idix = 0; 548 (*buf)->len = (uint16_t)len; 549 (*buf)->flags = 0; 550 551 return E_OK; 552 } 553 554 /* 555 * tget_net_buf -- ネットワークバッファを獲得する(互換)。 556 */ 557 558 ER 559 tget_net_buf (T_NET_BUF **buf, uint_t len, TMO tmout) 560 { 561 return tget_net_buf_ex(buf, len, len, NBA_SEARCH_ASCENT, tmout); 562 } 563 564 565 /* 566 * rel_net_buf -- ネットワークバッファを返却する。 567 */ 568 569 ER 570 rel_net_buf (T_NET_BUF *buf) 571 { 572 free(buf); 573 574 return E_OK; 575 } 576 577 578 /* 579 * net_buf_max_siz -- ネットワークバッファの最大サイズを返す。 580 */ 581 582 uint_t 583 net_buf_max_siz (void) 584 { 585 return (uint_t)IF_PDU_SIZE; 586 } 587 588 #endif -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/net/net_rename.h
r337 r364 71 71 #define tget_net_buf_ex _tinet_tget_net_buf_ex 72 72 #define tget_net_buf _tinet_tget_net_buf 73 #define rel_net_buf _tinet_rel_net_buf74 #define rus_net_buf _tinet_rus_net_buf75 #define net_buf_siz _tinet_net_buf_siz73 #define rel_net_buf _tinet_rel_net_buf 74 #define rus_net_buf _tinet_rus_net_buf 75 #define net_buf_siz _tinet_net_buf_siz 76 76 #define net_buf_max_siz _tinet_net_buf_max_siz 77 77 #define nbuf_get_tbl _tinet_nbuf_get_tbl
Note:
See TracChangeset
for help on using the changeset viewer.