Well, that is a linear equation so it should be fairly easy to find an integrating factor.
That is, you want to find a function, u(x), such that multiplying by it makes the left side an "exact derivative":
u(x)\frac{df}{dx}+ xu(x)f(x)= \frac{d(u(x)f}{dx}
By the product rule
\frac{d(uf)}{dx}= u\frac{df}{dx}+ \frac{du}{dx}f
Comparing those, we must have
\frac{du}{dx}= xu
or
\frac{du}{u}= x dx
Integrate that to find u(x), then multiply the entire differential equation by u(x) to get an exact equation.
By the way, you really need to use parenthese to clarify. Is that right hand side
(x^2)(m+1) or x^(2m)+ 1 or x^(2m+1)?
(I expect it is the last since that exponent being odd is important in integrating.)