19a98f50eSThomas Monjalon// 29a98f50eSThomas Monjalon// Replace explicit packet offset computations with rte_pktmbuf_mtod_offset(). 39a98f50eSThomas Monjalon// 49a98f50eSThomas Monjalon@disable paren@ 59a98f50eSThomas Monjalontypedef uint8_t; 69a98f50eSThomas Monjalonexpression M, O; 79a98f50eSThomas Monjalon@@ 89a98f50eSThomas Monjalon( 99a98f50eSThomas Monjalon- rte_pktmbuf_mtod(M, char *) + O 109a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, char *, O) 119a98f50eSThomas Monjalon| 129a98f50eSThomas Monjalon- rte_pktmbuf_mtod(M, char *) - O 139a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, char *, -O) 149a98f50eSThomas Monjalon| 159a98f50eSThomas Monjalon- rte_pktmbuf_mtod(M, unsigned char *) + O 169a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, unsigned char *, O) 179a98f50eSThomas Monjalon| 189a98f50eSThomas Monjalon- rte_pktmbuf_mtod(M, unsigned char *) - O 199a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, unsigned char *, -O) 209a98f50eSThomas Monjalon| 219a98f50eSThomas Monjalon- rte_pktmbuf_mtod(M, uint8_t *) + O 229a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, uint8_t *, O) 239a98f50eSThomas Monjalon| 249a98f50eSThomas Monjalon- rte_pktmbuf_mtod(M, uint8_t *) - O 259a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, uint8_t *, -O) 269a98f50eSThomas Monjalon) 279a98f50eSThomas Monjalon 289a98f50eSThomas Monjalon 299a98f50eSThomas Monjalon// 309a98f50eSThomas Monjalon// Fold subsequent offset terms into pre-existing offset used in 319a98f50eSThomas Monjalon// rte_pktmbuf_mtod_offset(). 329a98f50eSThomas Monjalon// 339a98f50eSThomas Monjalon@disable paren@ 349a98f50eSThomas Monjalonexpression M, O1, O2; 359a98f50eSThomas Monjalon@@ 369a98f50eSThomas Monjalon( 379a98f50eSThomas Monjalon- rte_pktmbuf_mtod_offset(M, char *, O1) + O2 389a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, char *, O1 + O2) 399a98f50eSThomas Monjalon| 409a98f50eSThomas Monjalon- rte_pktmbuf_mtod_offset(M, char *, O1) - O2 419a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, char *, O1 - O2) 429a98f50eSThomas Monjalon| 439a98f50eSThomas Monjalon- rte_pktmbuf_mtod_offset(M, unsigned char *, O1) + O2 449a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, unsigned char *, O1 + O2) 459a98f50eSThomas Monjalon| 469a98f50eSThomas Monjalon- rte_pktmbuf_mtod_offset(M, unsigned char *, O1) - O2 479a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, unsigned char *, O1 - O2) 489a98f50eSThomas Monjalon| 499a98f50eSThomas Monjalon- rte_pktmbuf_mtod_offset(M, uint8_t *, O1) + O2 509a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, uint8_t *, O1 + O2) 519a98f50eSThomas Monjalon| 529a98f50eSThomas Monjalon- rte_pktmbuf_mtod_offset(M, uint8_t *, O1) - O2 539a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, uint8_t *, O1 - O2) 549a98f50eSThomas Monjalon) 559a98f50eSThomas Monjalon 569a98f50eSThomas Monjalon 579a98f50eSThomas Monjalon// 58*98a7ea33SJerin Jacob// Cleanup rules. Fold in double casts, remove unnecessary parenthesis, etc. 599a98f50eSThomas Monjalon// 609a98f50eSThomas Monjalon@disable paren@ 619a98f50eSThomas Monjalonexpression M, O; 629a98f50eSThomas Monjalontype C, T; 639a98f50eSThomas Monjalon@@ 649a98f50eSThomas Monjalon( 659a98f50eSThomas Monjalon- (C)rte_pktmbuf_mtod_offset(M, T, O) 669a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, C, O) 679a98f50eSThomas Monjalon| 689a98f50eSThomas Monjalon- (rte_pktmbuf_mtod_offset(M, T, O)) 699a98f50eSThomas Monjalon+ rte_pktmbuf_mtod_offset(M, T, O) 709a98f50eSThomas Monjalon| 719a98f50eSThomas Monjalon- (C)rte_pktmbuf_mtod(M, T) 729a98f50eSThomas Monjalon+ rte_pktmbuf_mtod(M, C) 739a98f50eSThomas Monjalon| 749a98f50eSThomas Monjalon- (rte_pktmbuf_mtod(M, T)) 759a98f50eSThomas Monjalon+ rte_pktmbuf_mtod(M, T) 769a98f50eSThomas Monjalon) 77