  We consider unfavoured light quark/antiquark to $D$ meson fragmentation. We
discuss nonperturbative effects for small transverse momenta. The asymmetry for
$D^+$ and $D^-$ production measured by the LHCb collaboration provides natural
constraints on the parton (quark/antiquark) fragmentation functions. We find
that already a fraction of $q/{\bar q} \to D$ fragmentation probability is
sufficient to account for the measured asymmetry. We make predictions for
similar asymmetry for neutral $D$ mesons. Large $D$-meson production
asymmetries are found for large $x_F$ which is related to dominance of light
quark/antiquark $q/\bar q \to D$ fragmentation over the standard $c \to D$
fragmentation. As a consequence, prompt atmospheric neutrino flux at high
neutrino energies can be much larger than for the conventional $c \to D$
fragmentation. The latter can constitute a sizeable background for the cosmic
neutrinos claimed to be observed recently by the IceCube Observatory. Large
rapidity-dependent $D^+/D^-$ and $D^0/{\bar D}^0$ asymmetries are predicted for
low ($\sqrt{s} =$ 20 - 100 GeV) energies. The $q/\bar q \to D$ fragmentation
leads to enhanced production of $D$ mesons at low energies. At $\sqrt{s}$ = 20
GeV the enhancement factor with respect to the conventional contribution is
larger than a factor of five. In the considered picture the large-$x_F$ $D$
mesons are produced dominantly via fragmentation of light quarks/antiquarks.
Predictions for fixed target $p+^{4}\!\textrm{He}$ collisions relevant for a
fixed target LHCb experiment are presented.
