Have you properly configured Soft-Roce whether upstream or Mellanox OFED Driver.
See reference links below:
Also, you original statement is confusing or contradicting itself:
when my write opcode with length=1024, it is ok. but when length=1025 in the same code, it will fail.
when the same code with length=1024 or 1025 run using mellanox CX4 card, it is ok >>> Apparently working.